Parallax Serial Controller and SX/B
Rob v.d. berg
Posts: 89
Hello,
I want to control the Parallax Servo Controller (#28023) with·the SX28 in basic.
With a BS2, it is like this, to send·the baudrate command:
SEROUT PIN, baudrate, "!SCSBR", 1, CR
to change from 2400 to 38400 baud.
Does someone has experience with this ?
The SX/B send only bytes one byte at a time. Like this
SEROUT PIN_PSC, TO38400, "!"
SEROUT PIN_PSC, TO38400, "S"
SEROUT PIN_PSC, TO38400, "C"
SEROUT PIN_PSC, TO38400, "S"
SEROUT PIN_PSC, TO38400, "B"
SEROUT PIN_PSC, TO38400, "R"
SEROUT PIN_PSC, TO38400, 1
SEROUT PIN_PSC, TO38400,·CR
SEROUT PIN_PSC, TO38400, low_byte
SEROUT PIN_PSC, TO38400,·CR
SEROUT PIN_PSC, TO38400, hi_byte
SEROUT PIN_PSC, TO38400, CR
or do I mis somethink ?
thanks in advance
Rob
·
I want to control the Parallax Servo Controller (#28023) with·the SX28 in basic.
With a BS2, it is like this, to send·the baudrate command:
SEROUT PIN, baudrate, "!SCSBR", 1, CR
to change from 2400 to 38400 baud.
Does someone has experience with this ?
The SX/B send only bytes one byte at a time. Like this
SEROUT PIN_PSC, TO38400, "!"
SEROUT PIN_PSC, TO38400, "S"
SEROUT PIN_PSC, TO38400, "C"
SEROUT PIN_PSC, TO38400, "S"
SEROUT PIN_PSC, TO38400, "B"
SEROUT PIN_PSC, TO38400, "R"
SEROUT PIN_PSC, TO38400, 1
SEROUT PIN_PSC, TO38400,·CR
SEROUT PIN_PSC, TO38400, low_byte
SEROUT PIN_PSC, TO38400,·CR
SEROUT PIN_PSC, TO38400, hi_byte
SEROUT PIN_PSC, TO38400, CR
or do I mis somethink ?
thanks in advance
Rob
·
Comments
Note that "high level" things like SEROUT should be embedded in subroutines so they just get compiled (expanded to assembly instructions) once, otherwise you will burn through your code space pretty quickly.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Thanks for the sample,· i'ts very helpfull.· I must think in an other way
Regards Rob.··
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I have "played' with your code and add some·to set a position for controlling the Parallax Servo Controller. It is working well, but when I add a interrupt (2usec) with the OPTION command, it is complete dead.· The interrupt i can see, with the Testpin output. I know that the timing for the SEROUT command is possible corrupt.
but there is nothing happen in de main loop.
2e question: what is the best way to disable the interrups for a moment ? (SEROUT)
can someone give me·an idea ?,
Regards Rob.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I·know Pulsin is simple en works.·I have tested a simple loop with pulsin and pulsout with the same·puls variable. When the·input puls was not change the servo·gives a restless movement. Probably the·10usec (resolution) step is too·big.
Rob
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax