Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //lecon younes_pic:
- // set direction of RBO to output OxFE = 11111110 all other pins (RB1 - RB7) are input pins
- int i = 0 ;
- unsigned i =1;
- void main() {
- TRISB = 0x00; // Set RB0 to high 00000001
- PORTB = 1;
- //while(1)
- // {
- for(i=0;i<3;++i)
- {
- //TRISB = 0x00; // Set RB0 to high 00000001
- // PORTB = 1;
- do // To set infinite loop
- {
- Delay_ms(300); // 350 mili seconds delay
- PORTB = PORTB<<1; //Shifting right by one bit
- if(PORTB >= 127 ) //0b10000000) //To reset to 00000001 when the count becomes 10000000
- {
- Delay_ms(300); // 350 mili seconds delay
- PORTB = 1;
- break;
- }
- }while(1);
- PORTB = 0;
- PORTB = 128;
- do // To set infinite loop
- {
- Delay_ms(300); // 350 mili seconds delay
- PORTB = PORTB>>1; //Shifting right by one bit
- if(PORTB == 1 ) //0b10000000) //To reset to 00000001 when the count becomes 10000000
- {
- Delay_ms(300); // 350 mili seconds delay
- PORTB = 0;
- break;
- }
- }while(1);
- // To set infinite loop
- } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement