Discussion forum for the BasicX family of microcontroller chips.
|
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?? > >Yahoo! Groups Sponsor >ADVERTISEMENT ><http://rd.yahoo.com/M=244522.3313099.4604523.1261774/D=egroupweb/S=1706554205:HM/A=1595055/R=0/SIG=1240u9le2/*http://ashnin.com/clk/muryutaitakenattogyo?YH=3313099&yhad=1595055>f8e59e9.jpg >f8e5ab2.jpg > >>Yahoo! Terms of Service. ---------- [Non-text portions of this message have been removed] |