LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help wiith Visa Serial connection to Maxtek TM400

Solved!
Go to solution

Hi All,

 

I'm trying to setup a serial connection with a Maxtek TM400 monitor. The problem I am getting: Visa Read returns zero bytes even after introducing a delay in a while loop that checks for read bytes. Some of the other troubleshooting has suggested that this might be because I need to write each character (the control code has 7 characters) separately with a delay. I have no idea how to approach this. Please help!

 

f

0 Kudos
Message 1 of 7
(2,964 Views)
Hi
 
I could not see what was in your HeToString.vi, but I would suggest bypassing it and instead, setup your "Hex Message" text box to display Hex (Right click, select "Hex display"). At least for testing. This will remove a potential error source.
 
Needing a delay between characters in the command is highly unlikely. To do something like that, make an array of the bytes you want to send, connect to a for loop, put the Visa write VI and a delay in the for loop. Wire correctly. I would not bother.
 
First things I would look at:
Are you sure your using the right comport?
Try swapping RX and TX.
Are you using the right address? I would try 0, as the manual says all instruments should reply to that.
Are you certain of your checksum calculation? (It should reply even if this is wrong, but..).
Try putting an indicator, set to Hex display, on the write buffer visa input, to make sure you send what you wish to send.

Would you mind posting the string your sending?
0 Kudos
Message 2 of 7
(2,953 Views)

Thanks for your suggestions, I will try them and see if I can resolve anything. I attached the HextoASCII subvi just incase it helps. I have been addressing the device address as 1 based on the manual commands. Right now I am trying to use the remote start code which is

 

Ch$(255)+Ch$(254)+Ch$(1)+Ch$(0)+Ch$(1)+Ch$(1)+Ch$(253) for which I have been using the hex as FF+FE+1+0+1+1+FD

 

The com port is definitely the right one (the station I am at has only one).

0 Kudos
Message 3 of 7
(2,927 Views)

I tried changing the device address to zero and bypassing heToString.vi and so far still have the same problems. Also, I'm not sure what you mean by swapping RX and TX.

 

Thanks!

0 Kudos
Message 4 of 7
(2,926 Views)
To be more specific I have been writing this exact code: FFFE 0100 0101 FD
0 Kudos
Message 5 of 7
(2,922 Views)
Solution
Accepted by topic author amita
Hi,
 
Swapping Rx Tx.
On your PC(a DTE),  your serial 9 pin Dsub(Male), will have Tx(Transmit) on pin 3 and Rx(Receive)on pin 2. Modems and similar equipment will normally be DCE(Tx on pin 2 and Rx on pin 3, Female Plug). There are cables for connecting DTE to DTE, DCE to DCE, and DTE to DCE. ALOT of serial connection problems are caused by connecting RX to RX and TX to TX, instead of TX to RX.
The manual for the TM400 says that it is DTE, however, it also says that it has Tx on pin2, which would be typical of a DCE.I am assuming that they meant put DCE, and the pinning they list is correct.
By swapping, I means trying both a straight (pin/port 2 in one end is pin/port 2 on the other), and a twisted cable(0-Modem cable, pin/port 2 in one end is pin/port 3 in the other. If I interpret the manual correctly, you should be using a female- femail cable, not twisted (this is bloody unusual, a female -  female cable is normally twisted) Did the cable come with the unit, if so, just use it and don’t think about pinning.
 
When looking in the manual, there is some additional strangeness:
"In this implementation, pin 7 ‘CTS’ means what is says, namely, this is an output
control line, and when the TM-350/400 asserts this control line ‘true’ the host can
transmit to the TM-350/400. On the other hand, pin 8 ‘RTS’ is not quite what it
may seem because this is a signal input to the TM-350/400, and it is intended that
the host should assert this line ‘true’ only when the TM-350/400 is allowed to
transmit data to the host. The TM-350/400 does not generate an RTS ‘request-tosend’
as such for the host PC, so the host should assert pin 8 true whenever the
TM-350/400 is allowed to transmit to the host, without being asked to do so." (ch9.2)
Looks like this instrument needs hardware flow control. I have never used that before, first instrument besides a modemand IC 485 interfaces I have had anything to do with that required it. RTS and CTS can be used in different ways, but as far as I can see the description above fits with what labview will do if you select flow control as RTS/CTS. Try at least. I hope the manufacturer provided a cable, because CTS/RTS has the same Twisted/Not twisted issues as RX TX. (Also means you can’t use the three wire temporary test cables that you often find around an el.lab.)
 
The code your sending looks correct, and as far as I can see the VI you originally posted sends the input string correctly when your HextoString is included. If you know address one is correct for the instrument, probably better to use that then 0 (I noticed the manual does not say an instrument will reply to address 0, just act on it. Prolly a broadcast address). If you use 0, remember to adapt the checksum.
 
Turn on hardware flow control and see what you get.

I hope that is readable and/or useful. Getting a bit late here.
Message 6 of 7
(2,906 Views)

Thanks for your help! The device uses a straight cable, but it turns out that the one I was using was faulty. I switched it out and it functions perfectly.

 

0 Kudos
Message 7 of 7
(2,878 Views)