|
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
|