Hello,
I hope you will find the solution. I am crazy about it! I have downloaded the latest os (rev25) and I currently use a CR1000.
My problem is the following: I do not manage to get binary data... If for example I send to CR1000
0x12345678
I receive in decimal format (in value variable for my prog)
2018915346 it seems to be normal!
but if I send now:
0xAAAAAAAA I receive no data in my RS232 buffer and for the moment I do not know why ...
I assume my errors in the lines :
NbytesReturnedCDOM =SerialInBlock (COMRS232,InString,2000)
MoveBytes(value,0,Instring(),0,4)
You will find my program... I send my command in hex after receiving aa0d00000000 0d0a
I use termite 2.9 to have a compatible-hexadecimal terminal...
My program:
Public NbytesReturnedCDOM
Public Instring As String *10000
Public value As Long
'==================================================================================================================
Sub GET
NbytesReturnedCDOM=-1
Delay (0,1,Sec)
NbytesReturnedCDOM =SerialInBlock (COMRS232,InString,2000)
MoveBytes(value,0,Instring(),0,4)
InString = ""
EndSub
Sub SEND
SerialOutBlock (COMRS232,CHR(170),1)
SerialOutBlock (COMRS232,CHR(13),1)
SerialOutBlock (COMRS232,CHR(0),1)
SerialOutBlock (COMRS232,CHR(0),1)
SerialOutBlock (COMRS232,CHR(0),1)
SerialOutBlock (COMRS232,CHR(0),1)
SerialOut(ComRS232,CHR(13)+CHR(10),"",0,100)
SerialFlush (COMRS232)
EndSub
BeginProg
SerialOpen (ComRS232,115200,0,100,500) ' Open communication with sensor
Scan(10,Sec,0,0) ' Measure every 10 seconds.
InString = ""
SEND
GET
NextScan ' Goto Scan.
'------------------------------------------------------------------------------------------------------------------
EndProg ' End program.
I had a quick look as this and reviewed the manual for the camera too. In that manual I could see no reference to have to send carriage return and line feed characters at the end of the commands but there is mention of having to send SYNC packets to the camera (up to 60) and waiting for ACK packets before starting to send and get response to commands.
In terms of sending out strings with null characters in them you can build a string by assigning value to a character at a time by using the third array index, for instance, this section of code builds and sends the "SYNC" command to the camera:
outstring(1,1,1)=CHR(&HAA)
outstring(1,1,2)=CHR(&H0D)
outstring(1,1,3)=CHR(&H00)
outstring(1,1,4)=CHR(&H00)
outstring(1,1,5)=CHR(&H00)
outstring(1,1,6)=CHR(&H00)
SerialOutBlock(com1,outstring(),6)
Outstring is defined as a string.