Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Serialin and serialout with hex


Freluque Jul 31, 2012 04:01 PM

Hello everybody
I have to send to my sensor the following command
&HAA0D00000000 (48 bits)
To do that I write this program but it seems not to work properly ( I think it is because the number is really large and CR1000 can not save properly in its memory but I am not sure!)
I hope you will manage to send my command
For information I use this kind of serial sensor
http://www.4dsystems.com.au/downloads/micro-CAM/Docs/uCAM-DS-rev7.pdf
//////////////////
Public ASCIIString
Public Expression
Public InString
Const CR = CHR(13)+CHR(10)
'==================================================================================================================
Sub RECUP
InString = ""
Delay (0,2,Sec)
SerialInBlock (COMRS232,InString,1000)
ASCIIString = ASCII(InString)
EndSub
Sub SEND
SerialFlush(ComRS232)
Expression=&hAA0D0000
SerialOutBlock (COMRS232,&hAA0D0000,6)
Delay(1,600,mSec)
SerialOut(ComRS232,CHR(13)+CHR(10),"",0,100)
Delay(1,600,mSec)
EndSub
BeginProg
SerialOpen (ComRS232,115200,0,100,50) ' Open communication with sensor
Scan(10,Sec,0,0) ' Measure every 10 seconds.
InString = ""
'--- Check read and write flags -----------------------------------------------------------------------------------
SEND
RECUP
If IfTime (9,10,Sec)
SerialClose (COMRS232)
SerialOpen (ComRS232,9600,0,100,50)
SerialClose (COMRS232)
EndIf
NextScan ' Goto Scan.
'------------------------------------------------------------------------------------------------------------------

* Last updated by: Freluque on 8/1/2012 @ 8:09 AM *

Log in or register to post/reply in the forum.