LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using LabVIEW to execute serial commands similar to Teraterm

Highlighted

Hello,

 

I have a Teraterm macro file.  The contents of the macro file is as below..

 

;; Tera Term Macro
;; ============================================================================

sendln 'ATZ'
pause 1

sendln 'AT+NJM=0'
pause 1

sendln 'AT+TCONF=868000000:14:125:7:4/8:1:1'
pause 1

sendln 'AT+TCONF=868000000:14:125:7:4/8:1:1'
pause 1

sendln 'AT+DCS=0'
pause 1

ping_index = 0
do
ping_index = ping_index+1
sendln 'AT+TPING'
mpause 750

loop while ping_index < 10000000000

 

My question is Can I open serial port in LabVIEW and write these commands to the serial port, instead of running this Teraterm macro file.

From the macro, I understand that I have to write ATZ to serial port and then wait for 1 second. Instead of pause, I use Wait in LabVIEW.

The program pings Com port, is what I understand

Will it work out in LabVIEW. Please let me know.

Thank you..

 

 

0 Kudos
Message 1 of 6
(518 Views)
Highlighted

Yes, it will work. Take care of appending the correct termination character - probably a Carriage Return = 0x0D - to each string you send.

Of course, you should also provide a way to terminate the sequence before that all the 10 billion "pings" are sent.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
Message 2 of 6
(498 Views)
Highlighted

Hi Hema,

 


@Hemagopal wrote:

I have a Teraterm macro file.  The contents of the macro file is as below..

My question is Can I open serial port in LabVIEW and write these commands to the serial port, instead of running this Teraterm macro file.

From the macro, I understand that I have to write ATZ to serial port and then wait for 1 second. Instead of pause, I use Wait in LabVIEW.


Yes, you can use LabVIEW.

Read the help for TeraTerm (I didn't…) to be sure on these things:

  • "sendln" might append an EOL char (like LF or CR or LFCR)
  • "AT" might denote a special char (like "@")
  • the unit of the pause might be s or ms…
Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 3 of 6
(488 Views)
Highlighted

@GerdW  ha scritto:

Yes, you can use LabVIEW.

Read the help for TeraTerm (I didn't…) to be sure on these things:

  • "sendln" might append an EOL char (like LF or CR or LFCR)
  • "AT" might denote a special char (like "@")
  • the unit of the pause might be s or ms…

Hi GerdW,

AT is the standard prefix for commands to control a modem, so it will not translate to a special character. The standard EOL for those commands is CR so we may be very confident that this character will work.

Although I didn't read TeraTerm's help too, it seems reasonable (and the OP seems to know this already) that pause is in seconds and mpause in milliseconds.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
Message 4 of 6
(343 Views)
Highlighted

Hello, 

I am able to send the  commands which are there in the teraterm macro file by using VISA serial write. When I do VISA serial Read, i get output in the Read buffer output. 

But this output is not consistent. Most of the time, I get blank output and sometimes I get output.

Why is this. Does it have to do with the byte count wired to Read input?

I have used the invoke node "read byte count at port" and wired this to Read Input.

That is not helping.

Why I is the blank output coming most times.

 

Thank you

Hema

0 Kudos
Message 5 of 6
(244 Views)
Highlighted

"Read byte count at port" is not useful for you. Probably, your code is not waiting enough time.

Are you using the VISA Configure Serial port? You should define the CR character as the termination character and a resonable value for the timeout. Then do a single VISA Read wiring in a large number of characters (more than you expect). The Read will be terminated as soon as the CR character is received.

Please upload your vi for more precise advices.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 6 of 6
(236 Views)