LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial port problem (works w/ MATLAB & not labview)

Hi, I'm having some difficulty getting my serial port to work under Labview. I've written a Matlab program and it works fine, but for some strange reason it will not work for me in Labview.

It's a really simple program. I'm controlling a stepper motor. I first set the speed by sending and 's' followed by the speed, ie: s600. Then I set the position by sending a 'g' followed by the position, ie: g150000.

I've checked all the settings and they seem to be the exact same as in my Matlab program, so I can't figure out why it's not working. I've spent a day trying to figure it out but can't. Hopefully someone has some ideas.

Thanks,

Sunny
Download All
0 Kudos
Message 1 of 4
(2,915 Views)
Are you sending the correct termination character(s)? In LabVIEW you need to explicitly include them (as shown by the \r\n in the String to Write control). This is a frequent cause of the "it works with that program but not with my LV program" problem.

Also, I would suggest making the mechanical action on the Write and Read booleans Latch when pressed and move the terminals into the appropriate event case. Add an event case for the Stop button and then the program will stop when you push the button rather than requiring you to push one of the other buttons again.

Lynn
Message 2 of 4
(2,910 Views)
I've updated it with your suggestions... still no luck.

The termination character is a CR, so I append a '\r' with all of my commands, ie: s600\r

Based on the Matlab code, the terminator is a CR so this should be right...
0 Kudos
Message 3 of 4
(2,902 Views)
Nvm... It does seem to be working with those changes... Maybe it was just that the buttons were not set to latch?

Anyways, thanks a bunch for the help !!

Sunny
0 Kudos
Message 4 of 4
(2,898 Views)