Searching \ for '[PIC]: 16F870 Error defying logic...' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/microchip/devices.htm?key=16F
Search entire site for: '16F870 Error defying logic...'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 16F870 Error defying logic...'
2001\06\20@230526 by Nick Veys

flavicon
face
Absolutely mind boggling.  I have a chunk of code causing some kind of
software reset.  The WDT is disabled, in fact, all interrupts are disabled
in this program in it's entirety.  The kicker is, this code is NOT being
executed when the reset occurs, it is tied to one button, the other button I
push works fine but randomly causes a reset...  when I comment out the code,
it works fine (of course it doesn't do what I need though.)

Here's the snippet...  It's an EEPROM data write.

 ; ** EEPROM DATA STORAGE
 BANK0
 movf DEVSTATUS,w                              ; load data
 bcf PIR2,EEIF                                 ; clear complete flag just in case
 BANK2                                         ; go to bank2
 movwf EEDATA                                  ; set DATA
 movlw 0                                               ; load address
 movwf EEADR                                   ; set ADDRESS
 BANK3                                         ; go to bank3
 bcf EECON1,EEPGD                              ; DATA memory
 bsf EECON1,WREN                                       ; enable writes
;  movlw 0x55                                   ; * required
;  movwf EECON2                                 ; * eeprom
;  movlw 0xAA                                   ; * writing
;  movwf EECON2                                 ; * crap
 bsf EECON1,WR                                 ; initiate write
;  bcf EECON1,WREN                              ; disable writes
 BANK0
;  btfss PIR2,EEIF                              ; wait til the
;    goto $-1                                   ; writing is complete
 bcf PIR2,EEIF                                 ; clear complete flag
 return

if I uncomment any of those lines in ANY combination, I get a reset after a
few presses on my button, which DOES NOT execute this code :( :( :(   It's
almost as thought just having this code in makes it act erratic.  This is
reproducable on 2 different chips, I'm out of ideas and frustrated...

spam_OUTnickTakeThisOuTspamveys.com | http://www.veys.com/nick

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam@spam@mitvma.mit.edu


2001\06\21@160355 by Nick Veys

flavicon
face
I sent this last night @ like 1am but I never recieved it from the list, nor
any other PICList stuff til today @ like noon so I don't know if the server
burped or something, so I'll resend it... SORRY IF IT ACTUALLY DID GET
THROUGH, not meaning to spam... :)

Absolutely mind boggling.  I have a chunk of code causing some kind of
software reset.  The WDT is disabled, in fact, all interrupts are disabled
in this program in it's entirety.  The kicker is, this code is NOT being
executed when the reset occurs, it is tied to one button, the other button I
push works fine but randomly causes a reset...  when I comment out the code,
it works fine (of course it doesn't do what I need though.)

Here's the snippet...  It's an EEPROM data write.

 ; ** EEPROM DATA STORAGE
 BANK0
 movf DEVSTATUS,w                              ; load data
 bcf PIR2,EEIF                                 ; clear complete flag just in case
 BANK2                                         ; go to bank2
 movwf EEDATA                                  ; set DATA
 movlw 0                                               ; load address
 movwf EEADR                                   ; set ADDRESS
 BANK3                                         ; go to bank3
 bcf EECON1,EEPGD                              ; DATA memory
 bsf EECON1,WREN                                       ; enable writes
;  movlw 0x55                                   ; * required
;  movwf EECON2                                 ; * eeprom
;  movlw 0xAA                                   ; * writing
;  movwf EECON2                                 ; * crap
 bsf EECON1,WR                                 ; initiate write
;  bcf EECON1,WREN                              ; disable writes
 BANK0
;  btfss PIR2,EEIF                              ; wait til the
;    goto $-1                                   ; writing is complete
 bcf PIR2,EEIF                                 ; clear complete flag
 return

if I uncomment any of those lines in ANY combination, I get a reset after a
few presses on my button, which DOES NOT execute this code :( :( :(   It's
almost as thought just having this code in makes it act erratic.  This is
reproducable on 2 different chips, I'm out of ideas and frustrated...

nickspamKILLspamveys.com | http://www.veys.com/nick

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\06\21@184145 by Tony Nixon

flavicon
picon face
Nick Veys wrote:
{Quote hidden}

Are any of the buttons connected to RB3 or is it floating and is LVP
enabled?

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
.....salesKILLspamspam.....bubblesoftonline.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\06\21@195107 by Nick Veys

flavicon
face
RB3 is an output, but I haven't hooked it up yet, tho it IS set to output...
and I have _LVP_OFF in the __CONFIG line.

EraseMEnickspam_OUTspamTakeThisOuTveys.com | http://www.veys.com/nick

>
> Are any of the buttons connected to RB3 or is it floating and is LVP
> enabled?
>
> {Original Message removed}

2001\06\21@212632 by Drew Ames

flavicon
face
Does including these statements possibly push the code that IS being executed
into a bank that it is not expecting?
If the routines you ARE using come after this one, try re-ordering your code and
placing them before this routine.





**********************************************************************
This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to
whom they are addressed. If you have received this email
in error please notify the sender.

This footnote also confirms that this email message has
been swept by MAILsweeper for the presence of computer
viruses.

**********************************************************************

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\06\21@213054 by David Duffy

flavicon
face
At 10:04 PM 20/06/01 -0500, you wrote:
{Quote hidden}

I haven't been following this one but some idea's. Does having the extra line
push a table over a page boundary? Have you checked the bank macro's?
What happens if you substitute a NOP for each line commented out?
Regards...

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\06\21@213841 by Nick Veys

flavicon
face
I've essentially copied the EEPROM routines from the datasheet... The read
works just fine, but when I try to write, it resets.  I double checked the
banks, just in case, and they are right...  I have cut and paste the
subroutines all over my program and it doesn't change anything, even tried
taking the eeprom write out of the function, and into it's own function,
same result... UGH!!! I'm totally stumped...

nickspamspam_OUTveys.com | http://www.veys.com/nick

> {Original Message removed}

2001\06\21@214308 by David Duffy

flavicon
face
At 08:37 PM 21/06/01 -0500, you wrote:
>I've essentially copied the EEPROM routines from the datasheet... The read
>works just fine, but when I try to write, it resets.  I double checked the
>banks, just in case, and they are right...  I have cut and paste the
>subroutines all over my program and it doesn't change anything, even tried
>taking the eeprom write out of the function, and into it's own function,
>same result... UGH!!! I'm totally stumped...

Check the definitions for the EEPROM registers and bits.
If their wrong, you may be writing to program memory.
Regards...

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\06\21@230229 by Bob Ammerman

picon face
Is this shifting your code so that you have a PCLATH problem?

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2001\06\21@232630 by Dan Michaels

flavicon
face
Nick Veys wrote:
>Absolutely mind boggling.  I have a chunk of code causing some kind of
>software reset.  The WDT is disabled, in fact, all interrupts are disabled
>in this program in it's entirety.  The kicker is, this code is NOT being
>executed when the reset occurs, it is tied to one button, the other button I
>push works fine but randomly causes a reset...  when I comment out the code,
>it works fine (of course it doesn't do what I need though.)
>


2 things to check:

- you have PCLATH bits properly set/re-set for all "inter"-page
 operations.

- you don't accidentally have a "goto" where you should have
 a "call". [this burned me 2 days ago].

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\06\21@233724 by Nick Veys

flavicon
face
I wouldn't think so, I don't have any fixed space instructions, and the only
things that even use the PCL are a couple tiny jumps based on a "mode"
state-machine variable that ranges 0-5, nothing significant...  Looking @
the 16F870 datasheet, since this little guy only has 2K of instruction
memory, I shouldn't need to access PCLATH at all (if I'm reading it
correctly.)  This is my first venture out of 16F84 land, is there more I
need to know?  Do I need to babysit the program counter?

@spam@nickKILLspamspamveys.com | http://www.veys.com/nick

> {Original Message removed}

2001\06\21@234826 by David Duffy

flavicon
face
At 10:36 PM 21/06/01 -0500, you wrote:
>I wouldn't think so, I don't have any fixed space instructions, and the only
>things that even use the PCL are a couple tiny jumps based on a "mode"
>state-machine variable that ranges 0-5, nothing significant...  Looking @
>the 16F870 datasheet, since this little guy only has 2K of instruction
>memory, I shouldn't need to access PCLATH at all (if I'm reading it
>correctly.)  This is my first venture out of 16F84 land, is there more I
>need to know?  Do I need to babysit the program counter?

Nick,
You need to make sure you don't cross a 256 byte boundary using PCL.
Either put those routines in the first 256 bytes or check/adjust PCLATH.
Regards...

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\06\22@071144 by Bob Ammerman

picon face
> I wouldn't think so, I don't have any fixed space instructions, and the
only
> things that even use the PCL are a couple tiny jumps based on a "mode"
> state-machine variable that ranges 0-5, nothing significant...  Looking @
> the 16F870 datasheet, since this little guy only has 2K of instruction
> memory, I shouldn't need to access PCLATH at all (if I'm reading it
> correctly.)  This is my first venture out of 16F84 land, is there more I
> need to know?  Do I need to babysit the program counter?

Yeah, you will have to make sure PCLATH is right before doing your
state-machine jumps!

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

> KILLspamnickKILLspamspamveys.com | http://www.veys.com/nick
>
> > {Original Message removed}

2001\06\22@090731 by Olin Lathrop

face picon face
> if I uncomment any of those lines in ANY combination, I get a reset after
a
> few presses on my button, which DOES NOT execute this code :( :( :(   It's
> almost as thought just having this code in makes it act erratic.  This is
> reproducable on 2 different chips, I'm out of ideas and frustrated...

Take a look at your load map.  Is it possible that those few extra lines
causes some other code to cross a page boundary?


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, RemoveMEolinTakeThisOuTspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\06\22@093039 by Nick Veys

flavicon
face
Going to take a look @ it tonight, odds are that's what's going on, but
would that cause a reset? or maybe it's just going to the beginning of the
page and appearing to be a reset... ?

spamBeGonenickspamBeGonespamveys.com | http://www.veys.com/nick

> {Original Message removed}

2001\06\22@101944 by Olin Lathrop

face picon face
> Going to take a look @ it tonight, odds are that's what's going on, but
> would that cause a reset? or maybe it's just going to the beginning of the
> page and appearing to be a reset... ?

If code is moving accross a page boundary unexpectedly, then just about
anything could happen.  With PCLATH set incorrectly on a CALL or GOTO, you
are essentially jumping to a random location.  This could eventually cause a
jump to 0, a return to a garbage location on stack underflow, etc.  If the
watchdog is enabled, it could be doing its job and resetting the processor
because your code is no longer kicking it.

I personally avoid these problems by setting up a separate linker section
for each code page.  This guarantees that individual modules won't cross
page boundaries.  I can then always use bare GOTOs and CALLs within a
module, and always do the PCLATH diddling between modules.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, TakeThisOuTolinEraseMEspamspam_OUTembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\06\22@124752 by Raymond Choat

flavicon
face
Is the Low Voltage Program disabled? This will cause the strangest effect on
the PORT B pins if not. I fought finding this one for weeks once.
Wrong Way Ray (Raymond Choat)

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...