Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <18F4520.h>
- #use delay (clock = 20000000)
- #fuses HS, NOWDT, NOLVP
- int *ADCON1 = 0xFC1, *TRISB = 0xF93, *TRISC = 0xF94;
- int *PORTB = 0xF81, *PORTC = 0xF82;
- MAIN(){
- int X;
- *ADCON1 = 0xFC;
- *TRISB = 0x01;
- *TRISC = 0x00;
- *PORTC = 0x01;
- while(1){
- if( *PORTB & 0x01){
- if( x == 255)
- x = 100;
- else
- x = 255;
- }
- while( *PORTC < 0x80){
- *PORTC = *PORTC<<1;
- delay_ms(x);
- }
- while( *PORTC > 0x01){
- *PORTC = *PORTC>>1;
- delay_ms(x);
- }
- }
- }
Add Comment
Please, Sign In to add comment