LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI MAX and Labview not connecting to device while other code can

Hello, 

 

I have been attempting to adapt a Visual basic code to a LabVIEW program where I am reading from a serial device (Heidenhain VRZ 460). The VI that I have built only writes to the device STX (which is the ASCII string to read start of text) then tries to read the data from the device. I have seen on this forum examples of this being done and have followed them but the same error keeps appearing where the read times out with no response. I believed that this was a coding issue but I tried to use the VISA resource panel to communicate with the device and it has the same error. The visual basic code works and can talk to the device but the NI MAX VISA resource panel and LabVIEW cannot communicate with the device. The port settings for this device are Baud rate:9600, even pairty, 7 data bits and 2 stop bits and none flow control. Has anyone seen NI MAX and Labview not work with a device while other code works correctly?

 

 

Thanks,

 

MM

0 Kudos
Message 1 of 8
(1,457 Views)

Yes I have seen that and it was always a PEBKAC problem or a complete misunderstanding of how they thought their other software was talking to the device.

 

Visual Basic code would hint at rather old examples too, Microsoft doesn’t sell it for a long time already and tries to marginalize VBA for quite some time too.

 

So what functions does your Visual Basic program use to establish communication? How do you format the string that you try fo send to the device? What string does your VB program send?

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 8
(1,440 Views)

The Full VB code is :

Form1.MSComm1.PortOpen = True

From1.MSComm1.Output = Chr$(2)

Start = Timer

While Timer - Start < 1

Wend

A$ = From1.MSComm1.Input

Print A$

From1.MSComm1.PortOpen = False

 

The read command is the "From1.MSComm1.Output = Chr$(2)" where it talks the the device using VB's ASCII specific term which is Chr$(2). 

0 Kudos
Message 3 of 8
(1,428 Views)

Is your VB application:

  1. Not running at the same time?
  2. Properly closing the com port?

If the answer to either is no then neither NI-Max nor LabVIEW will be able to access the com port.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 8
(1,390 Views)

The VB application was built to show that the issue was only with NI MAX and labview. The VB application was shut off when testing labview or the VISA resource panel each time and if it wasn't there was an error message about the port conflicting. 

0 Kudos
Message 5 of 8
(1,382 Views)

Can you upload your code? My magic 8 ball says you're not sending the control character that you think you are, but we can't be sure without seeing some code.

0 Kudos
Message 6 of 8
(1,369 Views)

@BertMcMahan wrote:

Can you upload your code? My magic 8 ball says you're not sending the control character that you think you are, but we can't be sure without seeing some code.


You mean, like writing a literal "STX" to the serial port, or maybe "02" string?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 8
(1,334 Views)

@billko wrote:

@BertMcMahan wrote:

Can you upload your code? My magic 8 ball says you're not sending the control character that you think you are, but we can't be sure without seeing some code.


You mean, like writing a literal "STX" to the serial port, or maybe "02" string?


Ah, I see we shop at the same magic 8 ball store 🙂

0 Kudos
Message 8 of 8
(1,269 Views)