Simple Robotic Arm

LED Blinking, Walking with Cytron Servo, Displaying RFID, Multi-function Mobile Robot......

Re: Simple Robotic Arm

Postby ianc » Wed Sep 23, 2009 3:15 pm

Did u put the jumper to connect COM of UART and RC7?
ianc
Greenhorn
 
Posts: 2
Joined: Thu Sep 17, 2009 3:22 pm

Re: Simple Robotic Arm

Postby erick » Wed Sep 23, 2009 10:58 pm

i did it. damn i din realize until i stare at the schematic for hours............. :| :| :| :evil: tq tq
erick
Newbie
 
Posts: 14
Joined: Tue Aug 25, 2009 7:26 am

Re: Simple Robotic Arm

Postby ober » Thu Sep 24, 2009 6:30 pm

Hi, good to hear that! Actually if you go through the Details Description Document, you should able to get the jumper under SKXBee.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: Simple Robotic Arm

Postby erick » Wed Sep 30, 2009 8:32 am

i used RB4 and RC6 from PIC16F877A to setup 2nd UART to communicate wif S16A.
i want to setup 2nd UART for PR23. RB3 and RC5 hv being used ody. i tried to used RB3 and RC5 before and it wont work cz when i press button ps2,it will make da left servo to run and wont stop until i press da reset button. when i used RB4 and RC6 but it wont work oso.
for RB4 i put '1' for input and RC6 is '0' for output. but u_tx LED on S16A nt response when i press button on ps2 joystick.

any advice which pin on PIC16F877A can be use to setup 2nd UART?

rgrds,
erick
erick
Newbie
 
Posts: 14
Joined: Tue Aug 25, 2009 7:26 am

Re: Simple Robotic Arm

Postby sich » Tue Oct 06, 2009 6:10 pm

Which pins are assigned as ur primary uart? Then how do u write the software for the 2nd uart? Overall, I'm confused by ur questions.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: Simple Robotic Arm

Postby erick » Tue Oct 06, 2009 10:21 pm

primary uart is for skps/skxbee from schematic given

Image

i tried to make 2nd uart from LVEZ1 cz i dont use LVEZ1(ultrasonic) like below.

Image

and the software like diz,e.g(i refer to scrobot n dredbot) :-

CODE: SELECT_ALL_CODE
//selfdefine UART
#define uart_rx         RB4
#define uart_tx         RA2
#define uart_rx_tris   TRISB4
#define uart_tx_tris   TRISA2

#define servo1          0x41

// Additional UART
//============================================================
void uart_init(void)
{
   //tris
   uart_tx_tris=0;
   uart_rx_tris=1;
   
   //initial value
   uart_tx=1;
   
   //delay
   timer=0;

   delay(5000);
   
}

void uart_send(unsigned char data)
{
   unsigned char i;
   
   uart_tx=0;                     //start bit
   timer=0;
   while(timer<(timer_freq/baudrate));
   
   for(i=1;i>0;i=i<<1)               //data transmission
   {
      if((data&i)==0)uart_tx=0;
      else uart_tx=1;
      timer=0;
      while(timer<(timer_freq/baudrate));      
   }
   
   uart_tx=1;                     //stop bit
   timer=0;
   while(timer<(timer_freq/baudrate));
}

unsigned char uart_receive(void)
{
   unsigned char i,data=0;
   
   while(uart_rx==1);               //wait start bit
   timer=0;
   while(timer<(timer_freq/baudrate));
   
   timer=0;                     //wait half bit to read at the center
   while(timer<(timer_freq/baudrate/2));
   
   for(i=1;i>0;i=i<<1)               //receiving data
   {
      if(uart_rx==1)data=data|i;
      timer=0;
      while(timer<(timer_freq/baudrate));               
   }
   
   return data;
}

//servo control
//======================================================================
void send_cmd(unsigned char num, unsigned int data, unsigned char ramp)      //send 4 bytes of command to control servo's position and speed
{
   unsigned char higher_byte=0, lower_byte=0;
   
   //position value from 0-1463 are greater than a byte
   //so needs two bytes to send
   higher_byte=(data>>6)&0x003f;   //higher byte = 0b00xxxxxx
   lower_byte=data&0x003f;         //lower byte  = 0b00xxxxxx

   
         uart_send(num);                        //First byte is the servo channel 0x41-0x60
         uart_send(higher_byte);                  //second byte is the higher byte of position 0b00xxxxxx
         uart_send(lower_byte);                  //third byte is the lower byte of position 0b00xxxxxx
         uart_send(ramp);                     //fourth byte is the speed value from 0-63

}

.
.
.

TRISA = 0b00000111;   
TRISB = 0b00011111;
.
.
.
.

void skps_cntrl(void)

while(1)
{

 if(skps(p_square)==0)
{
   if (servo1_val==1410)servo1_val-=2;
   else servo1_val=1408;
}
}
   


so,its sumthing like dat. but doesnt work. i need sum clue/hints to do it.

rgrds,
erick
erick
Newbie
 
Posts: 14
Joined: Tue Aug 25, 2009 7:26 am

Re: Simple Robotic Arm

Postby sich » Sat Oct 17, 2009 9:58 pm

The only thing in my mind is u need to troubleshoot and the best way is do it step-by-step. Test each module/communication protocol in ur system and make sure they're working. Don't try to accomplish everything at once. There's no plug and play in electronic design n programming.

1. make sure PS2 communication with uC is okay...
2. make sure 2nd uart is sending the right commands to SC16A. Connect TX, RX & Gnd to UC00A or to PC's serial port through a max232 and check it using Hyperterminal while sending the commands...

Any normal I/O can be used for 2nd uart.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Previous

Return to DIY Project Set

Who is online

Users browsing this forum: No registered users and 17 guests

cron