programmatically emulate receiving from serial device?
travis
Posts: 180
I've been using the Emulate a Device panel a lot lately and I'd like to just put some code into my mainline to automate my testing a little.
I naively tried:
but nothing showed up at my data event.
Is this possible?
I naively tried:
DEFINE_PROGRAM WAIT 30 { send_string 5001:1:0 , "'R123',13" }
but nothing showed up at my data event.
Is this possible?
0
Comments
I don't know of a way to simulate this with code (could very well be possible). But if you are using a buffer to parse the data, you could just assign the string to the end of the buffer. But you would have to parse in mainline as no Data_Event would be generated.
If not, you could loop the TX pin to the RX pin of the com port and use the code you have. AMX will send the string out the TX port which will immediately come back into the RX port.
Kevin D.
I hope it's possible. I want to test my actual Data_Event code. If I could do this, I could write a bunch of elaborate tests, and then when I plugged in the actual sensors, they would Just Work.
I'd try this, but I don't have any actual hardware handy.
I guess we could also write some serial port emulator program outside of netlinx.
thanks
But keep in mind that this may not be the "real world"
This works and I only had to change a few things that can easily be changed back for the real sensors.
Right now I'm trying to figure out the right way to to nest the waits so they will happen in order, 2 seconds apart...
Edit: using a timeline now. Works well. Awkward to set up though.
Thanks, guys!