Oddity with "CR" & "LF" in datalink transfer routine

Hi,

I'm experimenting with logging data to the AT24C32 on a cheap DS1307 RTC board (controlled by an 08M2+) and having discovered lots of useful threads already (especially in the code snippets forum, thanks to all for those), it looks straightforward to do what I want.

In particular, I thought it would be useful in the future to be able to read the data back via the terminal/datalink, so I used the datalogger wizard to generate some vaguely appropriate code from which I can lift sections where appropriate, in particular the Datalink Transfer protocol from the end of the code.

When copied into my program though, it failed the syntax check initially on the "COM" in:
Code:
serout B.7, N4800, ( "Address",COM,"Light",CR,LF )
which of course was quickly fixed by copying:
Code:
symbol COM = 44 ; comma
to my symbols definitions. But then it failed again on the "CR" (and presumably will also on the "LF").

I quickly discovered that I can't define these as symbols, presumably because they're listed in picaxe_manual2.pdf as "Appendix 2 - Additional (non-command) reserved words".

The obvious instant work-around is just to replace all "LF"s with 10 and all "CR"s with 13, so no great problem there, but I'm puzzled that the logger wizard is generating code which requires that?

I'm using Picaxe Editor 6.0.6.2 (Beta) by the way, in case it's relevant.

Thanks to all for the continued support, and Happy New Year to all.
 

Buzby

Senior Member
Are you sure the error is related to the 'CR' / 'LF' ?.

It's strange because I use "serout ....... cr, lf )" lots of times, and never get errors because I used cr & lf.

These are two constants which are 'built in' to PE, so I don't think it it those that give you the error.

( I just ran the wizard, and the code passes syntax no problem. )

Cheers,

Buzby
 
Are you sure the error is related to the 'CR' / 'LF' ?.
Code:
SEROUT C.0,N4800, (#address,COM,#data0,13,10)
Indeed, the CR & LF probably are okay because it's still failing the syntax check on the above line and puts the cursor into the "13".

Which is what confused me because I failed to note that it's the "data0" which is not recognised. DOH!

Sorry about that, many thanks for your quick response.
 

hippy

Technical Support
Staff member
Code:
I failed to note that it's the "data0" which is not recognised. [B]DOH![/B][/QUOTE]
The Syntax Error reports usually detail as best they can why there is a Syntax Error. One would have expected "Error: Unknown symbol - data0" in this case.
 
Indeed it did, which I'd somehow failed to notice having got hung up by the previous "com" error which it seemed to be the same as, especially as the cursor was in the "LF" rather than on the data0. I shall look more carefully at error messages In the future.
 
Top