LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial port read with commport.dll

I am trying to write, then read from a serial port using commport.dll.  I have a .vi that somebody wrote that works for write.  When I copy and paste the write string function, and then change it to read a string, I get a cryptic note about not changing the primite - I don't know what that means.  When I run the .vi, it crashes labview.  So I can't do any troubleshooting.  Context help is useless.  Error messages cryptic and non-explanatory.
 
How do I do this using commport.dll????
0 Kudos
Message 1 of 11
(7,281 Views)

What is commport.dll and where did you get it? And why aren't you using the LabVIEW functions to write to a com port?

You also didn't include the HexStr2BinStr subVI so no one can run the VI.

0 Kudos
Message 2 of 11
(7,278 Views)

I got the commport.dll from someone in the lab.  I assumed it was from NI - it does give me some sort of nag screen about registering.  I attached it.

Where are the NI comm port routines?  I didn't see any when I bring up vi's on the sidebar - just the normal stuff with structures, numeric, boolean, etc.

I think I attached all the sub-vi's.  Somebody else wrote this thing.  If there are more, let me know what they are called and I'll track them down.  But for now the attachment window limits me to three attachments (GRRRR!)

Download All
0 Kudos
Message 3 of 11
(7,273 Views)
There are just more missing subVIs in those that you posted. In any case, I probably won't run the dll as I have always found the LabVIEW functions to work perfectly for me. The functions are shown below. If you are using the Express palette view, it will be slightly different.
0 Kudos
Message 4 of 11
(7,267 Views)

OK - I am trying the NI drivers.  Unfortunately, I'm not getting much of anywhere.  I got this error:

-1073807298

The hardware is all hooked up properly, I know it is capable of communication. 

 

0 Kudos
Message 5 of 11
(7,260 Views)

You just can't drop a VISA Write into the middle of your other code. For one, the os only allows one process to access a port. That means you can't have your comport.dll process access it along with VISA. You could not have Hyperterminal running at the same time as comport.dll (unless it is comport.dll that Hyperterminal is using) either. You also need to wire a VISA Resource Name control or constant to a VISA write. This is what tells VISA which port to use.. You also have to have something actually wired to the write buffer input of VISA Write.

Open the example finder and do a search for serial. You will find both a basic and advanced example. Please note that the examples are designed to send ASCII characters. It's not clear to me if that is what you really need to do. The missing subVIs might explain that. If you need to send hex, what you should do with the basic example is right click on the string control for the data to write, and select Hex Display.

0 Kudos
Message 6 of 11
(7,258 Views)

I attached a Visa resource name - it is COM5: on my system.  I opened the basic serial read / write example on your site - but it is not writing to COM5: for some reason.  No bits toggle on the interface when I run it.

I have a bit of a problem with the basic read /write example anyway - in its serial port setup routine it assumes standard RS-232 stuff.  For example - stop bits of 1, 1.5, and 2.  I am trying to control a proprietary interface that has  write bit - low, followed by a mode bit, low, then an 8 bit address followed by 16 bits of data, then four dummy bits.  For read, I set the first bit low, then a mode bit low, 8 bits of address, 4 dummy bits, then 16 bits of read data coming back from the device.  Nothing standard about it at all.  So I need something that can bang those bits, just as I want them, to the serial port and then read the bits coming back on a read.  If I leave out that RS-232 setup block on the example, can I accomplish what I want to do? And why am I not seeing any bits toggling at all when I use the basic serial port write / read example?  I would at least expect it to send bits out to COM5: once I select the port, even if the bits aren't what I want - they should still be toggling.

0 Kudos
Message 7 of 11
(7,252 Views)

Additional info - I get this error:

Error -1073807298 occurred at VISA Write in Basic Serial Write and Read.vi

 

0 Kudos
Message 8 of 11
(7,253 Views)
That error means ' Could not perform operation because of I/O error. ' so no write is happening. I've seen reports of that error when using a USB-Serial adapter. If that's what you have, try this.
0 Kudos
Message 9 of 11
(7,243 Views)

You can add the TI TUSB3410 to the list of incompatible devices.  Unfortunately, changing devices is NOT an option for me - as the TI device is soldered down on the board I am trying to test.  Changing devices would entail buying a retail product (Not easy in the corporate environment here) - taking it apart, and jumpering data lines from that device to our board.  Not impossible - but if possible -

Is there a software workaround that will purge the buffer - a .vi or something that I can drop in to make this thing work? 

 

0 Kudos
Message 10 of 11
(7,241 Views)