BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 12:36 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: reading eeprom problems
PostPosted: Wed Apr 14, 2010 8:15 pm 
Offline
Guru

Joined: Fri Nov 13, 2009 10:28 am
Posts: 82
Location: Reno, Nevada
I now have a strange problem reading data from the eeprom. I have developed a VB program and the write, read functions work very well. Nano28. I then try to run the below code which is independent of the VB program and is a standalone setup. I know the data is in the eeprom because I can go back to the VB program and it reads accurately. The below code returns a value of 65535 indicating the addresses have no data. If I do only one variable (2 bytes) read, it returns the proper stored value (LeftVal is a word). This of course is another indication that the data is there. The code below is identical to the code I use in the VB interface program. I also saw a post saying to use the readdm and writedm code, which I did and it works fine in VB but has the same problems in the stand alone mode. The addresses for servo number 0 are 0-9. I have run out of ideas. If I can read the first 2 bytes I would think the rest should read ok too!

'All variables are words
readvar:
servonum=0

read (servonum*10),LeftVal.lowbyte 'address 0 byte
read ((servonum*10)+1),LeftVal.highbyte
read ((servonum*10)+2),CenterVal.lowbyte
read ((servonum*10)+3),CenterVal.highbyte
read ((servonum*10)+4),RightVal.lowbyte
read ((servonum*10)+5),RightVal.highbyte
read ((servonum*10)+6),tdlval.lowbyte
read ((servonum*10)+7),tdlval.highbyte
read ((servonum*10)+8),tdrval.lowbyte
read ((servonum*10)+9),tdrval.highbyte 'address 9 byte

serout s_out,baud,[dec LeftVal]:pause 500
serout s_out,baud,[dec LeftVal]:pause 500

servo 0,leftval,40
pause 1000
servo 0,0-rightval,40 'provides a negative value
pause 1000
goto main

_________________
Harley


Top
 Profile  
 
 Post subject: Re: reading eeprom problems
PostPosted: Fri Apr 16, 2010 4:41 pm 
Offline
Guru

Joined: Fri Nov 13, 2009 10:28 am
Posts: 82
Location: Reno, Nevada
The problem is resolved and as it turns out the nano's are fine and have no problems. It was a brain fart on my part. Hopefully no one spent much time looking for a bug that was mine!

_________________
Harley


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO