void main(void)
{
unsigned int i,a;
TRISB = 0b00000011;
PORTB = 0b00000000;
while(1)
{
RB7=1;
for(i=0;i<50;i++)
{
RB5=1;
DelayUs(157);
RB5=0;
DelayMs(6);
DelayUs(250);
DelayUs(250);
DelayUs(9);
}
for(i=0;i<50;i++)
{
RB4=1;
DelayUs(250);
DelayUs(250);
DelayUs(86);
RB4=0;
DelayMs(6);
DelayUs(80);
}
This program is running with MPLab. My project is to construct a robot arm, this program works fine but when external force applied (due to the weight of my arm) then the servos will not capable to resist the forces when servos not powered then it will just "fell" off.Hence, I want to know how to send a continuous pulse to instruct the servo stay in position.
Concurrent program ? But how ?
THE MAIN POINT IS BOTH RB5 & RB4 CAN RUN TOGETHER
Thank you.
{
unsigned int i,a;
TRISB = 0b00000011;
PORTB = 0b00000000;
while(1)
{
RB7=1;
for(i=0;i<50;i++)
{
RB5=1;
DelayUs(157);
RB5=0;
DelayMs(6);
DelayUs(250);
DelayUs(250);
DelayUs(9);
}
for(i=0;i<50;i++)
{
RB4=1;
DelayUs(250);
DelayUs(250);
DelayUs(86);
RB4=0;
DelayMs(6);
DelayUs(80);
}
This program is running with MPLab. My project is to construct a robot arm, this program works fine but when external force applied (due to the weight of my arm) then the servos will not capable to resist the forces when servos not powered then it will just "fell" off.Hence, I want to know how to send a continuous pulse to instruct the servo stay in position.
Concurrent program ? But how ?
THE MAIN POINT IS BOTH RB5 & RB4 CAN RUN TOGETHER
Thank you.