Support Forums
Serial return floating point format

I am integrating a wireless module to a DT80, which has a serial connector, and we have integrated a small amount of code to ensure that the wireless device sends back a reading when polled.

However, when sending the command:

1SERIAL("{\er001}%f[1CV]")

The serial return times out, even though the buffer says it has read the correct figure and that there is nothing left in the buffer. If i ask for a decimal return (i.e. output is 25.4 degC ) 1SERIAL("{\er001}%d[1CV]") 1CV=25 and .4 is left in the buffer.

Am I doing something wrong? but i want the floating point to be held in 1CV. but it feel like its looking for something else after it, this is my only explanation for it subsequently timing out.

Would have had debug code to shown but failed to save when out at client. Will generate more tomorrow, but pointers welcome from dataTaker or other experts.

Best regards,
Peter

I am integrating a wireless module to a DT80, which has a serial connector, and we have integrated a small amount of code to ensure that the wireless device sends back a reading when polled. However, when sending the command: ```` 1SERIAL("{\er001}%f[1CV]") ```` The serial return times out, even though the buffer says it has read the correct figure and that there is nothing left in the buffer. If i ask for a decimal return (i.e. output is 25.4 degC ) 1SERIAL("{\er001}%d[1CV]") 1CV=25 and .4 is left in the buffer. Am I doing something wrong? but i want the floating point to be held in 1CV. but it feel like its looking for something else after it, this is my only explanation for it subsequently timing out. Would have had debug code to shown but failed to save when out at client. Will generate more tomorrow, but pointers welcome from dataTaker or other experts. Best regards, Peter

Good morning Peter,

Is there an end of line terminator? Usually there is a or pair to mark the end of the line. It would be unusual not to have a line terminator and DT80 would be looking for an end of line but not finding it.

If you know there is always 3 place then you could try

1SERIAL("{\er001}%4f[1CV]")

Which will read the first 4 characters

Cheers,
Roger

Good morning Peter, Is there an end of line terminator? Usually there is a or pair to mark the end of the line. It would be unusual not to have a line terminator and DT80 would be looking for an end of line but not finding it. If you know there is always 3 place then you could try ```` 1SERIAL("{\er001}%4f[1CV]") ```` Which will read the first 4 characters Cheers, Roger

Roger,

there is no end of line terminator. also, we can't guarantee there will always be 4 characters, what about -20.2, or 100.2

1SERIAL("{\er002}%f[1CV]")

C,091286,2011/02/22,08:18:18,0.585205,101;334,"CAL_PH";
?? 1SERIAL: RxBuf=2[.2]
?? 1SERIAL: OutputActions: "\er002"
?? 1SERIAL: RxBuf-0[]
?? 1SERIAL: Tx [r002]
?? 1SERIAL: InputAction: "%f[1CV]"
?? 1SERIAL: RxBuf+4[21.2]
?? 1SERIAL: RxBuf-0[]
E,091286,2011/02/22,08:18:28,0.639648,89;"Serial sensor receive timeout at control string position 16";

If there is no end of line terminator, what can be done?

What we are doing is feeding out a decimal in the new code we are implementing so that we just have to divide by 10. This would then be similar to the actions of modern PLC units. Its not ideal though.

Peter

Roger, there is no end of line terminator. also, we can't guarantee there will always be 4 characters, what about -20.2, or 100.2 ```` 1SERIAL("{\er002}%f[1CV]") C,091286,2011/02/22,08:18:18,0.585205,101;334,"CAL_PH"; ?? 1SERIAL: RxBuf=2[.2] ?? 1SERIAL: OutputActions: "\er002" ?? 1SERIAL: RxBuf-0[] ?? 1SERIAL: Tx [r002] ?? 1SERIAL: InputAction: "%f[1CV]" ?? 1SERIAL: RxBuf+4[21.2] ?? 1SERIAL: RxBuf-0[] E,091286,2011/02/22,08:18:28,0.639648,89;"Serial sensor receive timeout at control string position 16"; ```` If there is no end of line terminator, what can be done? What we are doing is feeding out a decimal in the new code we are implementing so that we just have to divide by 10. This would then be similar to the actions of modern PLC units. Its not ideal though. Peter

Hi Peter,

If it is your own code why not add a. Even PLC's when outputting ASCII will add line termination. Without marking where the line ends the only option is to time out.

Cheers,
Roger

Hi Peter, If it is your own code why not add a. Even PLC's when outputting ASCII will add line termination. Without marking where the line ends the only option is to time out. Cheers, Roger

We did that, it was just a whole lot of extra compiling.

Thanks anyway

We did that, it was just a whole lot of extra compiling. Thanks anyway
24
4
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft