LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial read seems to work great until clear

I am creating an emulator for a serial device.  I have written the code to communicate with the device and it has worked just fine.  Now I want to write a VI to emulate the device to test my software updates when I can't use the hardware.
 
My serial communication seems to work well until I receive a clear and then I no longer see bytes to be read.
 
  1. PC 2 Device: Sends a "!"
  2. Device to PC: Sends a "1" if data available
  3. PC 2 Device: Sends "2" - to clear requests
  4. Device Receives clear
  5. PC 2 Device: Sends a command string "......."
  6. Device to PC: Receive command
  7. Device to PC: Reply with command...send data

During normal operation this all works smooth.  I am trying to create a VI to replace the Device.  My emulator has no problems seeing the data from step 1 and 3 and replying in step 2.  But, I cant see any data in step 4.  I use the "Bytes at Port" and it returns 0. 

I have tried flushing the I/O buffer, sending a VISA Clear.  Nada.  I am using a simple loopback from Com1 to Com2.  And I have set temination character "\r"

any Ideas?

0 Kudos
Message 1 of 3
(2,954 Views)

Hi Gold,

Try taking an NI Spy capture when communicating with the actual hardware, and then compare that to an NI Spy capture of the emulator communication.  You can find NI Spy in the National Instruments folder.  The NI Spy capture will show you exactly what is being sent back and forth.  There might be something different in the communication with the emulator that is causing the behavior that you're seeing.

Regards,

Rima

Rima H.
Web Product Manager
0 Kudos
Message 2 of 3
(2,923 Views)

Thanks Rima... I'll give it a try and see how it goes.  For some reason I thought NI Spy would only look at network and not serial data.

Gold

0 Kudos
Message 3 of 3
(2,896 Views)