rado
Member level 2
- Joined
- Feb 15, 2014
- Messages
- 42
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 8
- Activity points
- 293
void main() {
int i,j,k;
TRISB =0;
TRISD =0;
TRISC =0;
PORTC =0;
if(PORTC.F5==1) goto check
else portc.f5 =1;
for(i=5;i>=0;i--)
{
PORTB =i;
for(j=9;j>0;j--)
{
PORTD =j;
delay_ms(80);
}
PORTD =0;
delay_ms(80);
}
PORTD.F6 =1;
check: PWM1_Init(1000);
PWM1_start();
PWM1_Set_Duty(125);
if (PORTB.F0==0)
{ repeat:PORTB.F4 = 1; //Run motor in clockwise
}
delay_ms(170);
PORTB.F4 = 0;
TRISB.F6 = 1;
if(PORTB.F6==1)
{
PORTB.F5 = 1; //Run motor in anti-clockwise
delay_ms(170);
PORTB.F5 = 0;
delay_ms(500);
goto repeat;
}
else PORTD.F7=1;
if(PORTD.F7 =1)
{PORTD.F6 = 0;
}
portc.f5 =0;
}
void main() {
TRISB= 0;
PORTB = 0xFF;
}
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 void main() { TRISB = 0x00; PORTB = 0x00; while(1) { PORTB = ~PORTB; Delay_ms(1000); } }
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?