Com3 Help

Started by mikeytoo2003 June 26, 2003
I would like to use COM3 as an outbound serial port. I'm comfortable
defining and opening the port but I'm stumped on how to send data to
the port. I've started with the following:

> DefineCom3(0,5, bx0000_1000)
> OpenCom(3, 9600, InQ, OutQ)

What size to I need to define for the queues? I assume the
following defines a queue of 10 bytes:

> Dim Out(1 to 10) As Byte

I can open the queue:

> OpenQueue(OutQ, 10)

But now what? If I wanted to send 1 byte, say x21 out the Com3
port, how would I go about it? What if I wanted to send 10 bytes?
Does anyone have a basic example os using Com3??



> I can open the queue:
> OpenQueue(OutQ, 10)
> But now what?

First you open the queue.
But you also have to do DefineCom3 and OpenCom.
Then, you can do PutQueue or PutQueueStr.
Think of the queue as being like the buffer of
a buffered serial port (ie 16550 UART). It's a
fifo buffer. Anything you put into it gets sent
to the serial port. But the DefineCom3 command
sets up the port, and OpenCom associates that
port with queues. An example:

Private HostRecvBuf(1 to 85) As Byte
Private HostSendBuf(1 to 85) As Byte

Call DefineCom3(5, 6, bx0000_1000)
Call OpenCom(3, 4800, DeviceRecvBuf, DeviceSendBuf)

' Sending a string
Call PutQueueStr(HostSendBuf, "Sending to PC")

' Sending a byte
Call PutQueue(HostSendBuf, GpsData, 1)

The last parameter is the number of bytes to send.

-- Doug If I wanted to send 1 byte, say x21 out the Com3
>port, how would I go about it? What if I wanted to send 10 bytes?
>Does anyone have a basic example os using Com3?? >
>
><http://ashnin.com/clk/muryutaitakenattogyo?YH313099&yhad95055>f8e59e9.jpg" target="_blank" rel="nofollow">http://rd.yahoo.com/M$4522.3313099.4604523.1261774/D=egroupweb/S06554205:HM/A95055/R=0/SIG40u9le2/*http://ashnin.com/clk/muryutaitakenattogyo?YH313099&yhad95055>f8e59e9.jpg
>f8e5ab2.jpg
>
>">http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.

----------