Jump to content

how to send continuous commands to COM Port?


pockey

Recommended Posts

Hi, all

I'm writing LabVIEW to test a board through COM Port.

There're buttons on the front panel for user to send commands to the board.

I could send one command at a time and display the response on a string indicator...

However, I did not know how to send continuous commands one-by-one with just one button.

For the "Reset" buttons, it will only send "x" to the COM Port, and the program runs OK.

For the "RX_LOWBAND" button, it should send string "p rxon1", "p paen0", "p hp0", "r 0x0118" and "r 0x24ad" one-by-one to the board and get each corresponding response.

I use a stacked sequence stracture to send these five commands one after one, however, the program could only implement the first one.

Since I'm quite new to LabVIEW, I do not know whether there's some easy way to realize that...

Could anyone give me some suggestion?

Thanks a lot!

Download File:post-6631-1168846857.vi

post-2-1168853441.gif?width=400

Link to comment

Hello,

I think you should consider a redesign of your code starting from one of the Design Patterns included with the standard templates. Depending on your knowledge of LabVIEW and application requirements you should go for a one loop state machine or consumer/producer pattern with 2 loops.

Also consider using events instead of polling buttons and do not forget your error handling.

Best regard,

Donald

Link to comment

Hello pockey,

Donald is absolutely correct... :thumbup:

I have moved my mouse considering Donald's suggestions and your requirement.

Result is a small piece of code which can guide in right direction.

I have used events instead of pooling and included error handling.

I am sure you can figure out remaining coding part...

All the best.

Regards,

Karthik SP

Download File:post-4779-1168870168.vi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.