The ID directive
In many programs (and the docs) there is a directive called ID.
I understand how to SET it but how do you display it?· Using the example from the docs:
ID··· "GPXv2.1"
and put it directly under the FREQ statement and limit it to 8 chars or less.
When I try to use Jon's TX_OUT subroutine (for example):
TX_OUT·· ID
it says the ID is a reserved word.·
TX_OUT allows a string or byte to be sent to your output device (in my case an LCD panel).
'
TX_Out:
' Use: TX_OUT [noparse][[/noparse] byte | string | label ]
' -- "aByte" is variable or constant byte value
' -- "string" is an embedded literal string
' -- "label" is DATA statement label for stored z-String
' --· Written by Jon Williams (Parallax)
· TX_temp3 = __PARAM1····················· ' get byte or string offset
· IF __PARAMCNT = 2 THEN
··· TX_temp4 = __PARAM2··················· ' get string base
··· DO
····· READ TX_temp4 + TX_temp3, TX_temp5·· ' read a character
····· IF TX_temp5 = 0 THEN EXIT··········· ' if 0, string complete
····· TX_BYTE TX_temp5···················· ' send the byte
····· INC TX_temp3························ ' point to next character
····· TX_temp4 = TX_temp4 + Z············· ' update base on overflow
··· LOOP
· ELSE
··· TX_BYTE TX_temp3······················ 'transmit the byte value
· ENDIF
· RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
I understand how to SET it but how do you display it?· Using the example from the docs:
ID··· "GPXv2.1"
and put it directly under the FREQ statement and limit it to 8 chars or less.
When I try to use Jon's TX_OUT subroutine (for example):
TX_OUT·· ID
it says the ID is a reserved word.·
TX_OUT allows a string or byte to be sent to your output device (in my case an LCD panel).
'
TX_Out:
' Use: TX_OUT [noparse][[/noparse] byte | string | label ]
' -- "aByte" is variable or constant byte value
' -- "string" is an embedded literal string
' -- "label" is DATA statement label for stored z-String
' --· Written by Jon Williams (Parallax)
· TX_temp3 = __PARAM1····················· ' get byte or string offset
· IF __PARAMCNT = 2 THEN
··· TX_temp4 = __PARAM2··················· ' get string base
··· DO
····· READ TX_temp4 + TX_temp3, TX_temp5·· ' read a character
····· IF TX_temp5 = 0 THEN EXIT··········· ' if 0, string complete
····· TX_BYTE TX_temp5···················· ' send the byte
····· INC TX_temp3························ ' point to next character
····· TX_temp4 = TX_temp4 + Z············· ' update base on overflow
··· LOOP
· ELSE
··· TX_BYTE TX_temp3······················ 'transmit the byte value
· ENDIF
· RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
Comments
The ID is included in the assembled code and can be read by using the IDE's Run\Device menu. This allows us to create a hex file of a program (to protect the source from others) and still have it be identified (once the hex file is loaded into the that dialog).
To keep things trimmer and less complicated I use TX_BYTE and TX_STR in my programs; here are the latest:
And in the event you really like the TX_OUT subroutine here's a better version of it:
Post Edited (JonnyMac) : 6/21/2007 11:56:05 PM GMT
· The ID is useful when you protect your code in the SX. Everything read back from the SX will be scrambled EXCEPT the ID string.
· In the IDE if you use Run->Device then click the "Read" button, the ID will be displayed in the ID box (just below the options check boxes).
· This way you can see what version of your code a device has, even it is has code protection turned on.
· But there is no way for your SX code to read the ID string. (That I know of)
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
First of all, what is the advantage of putting sub before the name of a subroutine, as in "SUB TX_STR"?
Second what does this instruction, "READINC" do?
Is there an SX/B manual I haven't read?
Thanks,
Dave
READINC READs from an address and then INCrements the address pointer variable -- this is in the SX/B help file (also available as a PDF) that you apparently haven't read....
I've read the original help file, version 1.50.01 -- 05 JUL 2006 , many times, but I can't get the latest version to run. It errors out on three different computers when I either click on it or try to run it from the IDE. I'll look for that .pdf file.