Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
132 views

Using Basic Script in ADAMView To Open A COMport To Send ASCII Commands

This document provides code to open a COM port and send ASCII commands from ADAMView's Basic Script component. The code creates an MSComm object to open COM port 2 with 9600 baud, no parity, 8 data bits, and 1 stop bit. It then sends the ASCII command stored in a tag, waits for a response, and outputs the response.

Uploaded by

saravanan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views

Using Basic Script in ADAMView To Open A COMport To Send ASCII Commands

This document provides code to open a COM port and send ASCII commands from ADAMView's Basic Script component. The code creates an MSComm object to open COM port 2 with 9600 baud, no parity, 8 data bits, and 1 stop bit. It then sends the ASCII command stored in a tag, waits for a response, and outputs the response.

Uploaded by

saravanan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Product:

ADAMView, ADAM-4000 series, ADAM-5000 series

Abstract:
Using Basic Script in ADAMView to Open a COMport to Send ASCII Commands

Description:
In ADAMView, and In Basic Script component, open COMport and Send ASCII
command.

Solution:
1. Create MSComm object
set MyComm = CreateObject("MSCOMMLib.MSComm")

2. Set COMport Setting


MyComm.CommPort = 2
MyComm.Settings = "9600,N,8,1"
MyComm.InputLen = 0

3. Open COMport
MyComm.PortOpen = True

4. Send ASCII Commands


MyComm.Output = “$01M” + Chr(13)

5. Wait for response


Do
DoEvents
Loop Until MyComm.InBufferCount >= 2

6. Receive response
OUTPUTS 0, MyComm.Input

Page 1
Complete Source Code :

Sub SCR1()
DIM CommandTag AS TAG

set MyComm = CreateObject("MSCOMMLib.MSComm")


SET CommandTag = GETTAG("DISP1", "SCTL1")

MyComm.CommPort = 2
MyComm.Settings = "9600,N,8,1"
MyComm.InputLen = 0
MyComm.PortOpen = True

if MyComm.PortOpen=True then

MyComm.Output = CommandTag.value + Chr(13)

Do
DoEvents
Loop Until MyComm.InBufferCount >= 2

OUTPUTS 0,MyComm.Input
MyComm.PortOpen = False

end if

End Sub

Page 2

You might also like