Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program linefollower
- ' Declarations section
- symbol imput1 =portb.2
- symbol imput2 =porta.2
- symbol imput3 =portc.6
- symbol imput4 =portd.5
- symbol imput5 =portd.6
- symbol push1 =portd.3
- symbol push2 =portd.2
- symbol led1 =lata.0
- symbol led2 =lata.1
- dim line_follow as byte
- sub procedure init_MCU()
- adcon0 = %00000000 ' apagamos los canales analogicos
- adcon1 = %00000000
- 'configuracion de pines correspondientes al line follower'
- portb.2 = 1
- porta.2 = 1
- portc.6 = 1
- portd.5 = 1
- portd.6 = 1
- 'Configuracion pic cliker led y pulsadores'
- trisd.3 =1
- trisd.2 =1
- trisa.0 =0
- trisa.1 =0
- 'limpiamos los registros lat y port para evitar datos residuales'
- lata = 0
- latd = 0
- latc = 0
- latb = 0
- porta =0
- portd =0
- portc =0
- portb =0
- end sub
- sub procedure lec_follow_click()
- line_follow.0 = imput5
- line_follow.1 = imput4
- line_follow.2 = imput3
- line_follow.3 = imput2
- line_follow.4 = imput1
- line_follow.5 = 0
- line_follow.6 = 0
- line_follow.7 = 0
- 'si ninguno = 255'
- end sub
- main:
- init_MCU()
- ' Main program
- while true
- lec_follow_click()
- select case line_follow
- case 31
- led1=1
- led2=1
- case 1
- led2= not led2
- delay_ms(200)
- case 3
- led2= not led2
- delay_ms(100)
- case 6
- led2= not led2
- led1 = not led1
- delay_ms(100)
- case 12
- led2= not led2
- led1 = not led1
- delay_ms(100)
- case 24
- led1 = not led1
- delay_ms(100)
- case 16
- led1 = not led1
- delay_ms(200)
- end select
- wend
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement