I am trying to send a string to a device using command P15. The string triggers the device to make a measurement and then it returns a string with the data in it. Below is a portion of the code I am trying to use. I cannot get the sensor to respond. Does anyone have experience doing something like this?
;###LOAD PRESSURE MEASUREMENT COMMAND --###
6: Z=F (P30)
1: 1 F
2: 0 Exponent of 10
3: 4 Z Loc [ Mpressu_1 ]
7: Z=F (P30)
1: 86 F
2: 0 Exponent of 10
3: 5 Z Loc [ Mpressu_2 ]
8: Z=F (P30)
1: 49 F
2: 0 Exponent of 10
3: 6 Z Loc [ Mpressu_3 ]
9: Z=F (P30)
1: 48 F
2: 0 Exponent of 10
3: 7 Z Loc [ Mpressu_4 ]
10: Z=F (P30)
1: 2 F
2: 0 Exponent of 10
3: 8 Z Loc [ Mpressu_5 ]
11: Z=F (P30)
1: 3 F
2: 0 Exponent of 10
3: 9 Z Loc [ Mpressu_6 ]
12: Z=F (P30)
1: 189 F
2: 0 Exponent of 10
3: 10 Z Loc [ Mpressu_7 ]
;###SEND PRESSURE MEASUREMENT STRING###
;###RECEIVE PRESSURE DATA###
17: Port Serial I/O (P15)
1: 1 Reps
2: 1 8-Bit, RS-232 ASCII, 1200 Baud
3: 1 Delay (0.01 sec units) before TX
4: 40 C4 TX/RX, No RTS/DTR (OS>1.14)
5: 4 Start Loc for TX [ Mpressu_1 ]
6: 7 Number of Locs to TX
7: 0 Termination Character for RX
8: 1000 Max Characters to RX
9: 50 Time Out for CTS (TX) and/or RX (0.01 secunits)
10: 28 Start Loc for RX [ PressSol ]
11: 1.0 Multiplier for RX
12: 0 Offset for RX
aSnow,
I used to use the P15 instruction all the time in a previous life. CRBasic loggers make these tasks much easier.
You definitely need 2 P15 Instructions I think, one to send the command and one to receive the data.
Please paste the command string and expected response and I'll see if I can help you out.
Regards,
IslandMan
OK I have been working with two P15 commands now(one to send one to receive), but still without luck as to receiving the data. I need to send it 2 strings, the first to wake up the sensor and the second to execute the measurement. The wakeup is [ 87 ] (no brackets). The command string is(no brackets):
[1 86 49 48 2 3 189]
Both need to end with nulls.
The reply should be:
1 86 49 48 2 # # # # # # # # # # U U U U U U 3 BCC
where # are measurement values and U's are characters for the units.
Thanks for any tips that you may be able to give. What can I say, old gear is free gear....
aSNOW
* Last updated by: aSNOW on 12/4/2008 @ 5:09 PM *
aSNOW,
First - Are you doing anything to level shift or protect the input ports to 0 - 5 Vdc? Have you looked in Appendix B of the CR10X manual that describes Serial Communications with the P15 Instruction?
Second - I'm assuming the numbers are decimal equivalents to ASCII characters? If you need to send it a wakeup, you'll need three P15 Instructions.
Wakeup = 87 00 W and Null?)
Query = 1 86 49 48 2 3 189
This equates to "SOH V 1 0 STX ETX 1/2" which doesn't make sense to me.
Please post the text from the manual regarding the serial port interface for your device and we'll take it from there.
Suggest we get the CR10X to wake up the sensor and query it, capturing the response with something like HyperTerminal on the TX Data line of the sensor to make sure we're actually tripping it to send it's data.
Regards,
IslandMan