|
|
View previous topic :: View next topic |
Author |
Message |
Terk Guest
|
PIC18F458 control ServoController(serial) board of parallax |
Posted: Wed Aug 09, 2006 9:39 pm |
|
|
How to using PIC to control ServoController(serial) board of parallax. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Aug 11, 2006 12:28 pm |
|
|
I can't find any board on the Parallax website called a "ServoController". |
|
|
weetax
Joined: 12 Aug 2006 Posts: 3
|
|
|
weetax
Joined: 12 Aug 2006 Posts: 3
|
PIC18F458 control ServoController(serial) board of parallax |
Posted: Sat Aug 12, 2006 9:17 pm |
|
|
It's using serial communication (Open collector).
I'm useing PIC18F458.But parallax board can't response.If i'm using BasicStamp it can be worked. This is my source.
Quote: | #include <18f458.h>
#define TxD PIN_C6
#define RxD PIN_C7
#fuses H4
#fuses NOLVP, NOWDT
#fuses NOPROTECT
#use delay (clock=40000000)
#use rs232(baud=9600,xmit=TxD,rcv=RxD,stream=pc)
#use rs232(baud=2400,parity=N,xmit=PIN_D0,rcv=PIN_D1,bits=8,stream=psoc,float_high,ERRORS)
#ignore_warnings 202
void INT_Serial(void);
#INT_RDA
void INT_Serial(void){
char c,x,y,z;
long lo,hi,ch,ra;
long data;
c = getc();
switch(c){
case 'a' : fprintf(pc,"pos:1100\n");
data = 1100;
lo = data%255;
hi = data/255;
ch = 0;
ra = 0;
fputc('!',psoc);
fputc('S',psoc);
fputc('C',psoc);
fputc(ch,psoc);
fputc(ra,psoc);
fputc(lo,psoc);
fputc(hi,psoc);
fputc(13,psoc);
break;
case 'b' : fprintf(pc,"pos:500\n");
data = 500;
lo = data%255;
hi = data/255;
ch = 0;
ra = 0;
fputc('!',psoc);
fputc('S',psoc);
fputc('C',psoc);
fputc(ch,psoc);
fputc(ra,psoc);
fputc(lo,psoc);
fputc(hi,psoc);
fputc(13,psoc);
break;
}
}
void main(void){
enable_interrupts(GLOBAL);
enable_interrupts(INT_RDA);
while(1){
}
} | [/quote] |
|
|
weetax
Joined: 12 Aug 2006 Posts: 3
|
Success. |
Posted: Sat Aug 12, 2006 9:39 pm |
|
|
OK, I'm can be solve my problem.By change the option of rs232.
Quote: | #use rs232(baud=2400,xmit=PIN_D0,rcv=PIN_D0,stream=psoc,float_high,ERRORS) |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|