Shop OBEX P1 Docs P2 Docs Learn Events
Parallax Servo Controller (Serial) problem??? — Parallax Forums

Parallax Servo Controller (Serial) problem???

shark27shark27 Posts: 5
edited 2010-12-19 11:04 in Propeller 1
Hi all!
ı use the parallax servo controller(serial) http://www.parallax.com/Portals/0/Downloads/docs/prod/motors/ServoControllerManualRev%20B%20v2_4.pdfdevice to connect 16 Hi_tech servo motor..
I programmed 2400baud rate no problem. ı can control all servos..
but ı try the servo controller device in 38400baud rate between Pic18f452..
in datasheet tell me if ı want to use in 38400 baud rate first send !SCSBR after 0 or 1(0 for 2400 1 for 38400) and $0d for end.
I use PICC compiler

ı programmed for 2400
printf("!SCSBR");
putc(0) (for 2400 baud)
putc(13)

......
....
printf("!SC");
putc(0); for 0.channel
putc(0); for ramp value=0
putc(0xE2);servo position low
putc(0x03);servo position high
putc(0x0D);break

it is working...
but ı want 38400 baud rate...

ı changed program this

printf("!SCSBR");
putc(1) (for 38400 )
putc(13)

......
....
printf("!SC");
putc(0); for 0.channel
putc(0); for ramp value=0
putc(0xE2);servo position low
putc(0x03);servo position high
putc(0x0D);break

it isnt't working.oscillator is 8MHZ...
thank you for your help!!!

Comments

  • shark27shark27 Posts: 5
    edited 2010-12-19 08:12
    are they anyone to help me ????
  • shark27shark27 Posts: 5
    edited 2010-12-19 10:13
    anyone help??
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-12-19 10:45
    Hi shark27,

    you can get more help if you attach your COMPLETE code to a posting.

    the easiest way to attach your COMPLETE code is to use the archive-function of the propellertool.

    Make your main spin-file th topobjectfile and then click file - archive - project

    This will create a zip-file that contains ALL files that are nescessary for compiling your code
    so everything will be included.

    With the complete code it is much easier to analyse the problem.
    Other ways it is just guessing through the fog.

    one quick guess from me is
    do you use a serial driver written in SPIN or written in PASM?
    SPIN-drivers are only useful for maximum 19200 baud. 38400 is to fast for them

    Did you try to switch the baudrate using a serial terminal program running on a PC?

    best regards

    Stefan
  • Mike GreenMike Green Posts: 23,101
    edited 2010-12-19 11:01
    We can't help you with the PIC programming. Remember that the "!SCSBR",1,13 has to be sent at 2400 Baud. Once that's received by the servo controller, it switches to 38400 Baud. Any further communications has to be at 38400 Baud.

    You didn't show anything in your program that changes the PIC's Baud. Do keep in mind that the PIC, depending on how the serial timing is done, may not handle 38400 Baud accurately. That may be part of the problem.
  • shark27shark27 Posts: 5
    edited 2010-12-19 11:01
    firstoful thank you for your reply tomorrow ı will attach my code here...
  • shark27shark27 Posts: 5
    edited 2010-12-19 11:04
    Mike ı know "!SCSBR",1,13 has to be sent in 2400.but after this command ı think switch to 38400.tomorrow ı will put my codes here if you will look make me happy
    Best regards
Sign In or Register to comment.