i2c word to serout or sertxd

MarkDuncan34

New Member
Hi Guys,

I am still working on my NMEA data project and have made great progress thanks to help from people on here.

I am now storing three nmea sentances onto a i2c eeprom chip

Program:
I2cslave %10100000, i2cslow,i2cword writei2c 0, ("$GPDPT,15.6,0.0*655046.918,N,00111.1") '36'
pause 500
I2cslave %10100001, i2cslow,i2cword
writei2c 40, ("$GPGLL,4916.45,N,12311.12,W,225444,A,*1D")'40'
pause 500 I2cslave %10100001, i2cslow,i2cword
writei2c 81, ("$GPVTG,054.7,T,034.4,M,005.5,N,010.2,K*48")'41'
pause 500

I then use a small menu program so that the user can select what sentance he would like to transmit.
Then i can output the data from the memorey to a LCD using serout 6 comands set a 2400 n etc.

serout 6,n2400,(254,1)
pause 30
serout 6,n2400,(254,128)
pause 30
i2cslave %10100000, i2cslow, i2cword
for w1 = 0 to 36
readi2c w1, (b0)
pause 30
if w1 > 16 then serout 6,n2400,(254,24):endif
serout 6,N2400,(b0)
pause 500
next w1
this works well and the only change for the difrent sentances are where the program reads for w1 = 0 to 36, the second would read for w2= 40-80 and so on. the lower part of the above sentance allows the display to scrol one position once 16 characters have been displayed so that the whole sentance can be shown on the 16x2 display.

so my question is how and what is the best way to output onto a pc. because i am using a picaxe data loger bord i think i have the option of serout7. i have tried this but not sure i am doin thins correctly.
since then i have read the data sheets and it seems i may need to use the sertxd comand.

i have sucsesfully sent out data using this with the following code.
sertxd (#1,#2,#3,#4,#5,#6,#7,#8,#9)
this will display 123456789 on the hyperterminal window

what i would like to know is there away of sending out the the information stored under w1 0-36 for example

sertxd (#w1) this currently gives me a 0 on hyperterminal.

basicaly i would like to transmit the whole nmea sentance store in the i2c memorey. thank you for reading this and your time

cheers Mark :)
 

Technical

Technical Support
Staff member
w1 is the EEPROM address, it is not the actual data

to output the data to the computer you need to send out b0 in the same manner as your serout already does for the LCD.

for w1 = 0 to 36
readi2c w1, (b0)
pause 30
if w1 > 16 then serout 6,n2400,(254,24):endif
serout 6,N2400,(b0)
serout 7,N2400,(b0) ' <<<<<<< extra line send to PC via output 7
sertxd (b0) ' <<<<<<< extra line send to PC via cable
pause 500
next w1
 

westaust55

Moderator
i2c communications

As some further clarification, in your thread heading you state:
"i2c word to serout or sertxd"

note that i2c comms will only read and write byte (8-bit) vales, not word values.

In your program where yopu have the i2c setp:
"I2cslave %10100001, i2cslow, i2cword"

the "i2cword" part is a keyword for the Programming Editor in indicate that the i2c slave device uses a 16-bit (word) addressing structure.
 

MarkDuncan34

New Member
Thank you for your help again.
im so close to finishing this now, then all i will have to do it one hell of a write up for my project. if there is any intrest i will post up the full program and more details into what it should actualy do.

thanks again

Mark
 
Top