Servo controller - BS2 says, 'No one's out there'
Wildatheart
Posts: 195
After spending a very successful morning experimenting with the RF transmitter/receiver (GREAT products), I set out to tackle the "easier" servo experiments this afternoon.· The servo·did respond·with a direct connect to the BS2 using the PULSOUT command, however·the result contained an·unacceptable amount of "hunting"·as the servo saught it's resting position.··Then I·installed·the Parallax Servo Controller.· And now...·many hours later, I'm happy to report that·the servo is no longer "hunting"· - likely because the BS2 is·now·"hunting" for the contoller.·
·
Tried the following code straight from the lit:
'{$PBASIC 2.5}
Sdat PIN 15 ' Serial Data I/O pin
Baud CON 396 ' Constant for 2400 baud
buff VAR Byte(3) ' temporary variable
FindPSC: ' Find and get the version
DEBUG "Finding PSC", CR ' number of the PSC.
SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SCVER?",CR]
SERIN Sdat, Baud, 500, FindPSC, [noparse][[/noparse]STR buff\3]
DEBUG "PSC ver: ", buff(0), buff(1), buff(2), CR
STOP
DEBUG says, "Finding PSC" over and over, but never finds it
Ver A of the board is·detailed in the data sheets, however I have a ver B board.· seems there's an extra set of pins with a jumper (maybe more)... but then i tried it with and without - still "hunting".
I've read some other posts re the PSC and communication with this board seems to have frustrated others as well.·
Any thoughts on the subject?· (Yes the red lt is on and the grn light is flashing, so I'm guessing the board isn't DOA)
·
Tried the following code straight from the lit:
'{$PBASIC 2.5}
Sdat PIN 15 ' Serial Data I/O pin
Baud CON 396 ' Constant for 2400 baud
buff VAR Byte(3) ' temporary variable
FindPSC: ' Find and get the version
DEBUG "Finding PSC", CR ' number of the PSC.
SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SCVER?",CR]
SERIN Sdat, Baud, 500, FindPSC, [noparse][[/noparse]STR buff\3]
DEBUG "PSC ver: ", buff(0), buff(1), buff(2), CR
STOP
DEBUG says, "Finding PSC" over and over, but never finds it
Ver A of the board is·detailed in the data sheets, however I have a ver B board.· seems there's an extra set of pins with a jumper (maybe more)... but then i tried it with and without - still "hunting".
I've read some other posts re the PSC and communication with this board seems to have frustrated others as well.·
Any thoughts on the subject?· (Yes the red lt is on and the grn light is flashing, so I'm guessing the board isn't DOA)
Comments
http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/PSC/List/0/SortField/4/ProductID/376/Default.aspx
Obvious checks:
Leave jumper off for Chan 0-15
Make sure 3 pin connector (from the BS2)·is in the top left socket (next to the cap) with the black wire up.
Switch is on
Looks like you code is OK.
Jim
Just hooked up my Rev B PSC to Development board with a BS2 chip. I can poll for the Ver # (1.3). Findings:
I doesn't matter·if the jumper is installed or not·on the polling program.
It doesn't matter if the switch is on or off (it's the switch for the servo power)
The only other thig I can think off, are you using a standard BS2 or BS2P or BS2PX? If it's not a·BS2, you will have to change the baudmode to a value that matches your chip. The tables are in the Stamp Manual under SERIN and SEROUT commands.
I assume you are using a BS2 from the description of your problem, But the chip directive statment does not show up in the code you posted, (should be·the first line in your code).
Jim
And those are for 8 bit, no-parity, true.
Also make sure that there is a ground connection between you PSC·(servo is already grounded to it)·and the Stamp Vss.
········· BS2, BS2E, BS2PE·······································BS2SX, BS2P································BS2PX
Baud··CON 396· ' Constant for 2400 baud····· ··········Baud··CON·1021······················ Baud··CON 1646
Baud· CON 188· ' Constant for 4800 baud····· ··········Baud··CON·500······················ ·Baud··CON·813·
Baud CON 84··· ' Constant for 9600 baud······· ······ ··Baud··CON·240························Baud··CON 396
Baud· CON 32··· ' Constant for 19K2 baud·········· · ···Baud··CON·110························Baud·CON 188·
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 397
' {$STAMP BS1} 'This indicates to use a BASIC Stamp 1 module
' {$STAMP BS2} 'This indicates to use a BASIC Stamp 2 module
' {$STAMP BS2e} 'This indicates to use a BASIC Stamp 2e module
' {$STAMP BS2sx} 'This indicates to use a BASIC Stamp 2sx module
' {$STAMP BS2p} 'This indicates to use a BASIC Stamp 2p module
' {$STAMP BS2pe} 'This indicates to use a BASIC Stamp 2pe module
' {$STAMP BS2px} 'This indicates to use a BASIC Stamp 2px module·
Page 32 • BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com
'{$STAMP BS2}
' {$PBASIC 2.5}
Sdat PIN 15 ' Serial Data I/O pin
Baud CON 396 ' Constant for 2400 baud
buff VAR Byte(3) ' temporary variable
FindPSC: ' Find and get the version
DEBUG "Finding PSC", CR ' number of the PSC.
SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SCVER?",CR]
SERIN Sdat, Baud, 500, FindPSC, [noparse][[/noparse]STR buff\3]
DEBUG "PSC ver: ", buff(0), buff(1), buff(2), CR
STOP
·
Post Edited (Cyrill) : 7/9/2009 7:12:55 PM GMT
A little confusing. Are you posting code that poses a problem or fixes the original poster's problem. I'm thinking the latter.
Jim
Had to figure out:
that you always have to ground your servo's to the controller .
That you need the correct Baud rate.
and that the derective musn't be forgotten.
Just like the solutions you gave· .posted them· so its easyer to see·for all with the same problem.
Have a nice day
Cyrill