Problem with Propeller Servo Controller USB
LarryPotter
Posts: 8
I purchased a Propeller Servo Controller USB·to control Parallax's Motor Mount and Wheel Kit with Position Controller.· I am using the [size=-1]Flashlite 386Ex[/size]·by JK Microsystems for the controller.· I am using the C programming language.· I have not been successful in sending commands to the Propeller Servo Controller.· I am using a serial connection.· The servo controller does work fine when I send commands with the Basic Stamp, so I know that the problem is not with the hardware.··I wrote to Parallax and asked if they had·any C programming examples for writing to this controller, and they directed me to this·forum.· Incidentally,·this is a robot project, and I am using [size=-1]eRTOS[/size]·to allow multitasking.·
Post Edited By Moderator (Bean) : 6/10/2010 3:12:56 PM GMT
Post Edited By Moderator (Bean) : 6/10/2010 3:12:56 PM GMT
Comments
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
Also, I believe the BS2 talks to it with "RS232-TTL" signals -- and yes, they may be inverted from what the Flashlite is trying.
As for C code... that's dependent on your hardware and OS. You might want to contact Flashlite and/or eRTOS support?
Post Edited (Mike G) : 6/10/2010 8:48:30 PM GMT
Post Edited (Mike G) : 6/10/2010 10:17:25 PM GMT
So, again, thanks loads guys for the feedback. I will let you know on the forum of any success.
/**************************************************/
/*·················· << Position Command >>··································*/
/*····················································································· */
/*··················· Written by L. Wendell···································· */
/*··············································································· ····· */
/**************************************************/
#include <rtos.h>
#include <sio.h>
#include <stdio.h>
#include <driver.h>
#include <string.h>
#include <stdlib.h>
//void SendCommand(char [noparse]/noparse);··· //Send command function
void SerXmit(BYTE [noparse]/noparse);········· //Serial xmit function
void Com1Init(void);··········· //Serial port initiate func
void MotorTest(void);·········· //Test Motors using PSCU
/**************** Main Thread ************************/
void main(void)
{
·kdebug = 1;
·rt_init( 200 );
·Com1Init();·· //Initiate camera com port (Com 1 386EX)
·rt_sleep(1000);
·rt_newthread(MotorTest, 1, 2048, 0, "MotorTest");
·do{
··rt_sleep(1000);
·}while(1);
}//End of maiin thread
/************** Com1Init function *********************/
void Com1Init(void){····· //ititiate 386Ex Com 1 for camera
·sio_init(1,0x3F8,4,512,512,NULL,0);···· //These are RTOS functions...
·sio_setup(1,2400,8,0,1,0);
}· //End of cam_sio function
/**************** SerXmit function ********************/
void SerXmit(BYTE string[noparse]/noparse){····· //Sends a string to camera.
·int i = 0;
·do{
··sio_writebyte(1,string[noparse][[/noparse]i]);
··//printf("Sent: %i, %c, \n", string[noparse][[/noparse]i], string[noparse][[/noparse]i]);
··printf("Sent: %i \n", string[noparse][[/noparse]i]);
··i++;
··if (string[noparse][[/noparse]i] == NULL) break;
·}while(1);
} //End of SerXmit function
/************** MotorTest Thread ********************/
void MotorTest(){················· //Pos values of sonar_rot = CW rotation
unsigned int ch = 1, ra = 7, pw; //, lonyb, hinyb;
BYTE buffer[noparse][[/noparse]9], lonyb, hinyb;
·do{
··rt_yield();
··pw = 1100;
··lonyb = pw & 255;
··hinyb =(pw & 65280 ) >> 8;
··printf ("%i, %i \n", lonyb, hinyb);
··buffer[noparse][[/noparse]0] = 33;··· //"!"
··buffer[noparse][[/noparse]1] = 83;··· //"S"
··buffer[noparse][[/noparse]2] = 67;··· //"C"
··buffer[noparse][[/noparse]3] = ch;··· //"Channel "0"
··buffer[noparse][[/noparse]4] = ra;··· //rate "7"
··buffer[noparse][[/noparse]5] = lonyb; //Low Byte pulse width
··buffer[noparse][[/noparse]6] = hinyb; //High Byte pulse width
··buffer[noparse][[/noparse]7] = 13;··· //"\r"
··buffer[noparse][[/noparse]8] = NULL;
··SerXmit(buffer);
··rt_sleep(1500);
··pw = 400;
··lonyb = pw & 255;
··hinyb =(pw & 65280 ) >> 8;
····· printf ("%i, %i \n", lonyb, hinyb);
··buffer[noparse][[/noparse]0] = 33;··· //"!"
··buffer[noparse][[/noparse]1] = 83;··· //"S"
··buffer[noparse][[/noparse]2] = 67;··· //"C"
··buffer[noparse][[/noparse]3] = ch;··· //"Channel "0"
··buffer[noparse][[/noparse]4] = ra;··· //rate "7"
··buffer[noparse][[/noparse]5] = lonyb; //Low Byte pulse width
··buffer[noparse][[/noparse]6] = hinyb; //High Byte pulse width
··buffer[noparse][[/noparse]7] = 13;··· //"\r"
····· buffer[noparse][[/noparse]8] = NULL;
··SerXmit(buffer);
··rt_sleep(1500);
·}while(1);
} //End of MotorTest thread
·