Hi Ken, W is used to pass data to LCD_Data. The interrupt service uses the following to prevent it from currupting other operations. movwf w_int ;save w movf STATUS,w ;save STATUS movwf Stat_int movf FSR,w ;save FSR movwf FSR_int <<< service here >>> movf FSR_int,w movwf FSR movf Stat_int,w movwf STATUS movf w_int,w ;restore w bcf STATUS,Z ;ensure that restoring w btfsc Stat_int,Z ;does not change zero flag state bsf STATUS,Z Wow, this project was going super smooth until I ran into this issue. I've come up with some more debug ideas. I'll let you know if they turn up anything Thanks, Steve > Hi Steve, > > Maybe now is a good time to divide and conquer. Let's assume the EEPROM > read > is working fine. > > Regarding function 'LCD_Data' are you using the W register to pass the data > byte read from the EEPROM or is the function accessing the EEDATA register > to get the data. If the former, are you sure the W register is not getting > trashed somehow -- like during an interrupt? > > Does you interrupt service routine properly restore the WREG? > > As an experiment, can you clear GIE (disable global interrupts) until after > function 'LCD_Data' is complete. Does this change anything? > > Let me know what you find out -- also can you post the 'LCD_data' and ISR > code? Sometimes a second pair of eyes helps. > > Keep workin' it! > > Best regards, > > Ken Pergola > > > > > > > > > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of stesquib@MINES.EDU > Sent: Saturday, August 09, 2003 11:44 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC] internal EEPROM trouble > > > Hello, > > EEPROM_ADD is in bank0. When simulating in MPLAB the correct address makes > it to > EEADR. Also, All EEPROM data is read properly while simulating. I've > rewritten > the routine using BANKSEL as well as using FSR/INDF. Both give the same > results. > > I have determined that data is only being read from the last address > written > to. > However, improper banking should be evident in MPLAB SIM. > > Thx, > Steve > > > Hi Steve, > > > > What bank is your variable 'EEPROM_ADD' in? Did you set the bank select > > bits > > correctly for this variable? > > > > Some helpful suggestions: > > > > I would *strongly* suggest using the BANKSEL directive and using named > > constants for the hard-coded constants. > > BANKSEL will pay for itself handsomely! Let the compiler to the work -- > > eliminates human errors -- fast cheap labor. Using named constants will > > make > > your code more readable and easier to maintain. > > > > Let us know about the address of 'EEPROM_ADD' -- you are very close to > > getting this working. > > > > Chime on back with some feedback on your progress, ok? You are almost > > there! > > > > Good luck, > > > > Ken Pergola > > > > > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > From: pic microcontroller discussion list > > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of stesquib@MINES.EDU > > Sent: Saturday, August 09, 2003 8:44 PM > > To: PICLIST@MITVMA.MIT.EDU > > Subject: Re: [PIC] internal EEPROM trouble > > > > > > hello, > > > > The purpose behind the OR's is to prevent the compiler from returning a > > warning. > > All functions switch back to bank 0 before returning. I tried clearing > both > > RP's > > at the beginning of the routine (in case I missed something) but that did > > not > > affect my results. Also, everything works fine when simulated in MPLAB. > > > > Thanks, > > Steve > > > > > > Quoting Ken Pergola : > > > > > Hi Steve, > > > > > > Don't you want 'movwf EEADR' instead of 'movwf EEADR ^ 0x100' ? > > > > > > I'm curious about your reasoning behind all of the exclusive ORs with > the > > > special function registers? > > > It appears to me that the intended SFR addresses are being modified by > > the > > > XORs you are performing on the SFR addresses. I'm a bit confused > > > here...please chime in...I might be missing something. > > > > > > Also, on your first bank select (BANK 2) I noticed you have not touched > > > 'RP1' -- are you sure of the state of RP1 when you enter the routine? > > > > > > > > > Best regards and hope this helps somewhat, > > > > > > Ken Pergola > > > > > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > > From: pic microcontroller discussion list > > > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of stesquib@MINES.EDU > > > Sent: Saturday, August 09, 2003 5:04 PM > > > To: PICLIST@MITVMA.MIT.EDU > > > Subject: Re: [PIC] internal EEPROM trouble > > > > > > > > > Hello, > > > > > > Sorry about the lack of detail. I'm sending the data read from the > EEPROM > > > to > > > an > > > LCD. I verified that data is written properly by reading the entire > chip > > > through > > > my programer. I've also inserted the address just before writing to > > EEADR: > > > movlw > > > 0x04 ect. and still I get data from 0x07. The chip is running @ 8MHz > from > > > the > > > internal RC. > > > > > > My read routine: > > > EEPROM_read > > > bcf INTCON,GIE ;debug ;interrupts off > > > movf EEPROM_ADD,w ;save address in w > > > bsf STATUS,RP1 ;Bank2 > > > movwf EEADR ^ 0x100 ;load EEPROM_Address > > > bsf STATUS,RP0 ;Bank3 > > > clrf EECON1 ^ 0x180 ;point to data memory and clr WREN > > > bsf EECON1 ^ 0x180,RD ;activate read > > > bcf STATUS,RP0 ;Bank2 > > > movf EEDATA ^ 0x100,w ;save data in w > > > bsf STATUS,RP0 > > > clrf EECON1 ^ 0x180 ;debug ;drop read bit should be cleared by HW > > > bcf STATUS,RP0 > > > bcf STATUS,RP1 > > > bsf INTCON,GIE ;debug ;ints off > > > call LCD_Data ;debug ;Display what came out of eeprom > > > return > > > > > > Thx, > > > Steve > > > > > > > > > > Hi Steve, > > > > > > > > Are you at liberty to post some code? It's hard to say what is wrong > > > > without > > > > it. > > > > How are you "seeing" the data read from the EEPROM? Are you using an > > ICE, > > > > ICD, LCD, LEDs, serial port? > > > > Some more details would be helpful. > > > > > > > > Regards, > > > > > > > > Ken Pergola > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > > > From: pic microcontroller discussion list > > > > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of stesquib@MINES.EDU > > > > Sent: Saturday, August 09, 2003 4:28 PM > > > > To: PICLIST@MITVMA.MIT.EDU > > > > Subject: [PIC] internal EEPROM trouble > > > > > > > > > > > > Hello, > > > > > > > > I'm nearing the end of a project but having trouble with the final > > > feature. > > > > this last feature writes and reads data from the internal EEPROM. I > > have > > > > verified that data is properly written to the EEPROM. But, no matter > > what > > > > address I try to read, I get the data stored in 0x07. I've verified > the > > > > Issue on > > > > two seperate PIC16F819's and used the same routine on a 16F676. With > > > proper > > > > bank > > > > changes the 676 version works fine. Any ideas about what I may be > doing > > > > wrong? > > > > > > > > Always greatfull for any advice, > > > > Steve > > > > > > > > -- > > > > http://www.piclist.com hint: To leave the PICList > > > > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > > > > > -- > > > > http://www.piclist.com hint: To leave the PICList > > > > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > > > > > > > -- > > > http://www.piclist.com hint: To leave the PICList > > > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > > > -- > > > http://www.piclist.com hint: To leave the PICList > > > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > > > > -- > > http://www.piclist.com hint: To leave the PICList > > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > -- > > http://www.piclist.com hint: To leave the PICList > > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads