From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing multiple commands using button with serial port communication issue

hi , 

I'm relatively familiar with the basics of LabVIEW, but I am new to serial communication with VISA. I have had no luck finding a solution to my problem.

i'm testing a PCB card which has displays , i need to send multiple commands to test displays , but i got no response also i have problem with my buttons they send just the first command

please help Smiley Sad

0 Kudos
Message 1 of 5
(2,727 Views)

Don't use Switch until released on that button.  You should be using Latched when Released.

 

Also, Don't use bytes at port.  If your messages have a termination character, and it seems they do since you have left the termination character enabled on your VISA Configure, then you should read a large number and allow the VISA Read to terminate once it receives the termination character.

0 Kudos
Message 2 of 5
(2,724 Views)

accually , i'm not using termination character . i just want to send hex commands in the same times with  buttons .i think i have problem in write event (case loop) 

0 Kudos
Message 3 of 5
(2,707 Views)

Then wire a False to the Enable Termination Character input of the Serial Configure.

 

Get rid of the number to string function that you wire to the case structure.  Perhaps that is the problem.  You can wire the enum directly to the case structure selector.

 

Make sure your VISA reference wire is wired across all cases of the event structure.

 

Put an indicator on your error wire.  Do you know if you are getting any errors?  The indicator would clue you in if you were.  And if you get one error, that shift register on the error wire will keep any functions from operating the way you want in future iterations.

0 Kudos
Message 4 of 5
(2,675 Views)

@Safsaf16 wrote:

accually , i'm not using termination character . i just want to send hex commands in the same times with  buttons .i think i have problem in write event (case loop) 


You still should not be using the Bytes At Port.  You obviously have a communication protocol that you are following and expect your device to follow.  Use that.  Usually with a binary/hex protocol, the messages are either fixed in length, have a message length byte (or two), or some other way of knowing how many bytes are in the message.  This will probably require multiple reads in order to get your message correctly (only enough bytes to get the length and then read the rest of the message).  But this will guarantee you get the full reply instead of just hoping you did not cut it off.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5
(2,627 Views)