Problem with SCC communication

Started by Nathaniel Barshay January 13, 2007
I'm trying to get an Pololu Micro SCC (using the Mini SCC II equivalent
communication protocol) to communicate with the Basic X. The com requires
non-inverted 8 bit packets with no parity and one stop bit. There are 3
packets to a message, Byte 1 is the start byte (FF), Byte 2 is the servo
to change (00-FE), and byte three is the servo position (00 - FE). My code,
from what I can glean from the indicator LED's, gets a com error every time
it tries to set a position. My code is as follows:
---------------
Private Data(1 to 3) as Byte
Private OQ(1 to 6) as Byte
Private IQ(1 to 2) as Byte

Sub PutServo(ByVal Position as Byte) 'Communicates with the
SCC to controll the servo

Call OpenQueue(OQ, 6)
Call OpenQueue(IQ, 2)
Call ClearQueue(OQ) 'Clears the output queue
Call ClearQueue(IQ) 'Clears the input queue

Call DefineCom3(0,9, bx0000_1000) 'Open and Configure the Com
Port, contains pin assignment
Call OpenCom(3, 9600, IQ, OQ)

Data(1) = &HFF
Data(2) = &H08
Data(3) = Position
Call PutQueue(OQ, data, 3)

Call Delay (.02) 'Waits for the data to be
sent
Call CloseCom(3, IQ, OQ) 'Close the Com Port

End Sub
---------------------
I'm not particularly experienced with serial communication in general so my
mistake could be anything from and overall failure to recognize a hole in
the protocol to a small coding error,
Thanks for any help you can give me,
Nathaniel
> Private OQ(1 to 6) as Byte
> Private IQ(1 to 2) as Byte

You are very close. Add nine bytes to each queue length; that's the
overhead required to process the queue. OQ should be 15 bytes for a
6-byte buffer, for example.
Tom
Thanks, good to know,
That doesn't seem to have fixed it yet, I suspect it's something more
fundamental,
Nathaniel

On 1/13/07, Tom Becker wrote:
> > Private OQ(1 to 6) as Byte
> > Private IQ(1 to 2) as Byte
>
> You are very close. Add nine bytes to each queue length; that's the
> overhead required to process the queue. OQ should be 15 bytes for a
> 6-byte buffer, for example.
>
> Tom
>
>
>