Is possible use &h in variables long format?.
for example:
Public longvar as long
beginprog
longvar=2694
longvar=&h+longvar (I think it would transmit &h2694, that is hexadecimal number)
In need the hexadecimal be transmit in long format and no string. Actually the longvar is not constant and it will take variable values.
I hope this example clarifies how to go about it.
Public longvar As Long = &h26940000 'Long variables are 4 bytes long
Public InputHex As String * 9 = "0A0B0C0D"
Public longvar2 As Long
BeginProg
Scan (1,Sec,0,0)
SerialOutBlock (Com1,longvar,2) 'Outputs first two bytes of longvar
longvar2 = HexToDec(InputHex)
SerialOutBlock (Com1,longvar2,4) 'Output all 4 bytes of longvar2
NextScan
EndProg
Thank you
But they are constants. I will have variables continuously and I need they are in long format.
like in this case:
But if they are variables values:
Public longvar As Long = &h26940000 'Long variables are 4 bytes long
BeginProg
Scan (1,Sec,0,0)
SerialOutBlock (Com1,longvar,2) 'Outputs first two bytes of longvar
The example I provided does work with variables. You can change the values of longvar and InputHex from the Public table.
It is also interesting to note the following. With the following concatenation, the datalogger will attempt to treat the righthand side as a 32 bit signed integer.
Public hexStr1 As String * 10 = "0A0B0C0D"
Public hexStr2 As String * 10 = "&h0A0B0C0D"
Public flt1 As Float
Public flt2 As Float
Public lng1 As Long
Public lng2 As Long
Public dbl1 As Double
Public dbl2 As Double
BeginProg
Scan (1,Sec,0,0)
'result is 1.684961e+08
flt1 = "&h" & hexStr1
flt2 = hexStr2
'result is 168,496,141
lng1 = "&h" & hexStr1
lng2 = hexStr2
'result is 168,496,141
dbl1 = "&h" & hexStr1
dbl2 = hexStr2
NextScan
EndProg
Thank you very much. I could use the concatenation successfully to my purpose.