LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Port Error code

Hi all

   I want to communicated with Serial Port Send command and get right as below snapshots:

 1) I used to Serial_assist Tools when power on get initial message from product and send"AT+SELFTEST=TEST" get right code.

 

 How to use labview set up serial port ignored first time initial message and send"AT+SELFTEST=TEST" get right code.

 

 

 

0 Kudos
Message 1 of 6
(1,242 Views)

Hi Sam,

 

two notes:

  • Don't use local variables when the terminals are unused next to them!
  • Don't use BytesAtPort!

@Sam.Huang wrote:

How to use labview set up serial port ignored first time initial message and send"AT+SELFTEST=TEST" get right code.


Setup the port, send your command and receive the answer - without local variables and without BytesAtPort!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,204 Views)

Hi GerdW

  Thank you for you reply,I changed it as you mention get as before,if other need to setup it,thanks!!

 

 

Download All
0 Kudos
Message 3 of 6
(1,201 Views)

Hi Sam,

 

no need for that wait function, the VISARead will wait for 512 bytes (or TermChar) anyways!

 

Do you have a manual of your device describing the comm protocol? You need to follow the guidelines written in there like:

  • When the device sends two messages you need to read both.
  • When the device sends a "binary" message you maybe cannot use a TermChar.

Read the details in your manual!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(1,192 Views)

Hi GerdW

   It's a earbuds product,client provide baudrate and cmmand"AT+SELFTEST=TEST",then back command as“;g-sensor:OK;P-sensor:FAIL;PPG:FAIL;has_dc:OK”.

 

The problem is when power on with the earbuds,will out a initial message,first time send command and get wrong measage, hold on power send command again will get right meassage.

 

I think that if ignored inital message and clear it then send command will get right code,but I don't how to configured it,could you give a idea for this,thanks!!

 

0 Kudos
Message 5 of 6
(1,189 Views)

Hi Sam,

 


@Sam.Huang wrote:

I think that if ignored inital message and clear it then send command will get right code,but I don't how to configured it,could you give a idea for this,thanks!!


Read the initial message, then send the command and read its response.

So you need VISARead (maybe with timeout error handling), VISAWrite, VISARead…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(1,184 Views)