Hello all,
this is an old post. I'm not sure if my question fits right to here.
I have a temperature values and i would like to send them to a display from 4D Systems.
At the moment i was using the serial SPE commands as 4D Systems calls it, and they have exactly the command to send those variables.
Then i tried their "new" Visi Genie enviroment, which allows you to create "forms" and add any image, button etc.
I have fniished the easy task inside the Visi Genie and i'm in front of a problem that i need to transform the variable to string.
As from 4D Systems:
Visie-Genie writes to pre-defined objects so in this case it is a pre-defined string object so all we have to do is convert what we need to send to a string, calculate a checksum and send. This is where Genie differs from Serial as in the Serial mode you are sending a serial command to the display which is translated to a command to do a supported function on the display.
It is the first time i had to do a task with Checksum and found it interesting way by XORing all the bytes. In a very small code i tryied it worked, as i sent based on 4D Systems the command to change the constrast and it worked.
Code:
command var byte
constrast var byte
CS var byte
' -----------------------------------------------------------------------------|
' [ LCD Initialization ] |
'------------------------------------------------------------------------------|
' FIRST TIME BOOTUP: We give plenty of time for tbe LCD '
lcdinit:
pause 2000
command = $04
contrast = $06
gosub checksum
hserout [command,contrast,CS]
hserin [wait(6)]
pause 100
high green
return
'------------------------------------------------------------------------------|
' CHECKSUM |
'------------------------------------------------------------------------------|
checksum:
cs = 0
cs = cs ^command
cs = cs ^ contrast
return
Now i'm trying to see the way to convert var to string. I have read the manual written in 2013
"A numeric value preceded by a pound sign ( # ) will send the ASCII representation of its decimal value, up to 65535. For example, if W0 = 123, then #W0 (or #123) will send "1", "2", "3"."
Is that the right way? May i have your help please?
Bookmarks