Jump to content

Sending Byte Array to com port


Ghost21
 Share

Recommended Posts

I'm trying to send this to a com port.

im $command[13]

$command[0] = 0xBE

$command[1] = 0xEF

$command[2] = 0x10

$command[3] = 0x05

$command[4] = 0x00

$command[5] = 0xC6

$command[6] = 0xff

$command[7] = 0x11

$command[8] = 0x11

$command[9] = 0x01

$command[10] = 0x00

$command[11] = 0x01

$command[12] = 0x0D

$i = -1

Do

$i = $i + 1

_CommSendByte($command[$i], 0)

Until $command[$i] = 0x0D

Would putting it in a long array and sending that at one go be any Faster ? The COM port is at 19200 if that makes any difference. If so whats the best way to go about this.

I have tried _CommSendByteArray() but with no success ... More then likely its something I'm not doing..

Link to comment
Share on other sites

Yeah it runs pretty damn fast.

This thread should either be in support in this thread for the UDF.

Sending a byte array will be faster. You need to create a dllstruct for the array and pass the address for it.

If you have any questions about sending byte arrays using my udf then best to continue this in the udf thread. I won't be replying for a couple of days though, but there might be some examples for sending byte arrays in that thread. I remember someone was using them to communicate with a satellite dish.

@ Michel

The byte functions will send 0x00 but the string functions will not of course.

Edited by martin
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

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...