question on parallax servo controller.. please help me..
for your information,i'm doing the biped robot project, the microcontroller that i use is PIC18f452 from microchip inc and the program is written by assembly language.
my question are:
i) the problems i facing now is when i send the serial data to the PSC, the PSC only execute, the last·set of·instruction. for example, when i·need to·turn the servo A·then follow by servo B, only the servo B will be turn, ·if i need to turn servo A, servo B and follow by servo C, only the servo C will be turn.
ii) should i ignore the header "!SC" when sending the serial data to the PSC, since there is no others devise connected to the TX (serial out)·of PIC18f52 besides the Parallax servo controller.
iii) how can i send the "!SC" to the PSC?? should i change the "!" "S" and "C" to the ASCII code before send? (* the serial transmition of PIC18F452·is byte by byte)
*here i attach part of my program on the serial communication with PSC using PIC18f452. hope all of you can help me kindly share your idea and opinion with me. thank you very much!!!·
my question are:
i) the problems i facing now is when i send the serial data to the PSC, the PSC only execute, the last·set of·instruction. for example, when i·need to·turn the servo A·then follow by servo B, only the servo B will be turn, ·if i need to turn servo A, servo B and follow by servo C, only the servo C will be turn.
ii) should i ignore the header "!SC" when sending the serial data to the PSC, since there is no others devise connected to the TX (serial out)·of PIC18f52 besides the Parallax servo controller.
iii) how can i send the "!SC" to the PSC?? should i change the "!" "S" and "C" to the ASCII code before send? (* the serial transmition of PIC18F452·is byte by byte)
*here i attach part of my program on the serial communication with PSC using PIC18f452. hope all of you can help me kindly share your idea and opinion with me. thank you very much!!!·
![turn.gif](http://forums.parallax.com/images/smilies/turn.gif)
txt
![](/plugins/FileUpload/images/file.png)
2K
Comments
·MOV·W, #129·; SET BAUD RATE
·MOV·SPBRG, W·; BAUD RATE 38.4K
·CLRB·TXSTA.BRGH·; LOW SPEED BAUD RATE
·CLRB·TXSTA.SYNC·; ASYNCHRONOUS
·CLRB·TXSTA.TX9·; 8-BIT TRANSMITION
·SETB·TXSTA.TXEN·; ENABLE TRANSMIT
·SETB·RCSTA.CREN·; ENABLE RECEIVER
·SETB·RCSTA.SPEN·; ENABLE ASYNCHRONOUS SERIAL PORT
;=============================================================================
;···INITIAL POSITION (CENTER)
;=============================================================================
·MOV·W, #15·;·LEFT HIP
·CALL·SERTX
·MOV·W, #8
·CALL·SERTX
·MOV·W, #$20·;·POSITION CENTER(800)***
·CALL·SERTX
·MOV·W, #$03
·CALL·SERTX
·MOV·W, #$0D
·CALL·SERTX
·MOV·W, #14·;·RIGHT HIP
·CALL·SERTX
·MOV·W, #8
·CALL·SERTX
·MOV·W, #$3E·;·POSITION CENTER(830)
·CALL·SERTX
·MOV·W, #$03
·CALL·SERTX
·MOV·W, #$0D
·CALL·SERTX
·MOV·W, #11·;·LEFT KNEE
·CALL·SERTX
·MOV·W, #8
·CALL·SERTX
·MOV·W, #$20·;·POSITION CENTER(800)***
·CALL·SERTX
·MOV·W, #$03
·CALL·SERTX
·MOV·W, #$0D
·CALL·SERTX
·MOV·W, #10·;·RIGHT KNEE
·CALL·SERTX
·MOV·W, #8
·CALL·SERTX
·MOV·W, #$EE·;·POSITION CENTER(750)
·CALL·SERTX
·MOV·W, #$02
·CALL·SERTX
·MOV·W, #$0D
·CALL·SERTX
·MOV·W, #7·;·LEFT ANKLE
·CALL·SERTX
·MOV·W, #8
·CALL·SERTX
·MOV·W, #$E4·;·POSITION CENTER(740)***
·CALL·SERTX
·MOV·W, #$02
·CALL·SERTX
·MOV·W, #$0D
·CALL·SERTX
;==============================================================================
;··SERIAL TRANSMITION
;==============================================================================
SERTX·SB·PIR1.TXIF·; CHECK BUFFER IS EMPTY
·JMP·$-1
·MOV·TXREG, W·; TRANSMIT
·NOP
·RET
; the program above will only execute the instruction to turn the LEFT ANKLE.
It looks like the initial "!SC" is missing, and this must be present at the start of every command.
I attached a java class (open it with notepad) where you can see what must be transmitted
for each command.
Also note that the PSC uses a single line to send and receive, so check out the getReply function
at the bottom. For the pic you must use the two pin interface.
regards peter
is it the problems of the PSC firmware or just the serial comunication problems ??
for your information, i use the bootloader to load the program for my circuit board and it share the same serial transmition port. Will it overwrite the PSC firmware??
I don't think you can overwrite the psc firmware.
The psc must be connected to a serial output of the pic, which of course
must be another one than the·serial connection between your pic and your pc.
The baudrate between pic and psc should be 2400 baud, no parity, 8 databits, 1 stopbit.
regards peter