LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA read in exe file is not working

Strange behavior. Have you checked the power settings to see if you can enable the port?

 

You could still use the laptop with a USB->RS232 converter.

0 Kudos
Message 11 of 23
(1,946 Views)

Clara G wrote:

Hi again,

 

I seems that we have located the source of the problem. It appears that the program is not working on a laptop, unless it's connected to a docking station. I guess this has something to do with the powering of the serial port? The write commands are working, but not the read commands.

 

Thanks for all the help, I just thought I's share what we learned. I guess the solution is just to not use a laptop.

 

Clara


Check the ground wire in your cable and make sure it is connected to the appropriate pins on each end of the cable.  I've seen a case where a bad ground will cause problems in communication.

 

Story:

We started supplying a product manufactured by another company specifically for us.  Unfornuately, since they were the "experts", they did what they thought was correct.  The device had a 25 pin serial port on it so a PC or laptop can connect to it for programming or data logging.  We were told it needed a null modem cable for the connection.  However, they did not tell us that the ground wire for the cable was connected pin 1 on the device rather than pin 7 per the DB25 RS-232 standard.

 

I discovered in the field the standard null modem cable didn't work when I loaded our software on the customer's laptop and it wouldn't communicate.  Fortunately, I had taken our laptop and it communicated just fine.  Okay, that's weird.

 

I got back to the office and started investigating some more.  My coworker who what worked on the project before I did said, "yeah, sometimes it doesn't communicate.  If the laptop is plugged in it runs fine.  But it doesn't work if it's running on the battery."  Ah, a clue.

 

Basically, our laptop (this was around 1995 and the laptop was already kind of old then) had a 3-prong plug.  My customer's laptop was newer and only used a 2-prong plug.  I found out the ground pin wasn't where it should have been on the DB25 of the device, thus the ground wire wasn't doing it's job.  When our 3-prong laptop was plugged in, it worked fine because the power ground was providing the needed ground reference for the RX and TX pins to work.  Their 2-prong laptop or our laptop running off of battery didn't work because there was no ground reference by way of the power system.  Now that we knew that, I was able to make special cables with the ground wire going to the device's non-standard ground pin and supply them to our customer.

 

So a bad design decision by our vendor, caused us to buy custom cables for years at $40 per as opposed to buying a standard off the shelf cable at $4 per.  Plus the time and effort to investigate the problem and a mark on our reputation when we first supplied a product that wasn't working as it should.

 

 

 

Since yours only works when connected to the docking station, I wonder if it is providing the needed ground path.  But then again it is working in one direction not the other.

 

 

Message 12 of 23
(1,940 Views)

Hello,

 

Thnaks for sharing your story, I fully understand that you were annoyed!

 

To our laptop problem: I have been using it with both a proper serial port and a usb-to-serial adaper and it's the same story ith both.

 

As for the grounding, I am not sure about that. t's really not my area so I just did what seemed to work (it took a couple of tries and cables). It's very possible that I've made a mistake here. The pin schedule provided by the manufacturer looks like this:

 

 

 pinschedule.jpg

 

 

The modification I have done is that I have soldered the + of a 12V DC power supply to pin 4 on the "equipment" end of the cable. The other pins I have just connected according to the schedule (2-3, 3-2 and 5-5). I was not certain what to do with the - of the power supply (ground?) so I soldered that to the unshielded cable in the serial cable (also ground?).

 

But the strange thing, as you said, is that it is working in one direction...

 

Clara

0 Kudos
Message 13 of 23
(1,927 Views)

Connect the negative side of the power supply to the pin5 (ground).  Though the instructions should be a little clearer on this point.  You may want to contact the manufacturer for clarification.

 

There is one thing I don't understand.  They say pin 4 needs a constant high +12V signal.  Are they using that pin to actually power the device?  Pin 4 of a standard DB9 is DTE ready which is a handshaking line to communicate between the two devices that one is ready to receive data.  Looking at a diagram I have, an output from the PC (DTE) which is designed to tell the device (if it was DCE) that the PC is ready to receive data.  Your diagram shows both devices being DTE which makes sense since pins 2 & 3 are crossed.   But if it was a true null modem cable, pin 4 would be crossed with pin 6 data set ready.  (Pins 7 and 8 would be crossed in the null modem cable as well which handles the handshaking for data flowing in the opposite direction.)

 

Before messing with the power supply.  I would try to wire up the cable exactly as it is shown.  Since it seems like it is only using 1 handshaking line, it  might explain why the data is flowing just fine in one direction (it doesn't care) but not in the other (it requires the pin 4 wire as shown to signal it to send or receive data.)  It may work in the docking station with your 12V power supply because the docking station's ground may be providing the ground reference needed for the +12 V power supply to make sense to the device.

Message 14 of 23
(1,918 Views)

Hi,

 

Thanks for the explanation, however I still find it quite complicated.

 

So, a constant high 12 V to the instrument would be the same as the PC sending a constant "ready to recieve" message? I think this seems like a very complicated way of doing that, and not really an obvius solution that yo have connect a power supply to use your power supply...

 

Anyway, I tried doing as you suggested, wiring the - side of the 12V DC to pin 5. Since pin 5 had a double ended arrow in the figure, I wired it to both sides of the of the serial cable (both instrument and PC). Unfortunately it didn't work. I wasn't able to either read or write to the instrument (and I had to force quit LabVIEW but I don't know if that had anything to do with it). Did you mean to wire the - side to only the instrument?

 

How do you mean to wire it "exactly as it is shown"? Do you mean not using the power supply at all? Isn't that like using the crossover cable without modifications?

 

Clara

0 Kudos
Message 15 of 23
(1,891 Views)

The arrow heads just imply a direction of the data flow.  From Tx to RX, for from a DTR to DSR and from RTS to CTS.  Since the ground is a reference, it is a part of data flowing in both directions, thus the double ended arrow.

 

I'm thinking that their wiring diagram doesn't show a 12 VDC supply so you should try making a cable without.  It isn't like using a regular null modem cable.  Their diagram has wires 2 and 3 cross like a null modem cable, but pins 4 tied together directly which is like a straight through cable rather than crossed with 6 like it would be in a null modem cable.

 

If you have a serial breakout box, it would help in trouble shooting the wiring.

 

I think if you aren't able to figure this out in a couple more attempts, you should contact the manufacturer for clarification.  They are doing some here that seems very non-standard.  Perhaps they sell a power supply adapter/cable communication cable that they can guarantee will work.

0 Kudos
Message 16 of 23
(1,883 Views)

Hi again,

 

Yeah, I guess I should have used some sort of open connection solution from the start. However, I now have another problem. After I tried to connect the - side to pin 5 (on both PC and instrument) not even the old cable is working. I am beginning to think that I have damage something. Now the "read" commands do not work even with the PC in the docking station.

 

I have found breakout box of sorts so I will try that once/if I get it to work again. The cable I have been using has the configuration

 

1-7

2-3

3-2

4-6,8

5-5

6,8-4

7-1

9-9

(frame-frame)

 

Is this common or standard null modem?

 

 

I have also tried contacting the company we bought it from, so hopefully I can get som replies there. It's vacation time though...

 

 

Clara

 

0 Kudos
Message 17 of 23
(1,872 Views)
No.  That doesn't look like a standard null modem cable.  See this link.  http://www.loop-back.com/null-mod.html
0 Kudos
Message 18 of 23
(1,862 Views)

Hmm, I kind of had a hunch about this...

 

Weel, now I have connected the wires in my improvised breakout box. I tried this connection, which works:

 

Power supply, DTE     PC, DTE

2                              3

3                              2

4                              +12V DC

5                              5

frame ground            - on the 12V DC power supply

 

 

I tried this, which I would think is the one from the manual. Here write operations work but not read:

 

Power supply, DTE     PC, DTE

2                              3

3                              2

4                              4

5                              5

frame ground            frame ground

 

I also tried these two connections, which doesn't work either:

 

Power supply, DTE     PC, DTE                        12V DC power supply

2                              3

3                              2

4                              no connection                +

5                              no connection                -

frame ground            frame ground

 

Power supply, DTE     PC, DTE                       12V DC power supply

2                              3

3                              2

4                              no connection               +

5                              5                                   -

frame ground            frame ground

 

The last two also causes LabVIEW to get caught in wht seems like a read operation that is not possible to stop. I cannot press the "stop" button and I cannot even force quit the program.

 

 

I seems I can't figure this out on my own. I guess what's left is see what the manufacturer has to say.

 

Thanks for all the help!

 

Clara

 

Message Edited by Clara G on 08-06-2009 09:17 AM
0 Kudos
Message 19 of 23
(1,841 Views)

Do where is the Common or 0V side of the +12VDC power source attached?

 

Is the instrument powered by any other source (120VAC, battery, ....)?

 

I'm wondering if the instrument has no power source, so it is getting its power by way of pins in the DB9 connector that it isn't using for serial communication.

0 Kudos
Message 20 of 23
(1,835 Views)