EEPROM Read Problems

View: New views
18 Messages — Rating Filter:   Alert me  

EEPROM Read Problems

by threewheeler7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

High everyone, i have worked with PICs quite a bit, but i have never used the internal EEPROM. i have read the pic16f648's datasheet and looked through quite a few web sites on the subject only, i am having a hard time finding what i am looking for. for now i am trying to read 16 bytes of data from EEPROM, and sending them to a LCD. all i get is 16 forward slashes on my LCD. I have included the vital piece of code, i know it cannot be too big of a deal but i would appreciate your help, as i have been scratching my head over this.
thankyou.



Code:

EEPROM
        movlw d'16'
        movwf count
        clrf temp                ;address 0x00
E1
        movlw temp          ;load address into w
        bsf STATUS, RP0 ;Bank 1
        movwf EEADR              ;move address to EEPROM
        bsf EECON1, RD ;EE Read
        movf EEDATA, W ;W = EEDATA
        bcf STATUS, RP0 ;Bank 0
        call LCD_CharD
        incf temp,f
        decfsz count,f
        goto E1

Re: EEPROM Read Problems

by Jinx-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> movlw temp           ;load address into w

I think you want to be using movf temp,w. That's why display data
doesn't change as you go through the loop

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by Spehro Pefhany :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>
>Code:
>
>EEPROM
>         movlw   d'16'
>         movwf   count
>         clrf    temp                ;address 0x00
>E1
>         movlw temp                ;load address into w     <-- here
> you're loading the LS 8 bits of the *address* of temp, not the
> value *in* temp, into W

    you probably want to use movf temp,w

Odd that you'd be getting '/' though, I think I would have expected a
block or 'y' with umlaut(sp?) if the unused
portion of the EEPROM was 0xFF.




>         bsf STATUS, RP0         ;Bank 1
>         movwf EEADR              ;move address to EEPROM
>         bsf EECON1, RD          ;EE Read
>         movf EEDATA, W          ;W = EEDATA
>         bcf STATUS, RP0         ;Bank 0
>         call    LCD_CharD
>         incf    temp,f
>         decfsz  count,f
>         goto    E1
>--
>View this message in context:
>http://www.nabble.com/EEPROM-Read-Problems-tp18395862p18395862.html
>Sent from the PIC - [PIC] mailing list archive at Nabble.com.
>
>--
>http://www.piclist.com PIC/SX FAQ & list archive
>View/change your membership options at
>http://mailman.mit.edu/mailman/listinfo/piclist

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
speff@...             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com



--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by Jinx-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Odd that you'd be getting '/' though, I think I would have expected
> a block or 'y' with umlaut(sp?) if the unused portion of the EEPROM
> was 0xFF

EE has most likely been successfully written with data somewhere else

threewheeler7, you could INCF EEADR instead of running an external
counter. And BANKSEL would be an improvement over using RP0

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by Christopher Head :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

threewheeler7 wrote:
[snip]
| Code:
|
| EEPROM
| movlw d'16'
| movwf count
| clrf temp                ;address 0x00
| E1
| movlw temp          ;load address into w

You want MOVF temp, W here.

| bsf STATUS, RP0 ;Bank 1
| movwf EEADR              ;move address to EEPROM
| bsf EECON1, RD ;EE Read
| movf EEDATA, W ;W = EEDATA
| bcf STATUS, RP0 ;Bank 0
| call LCD_CharD
| incf temp,f
| decfsz count,f
| goto E1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: GnuPT 2.7.2
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkh25PEACgkQiD2svb/jCb5FNgCgjiXACt8eNviZv9FV3VEM9Gb6
QyMAn3zyTGRGreRLTn4JErSg1Eo3wTfO
=FUSE
-----END PGP SIGNATURE-----
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by Olin Lathrop :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

threewheeler7 wrote:

> EEPROM
> movlw d'16'
> movwf count
> clrf temp                ;address 0x00
> E1
> movlw temp           ;load address into w
> bsf STATUS, RP0 ;Bank 1
> movwf EEADR              ;move address to EEPROM
> bsf EECON1, RD ;EE Read
> movf EEDATA, W ;W = EEDATA
> bcf STATUS, RP0 ;Bank 0
> call LCD_CharD
> incf temp,f
> decfsz count,f
> goto E1

For one thing, labels start in column 1 and everything else in column 2 or
later.  Didn't this mess produce massive warnings?


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by Tamas Rudnai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> For one thing, labels start in column 1 and everything else in column 2 or
> later.  Didn't this mess produce massive warnings?

I think he actually did it right, so maybe the mail client or MTA stripped
off the leading spaces on your side, Olin. Here is what I got from the first
post:

> Code:
>
> EEPROM
>        movlw   d'16'
>        movwf   count
>        clrf    temp                ;address 0x00
> E1
>        movlw temp                ;load address into w
>        bsf STATUS, RP0         ;Bank 1
>        movwf EEADR              ;move address to EEPROM
>        bsf EECON1, RD           ;EE Read
>        movf EEDATA, W          ;W = EEDATA
>        bcf STATUS, RP0         ;Bank 0
>        call    LCD_CharD
>        incf    temp,f
>        decfsz  count,f
>        goto    E1
>



On Fri, Jul 11, 2008 at 1:52 PM, Olin Lathrop <olin_piclist@...>
wrote:

> threewheeler7 wrote:
> > EEPROM
> > movlw d'16'
> > movwf count
> > clrf temp                ;address 0x00
> > E1
> > movlw temp           ;load address into w
> > bsf STATUS, RP0 ;Bank 1
> > movwf EEADR              ;move address to EEPROM
> > bsf EECON1, RD ;EE Read
> > movf EEDATA, W ;W = EEDATA
> > bcf STATUS, RP0 ;Bank 0
> > call LCD_CharD
> > incf temp,f
> > decfsz count,f
> > goto E1
>
> For one thing, labels start in column 1 and everything else in column 2 or
> later.  Didn't this mess produce massive warnings?
>
>
> ********************************************************************
> Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
> (978) 742-9014.  Gold level PIC consultants since 2000.
> --
> http://www.piclist.com PIC/SX FAQ & list archive
> View/change your membership options at
> http://mailman.mit.edu/mailman/listinfo/piclist
>



--
Rudonix DoubleSaver
http://www.rudonix.com
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by Olin Lathrop :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tamas Rudnai wrote:
> I think he actually did it right, so maybe the mail client or MTA
> stripped off the leading spaces on your side, Olin.

No, my mail software does not strip off leading spaces.  Perhaps he used tab
characters, which of course are interpreted differently on different
systems.  I saw others also quoted his message with leading spaces missing.

Once again we wouldn't be having this discussion if mail was sent in plain
ASCII with no control characters.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by Shawn Tan Ser Ngiap :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 11 July 2008 14:54:48 Olin Lathrop wrote:
> Once again we wouldn't be having this discussion if mail was sent in plain
> ASCII with no control characters.

Hear! Hear!

--
with metta,
Shawn Tan

Aeste Works (M) Sdn Bhd - Engineering Elegance
http://www.aeste.net
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by Mark Rages :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Jul 11, 2008 at 8:54 AM, Olin Lathrop <olin_piclist@...> wrote:

> Tamas Rudnai wrote:
>> I think he actually did it right, so maybe the mail client or MTA
>> stripped off the leading spaces on your side, Olin.
>
> No, my mail software does not strip off leading spaces.  Perhaps he used tab
> characters, which of course are interpreted differently on different
> systems.  I saw others also quoted his message with leading spaces missing.
>
> Once again we wouldn't be having this discussion if mail was sent in plain
> ASCII with no control characters.
>

The horizontal tab character has been in ASCII for 40 years.  Perhaps
it is time to upgrade your mail software.

Regards,
Mark
markrages@gmail
--
Mark Rages, Engineer
Midwest Telecine LLC
markrages@...
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by Olin Lathrop :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark Rages wrote:
> The horizontal tab character has been in ASCII for 40 years.  Perhaps
> it is time to upgrade your mail software.

The character is well defined but its action is not.  There are no standard
tab stops.

By now people really should know not to put tab characters in files you
expect others to look at, especially when they are asking them to do so as a
favor.  There is no way to know what tab stops are set on someone else's
system.  Since just about any editor can translate tabs to spaces according
to the tab settings at the time, there is really no excuse for this.

If you insist on using some brain dead editor that can't convert tabs to
spaces, then you can always do it by post processing.  My freely available
ASPIC_FIX program does that, in addition to a few other things to make PIC
assembler source as readable as possible.  My COPYA program has command line
options for converting tabs to spaces with arbitrary tab stops of your
choosing.  There are many other programs out there too.

Personally I think any MPASM code posted here should be run thru ASPIC_FIX
first, although I may be a tad partial.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by Tamas Rudnai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> By now people really should know not to put tab characters in files you
> expect others to look at, especially when they are asking them to do so as
a
> favor.

I agree with you about TAB-is-a-no-no, however, MPLAB's default is to use
TAB. So it is for vim - the first thing usually when I install these to
change this to spaces, but I doubt if too many people would care of this.

> Personally I think any MPASM code posted here should be run thru ASPIC_FIX
> first, although I may be a tad partial.

Also if people would use vim with softtabstop set a pressing two chars
('=G') while the cursor is in the beginning of the file would do the trick.
Ok, to go to the beginning of the file is also two pressings ('1G') so i
guess altogether with 4 pressing is just too much <grin>

Tamas


On Fri, Jul 11, 2008 at 5:18 PM, Olin Lathrop <olin_piclist@...>
wrote:

> Mark Rages wrote:
> > The horizontal tab character has been in ASCII for 40 years.  Perhaps
> > it is time to upgrade your mail software.
>
> The character is well defined but its action is not.  There are no standard
> tab stops.
>
> By now people really should know not to put tab characters in files you
> expect others to look at, especially when they are asking them to do so as
> a
> favor.  There is no way to know what tab stops are set on someone else's
> system.  Since just about any editor can translate tabs to spaces according
> to the tab settings at the time, there is really no excuse for this.
>
> If you insist on using some brain dead editor that can't convert tabs to
> spaces, then you can always do it by post processing.  My freely available
> ASPIC_FIX program does that, in addition to a few other things to make PIC
> assembler source as readable as possible.  My COPYA program has command
> line
> options for converting tabs to spaces with arbitrary tab stops of your
> choosing.  There are many other programs out there too.
>
> Personally I think any MPASM code posted here should be run thru ASPIC_FIX
> first, although I may be a tad partial.
>
>
> ********************************************************************
> Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
> (978) 742-9014.  Gold level PIC consultants since 2000.
> --
> http://www.piclist.com PIC/SX FAQ & list archive
> View/change your membership options at
> http://mailman.mit.edu/mailman/listinfo/piclist
>



--
Rudonix DoubleSaver
http://www.rudonix.com
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by threewheeler7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey thanks, i should have seen that right away! its always great to have someone else to look over your code. i don't know anyone else that writes. you're all i got. do any of you have any suggestions on what is a simpler way of loading eeprom values into hex files. i have just been using mplab's eeprom view, and then exporting the hex. i am using ic-prog.

Re: EEPROM Read Problems

by Jinx-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> MPLAB's default is to use TAB. So it is for vim - the first thing
> usually when I install these to change this to spaces, but I doubt
> if too many people would care of this

I wish they would, tabs make such a mess

In MPLAB, Edit/Properties/Sizes Insert Spaces

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by William "Chops" Westfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jul 11, 2008, at 8:29 AM, Mark Rages wrote:

> The horizontal tab character has been in ASCII for 40 years.  Perhaps
> it is time to upgrade your mail software.

Heh.  And poorly defined for all of those years!  We have battles  
over whether C indentation should be a mix of tabs and spaces, tabs  
only, or spaces only.  Over and Over Again.  Sigh.

Nowdays, of course, none of the indentation solutions works well in  
email, what with tab stops being ill- or un-defined, and spaces  
subject to compression due to (per-user defined) proportional fonts  
used for display...

BillW

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by CDB-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



:: In MPLAB, Edit/Properties/Sizes Insert Spaces

In v8.01, that is under

Edit/Properties/FILE TYPES

Colin
--
cdb, colin@... on 12/07/2008
 
Web presence: www.btech-online.co.uk  
 
Hosted by:  www.1and1.co.uk/?k_id=7988359
 
Friendship multiplies the good of life and divides the evil.
Baltasar Gracian
 
 
 
 

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by Olin Lathrop :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

threewheeler7 wrote:
> do any of you have any suggestions on what is a
> simpler way of loading eeprom values into hex files.
> i have just been using mplab's
> eeprom view, and then exporting the hex.

Put the EEPROM values in the source code.  On a PIC 16:

eeprom  code h'2100'
         de   val, ... val

On a PIC 18:

eeprom  code_pack h'F00000'
         db   byte, ... byte

********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: EEPROM Read Problems

by John Chung :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The poor definition of tabs has caused plenty of grief. After
this mail I think I will switch to spaces from now on.


Good post,
John Chung





--- On Sat, 7/12/08, Tamas Rudnai <tamas.rudnai@...> wrote:

> From: Tamas Rudnai <tamas.rudnai@...>
> Subject: Re: [PIC] EEPROM Read Problems
> To: "Microcontroller discussion list - Public." <piclist@...>
> Date: Saturday, July 12, 2008, 2:30 AM
> > By now people really should know not to put tab
> characters in files you
> > expect others to look at, especially when they are
> asking them to do so as
> a
> > favor.
>
> I agree with you about TAB-is-a-no-no, however, MPLAB's
> default is to use
> TAB. So it is for vim - the first thing usually when I
> install these to
> change this to spaces, but I doubt if too many people would
> care of this.
>
> > Personally I think any MPASM code posted here should
> be run thru ASPIC_FIX
> > first, although I may be a tad partial.
>
> Also if people would use vim with softtabstop set a
> pressing two chars
> ('=G') while the cursor is in the beginning of the
> file would do the trick.
> Ok, to go to the beginning of the file is also two
> pressings ('1G') so i
> guess altogether with 4 pressing is just too much
> <grin>
>
> Tamas
>
>
> On Fri, Jul 11, 2008 at 5:18 PM, Olin Lathrop
> <olin_piclist@...>
> wrote:
>
> > Mark Rages wrote:
> > > The horizontal tab character has been in ASCII
> for 40 years.  Perhaps
> > > it is time to upgrade your mail software.
> >
> > The character is well defined but its action is not.
> There are no standard
> > tab stops.
> >
> > By now people really should know not to put tab
> characters in files you
> > expect others to look at, especially when they are
> asking them to do so as
> > a
> > favor.  There is no way to know what tab stops are set
> on someone else's
> > system.  Since just about any editor can translate
> tabs to spaces according
> > to the tab settings at the time, there is really no
> excuse for this.
> >
> > If you insist on using some brain dead editor that
> can't convert tabs to
> > spaces, then you can always do it by post processing.
> My freely available
> > ASPIC_FIX program does that, in addition to a few
> other things to make PIC
> > assembler source as readable as possible.  My COPYA
> program has command
> > line
> > options for converting tabs to spaces with arbitrary
> tab stops of your
> > choosing.  There are many other programs out there
> too.
> >
> > Personally I think any MPASM code posted here should
> be run thru ASPIC_FIX
> > first, although I may be a tad partial.
> >
> >
> >
> ********************************************************************
> > Embed Inc, Littleton Massachusetts,
> http://www.embedinc.com/products
> > (978) 742-9014.  Gold level PIC consultants since
> 2000.
> > --
> > http://www.piclist.com PIC/SX FAQ & list archive
> > View/change your membership options at
> > http://mailman.mit.edu/mailman/listinfo/piclist
> >
>
>
>
> --
> Rudonix DoubleSaver
> http://www.rudonix.com
> --
> http://www.piclist.com PIC/SX FAQ & list archive
> View/change your membership options at
> http://mailman.mit.edu/mailman/listinfo/piclist


     
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist