Jump to content

Serial communication


Recommended Posts

Hi all,

I have written a script for serial communication which uses MSCOMM functionality......it is working fine for COM port. Now my question is does it also work for USB port?

awaiting your response.

Neotrio.

Link to comment
Share on other sites

Hi all,

I have written a script for serial communication which uses MSCOMM functionality......it is working fine for COM port. Now my question is does it also work for USB port?

awaiting your response.

Neotrio.

It should work for a serial to usb converter which looks to windows like a com port, but it won't work for talking to devices over usb. With a serial to USB you are actually communicating with the driver for the device which imitates a com port, and the driver handles the usb communications.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Hi all,

I have written a script for serial communication which uses MSCOMM functionality......it is working fine for COM port. Now my question is does it also work for USB port?

awaiting your response.

Neotrio.

I use NETComm for Serial Port communication which works with both USB and Bluetooth devices. This is a snippet of code which works with a GPS Bluetooth device

CODE
;Error Processing for COM Port

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

;COM Port Error Message

Func MyErrFunc()

MsgBox(0, " GPS/Map Viewer", "COM Port Error : " & $oMyError.description)

PLExit()

EndFunc ;==>MyErrFunc

;Create NETComm.ocx object

$NetComm = ObjCreate("NETCommOCX.NETComm")

;Process message

$message = " Establishing GPS Communications."

DisplayMessage()

;Set object settings

With $NetComm

.CommPort = $port ;Set port number

.Settings = $settings ;Set port settings

.InputLen = 0 ;reads entire buffer

.InputMode = 0 ;reads in text mode

.HandShaking = 3 ;uses both RTS and Xon/Xoff handshaking

.PortOpen = "True" ;opens specified COM port

EndWith

Ant..

Link to comment
Share on other sites

I use NETComm for Serial Port communication which works with both USB and Bluetooth devices. This is a snippet of code which works with a GPS Bluetooth device

CODE
;Error Processing for COM Port

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

;COM Port Error Message

Func MyErrFunc()

MsgBox(0, " GPS/Map Viewer", "COM Port Error : " & $oMyError.description)

PLExit()

EndFunc ;==>MyErrFunc

;Create NETComm.ocx object

$NetComm = ObjCreate("NETCommOCX.NETComm")

;Process message

$message = " Establishing GPS Communications."

DisplayMessage()

;Set object settings

With $NetComm

.CommPort = $port ;Set port number

.Settings = $settings ;Set port settings

.InputLen = 0 ;reads entire buffer

.InputMode = 0 ;reads in text mode

.HandShaking = 3 ;uses both RTS and Xon/Xoff handshaking

.PortOpen = "True" ;opens specified COM port

EndWith

Ant..

Thanks! actually I had some conceptual clots that's why I was not sure.Now I think my code will also work...........

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...