Hello, I was reading that you can query the SSC-32 to get the positions of the servos, but I was unsure how to get these postions into the basic atom through the serial commands. Does anyone have some sample code that maybe I could look at?
First of all, you need two-way communication between the Bot Board and SSC-32. This requires using another I/O pin and connecting it to the TX pin of the SSC-32 - this will be the Bot Board’s serial RX (receive) line from the SSC-32. You need a three wire cable between the Bot Board and the SSC-32 for this to work - RX, TX, GND.
Wiring:
Bot Board SSC-32
RX (any I/O pin) TX
TX (any I/O pin) RX
GND GND
I like to pick two adjacent I/O pins like P7 (RX) and P8 (TX) on the Bot Board.
8-Dale
ah okay, that’s helpful
now how do I go about programming the Atom to read the information from the SSC-32?
Use the serin command on the pin you have connected to the SSC-32’s TX pin to read data back from the controller.
8-Dale
alright, i’ve got the Rx and Tx connected to P0 and P1, but when I run my program, it never gets past the serin command
(You’ve probably realized that this is my first time coding an Atom)
here’s basically the code I’m using just to get a query (my file is on a different computer)
theInput var byte
main:
gosub moveServos 'this moves the servos to a position
serout P0,i38400,"Q",13]
serin P1,i38400,[theInput]
debug[theInput,13]
goto main
could the problem be with my code? If you need I can transfer the file to this computer and post the whole program.
You should first try the command on the Lynxterm or any other Terminal program and talk directly to the SSC-32 over the DB9 rs232 port. My guess on your problem is probably the timing. Are you adding pause statements between your serout commands that you are probably using to move the servos to their position?
Also, I would stick the
loopyloop
serout P0,i38400,"Q",13]
serin P1,i38400,[theInput]
debug[theInput,13]
gosub loopyloop
in a loop so that you would be getting a constant output. Try setting your “theInput” variable with a known ASCII, such as:
theInput = “*”
So you know that when you receive a “+” or a “.” character back from the SSC-32 through the P1 pin, it was written by the SSC-32.[/code]
Have you tried n38400 yet? If you are conencting directly to the TTL I/Os on the SSC-32 then I don’t think you want inverted serial, you want non-inverted. I don’t have an SSC-32 so I may be wrong but it shouldn’t hurt to try n38400.
thanks tom and Acid, I’ll try these out and let you know how it goes
This works… 8)
[code]theInput var word
serout P8,i38400,"#8 P1000",13]
pause 1000
start:
serout P8,i38400,"#8 P2000 T5000",13]
holdon:
serout P8,i38400,“Q”,13]
serin P9,i38400,[theInput]
if theInput = “+” then holdon
serout P8,i38400,"#8 P1000 T1000",13]
pause 1000
goto start
[/code]
It was written for the Atom IDE 2.2.1.1. Hope this helps!
awesome
just need some help. so the code (after establishing the three wires) looks like this? (i’m using BasicMicron software)
[code]Bot Board SSC-32
RX p8 TX
TX p7 RX
GND GND
theInput var word
serout P8,i38400,"#8 P1000",13]
pause 1000
start:
serout P8,i38400,"#8 P2000 T5000",13]
holdon:
serout P8,i38400,“Q”,13]
serin P9,i38400,[theInput]
if theInput = “+” then holdon
serout P8,i38400,"#8 P1000 T1000",13]
pause 1000
goto start
[/code]
when i compile it comes up with errors… help i know i’m doing something stupid!
bane
Which editor and Atom are you using?
BasicMicro IDE (the software that comes you buy lynxmotion.com/Product.aspx?productID=270&CategoryID=84 and i’m using the ATOM BASIC 24pin
Sorry that is no help to me. To tell me the IDE you are using you must click Help, About, to see the version. I do not know what is on the CD from basic micro.
Basic Micro ATOM IDE 02.2.1.1
Copyright © 2002 Basic Micro
You mean this ^
I have the cd right here, but doesn’t have anything describtive on it.
Is there anyway to post a image as an attachment here?
(i could take a screen shot)
Ok, you are using the correct IDE.
Not sure why you are using P7 for the xmit, as the code is using P8.
What errors are you getting?
it doesn’t like the RX p8 TX
TX p7 RX
GND GND
part of it when i compile. And pin 7 and 8 are my TX and RX, is that right?
Those are just notes not commands right? they need ; in front of them to make the comments… Like this:
;RX p8 TX
;TX p7 RX
;GND GND
The program I wrote used pin 8 to send data and pin 9 to receive data.
Oh that makes sense , i was wondering why on pervous post they didn’t include that.
So i connect my Rx Tx to 8 and 9 and it should give me all my servo positions or do i have to tell it which port?