Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

RS-232 DTE emulation over USB

Hi,

I have had problems communicating with a photometer which emulates RS232-DTE over USB. It can be used in 2 modes one of which is remote mode. To switch to "REMOTE MODE" I have to type the word "PHOTO" oh hyperterminal (HYPT) which immediately displays "REMODE MODE" on HYPT. Now I can issue ASCII commands like M1, D1.....to measure the light and send back data to the screen. All this works fine in HYPT.

I have the following problems when I try to use labview

1. I have been trying to change to "REMOTE MODE" from LabView but just cannot do it.

2. One the photometer is in REMOTE MODE (which is done on HYPT) I close the HYPT and open labview. When I run the VI I (write: M\r\n) I get an output (0000,1,1.2e+02,0.2254,0.3365\r\n) something like this which is right) and the VISA closes session w/o any errors. But when I run the VI (write: M\r\n) again the ASCII command is not sent (becasue the photometer screen blinks when it receives the command) and I get an error at VISA read (timeout). When I run the VI again I get timeouts at W and R visas. I suspect that after the VI runs successfully for the first time, the com port communication is lost or something to that effect. At this stage I turnoff-on the photomter, open a HYPT, switch to remote mode , open labview and execute successfully once and we  have the same problem again.

Please find attached my VI. I have been messing with this for over 2 weeks .Please help !!!

Thanks,
Jimmy

0 Kudos
Message 1 of 7
(4,592 Views)

Try from the examples the 

 Advanced Serial Write and Read.vi (what you already used for your exampleSmiley Wink )

I made some modifications (continuously read port and latch the write buffer button)

use no flow control for the first test

If your serial settings are right you should see right responses

Maybe your pitfall was the termination character to send (\r\n)

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 7
(4,578 Views)
Hi Henrik,

Greetings from USA.

I tried your modified version , the results are the same. When I try the command "PHOTO" , screen does not change on the photometer. Write visa says it writes 5 bytes but does not read anything as it should (REMOTE MODE). How do we makle sure there is a COM port open for communication?? I ran the VI (M\r-Measure command) after I used the hyperterminal to switch to remote mode and it still only works the first time. The second time loop executes I get read timeout and the third time i get the write time out.

regards,
Jimmy

0 Kudos
Message 3 of 7
(4,575 Views)
Try running the VI that was previously posted but change the 16 to a 48 on the VISA Set I/O Buffer Size. By default VISA calls the serial port flush command after each write to help with performance and force the OS to write out the data. However, some serial devices/drivers don't take the time to implement the flush command correctly and this causes them to get into a bad state. By setting the transmit buffer size to anything, VISA will no longer automatically call flush and it will now assume that you will call flush if you need to. In many cases this will allow these serial emulator devices to work.

Hope this helps out.

-Josh
0 Kudos
Message 4 of 7
(4,562 Views)
Hello Josh,

Thanks for your reply. Changing the mask to 48 did not work either.

I should have mentioned this earlier, but I dont know why I missed this.
As per the manual of the photometer the ASCII command for measuring is M1[cr][lf] not M[cr][lf]. But M1[cr][lf] does not work at ALL in LabView. When it works for the first time and only time it is only M[cr][lf]. Similarly C[cr][lf] to clear errors works , so does D[cr][lf] works for the first time.

I dont know if those single character commands has something to do with command PHOTO not being able to switch to remote mode using lab view

Regards,
Jimmy

0 Kudos
Message 5 of 7
(4,561 Views)
Have you tried using any kind of port monitoring utility to see where the differences exist between the hyperterminal communication and LabVIEW communication?  There must be something we're missing.  You might check http://www.sysinternals.com/ for their utility portmon.exe.  Let us know if there's anything  you find when running that application.
 
Logan S.
0 Kudos
Message 6 of 7
(4,530 Views)
Jimmy,
 
when it can be done with hyperterm it can be done with LabVIEW ...
 
What type of flow control do they use? 
 
I posted my serial testing vi here
 
try it with the hardware control (RTS/CTS or DTR/DSR)  and 'no flow control' and toggle the DTR and RTS line status by hand.
(in the runtime  menu use Port-Init or Offline  and enable View-Write-'/-code'  ,
 
 
 
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 7 of 7
(4,519 Views)