peterzatko
New Member
I am beginner.
Please I need help with microprocesor - LED´s (ON/OFF).
What is wrong in my code.
I need :
When is on PORTC.0 - Ground then RB1 (LED2 ON)
When is on PORTC.0 - Power supply (5V) then RB1 (LED1 ON)
When PORTC.0 not equal 0 or 1 (is in third estate) then RB1 (LED3 ON)
- PORTC is and must be as digital input.
Code:
digital:
If PORTC = 0 then
PORTB.0 = 0
PORTB.1 = 1
PORTB.2 = 0
delay_ms(2)
goto digital
end If
IF PORTC.0 = 1 then
PORTB.0 = 1
PORTB.1 = 0
PORTB.2 = 0
delay_ms(2)
goto digital
end If
If (PORTC <> 1) or (PORTC <> 0) then
PORTB.0 = 0
PORTB.1 = 0
PORTB.2 = 1
end If
delay_ms(2)
goto digital
Please I need help with microprocesor - LED´s (ON/OFF).
What is wrong in my code.
I need :
When is on PORTC.0 - Ground then RB1 (LED2 ON)
When is on PORTC.0 - Power supply (5V) then RB1 (LED1 ON)
When PORTC.0 not equal 0 or 1 (is in third estate) then RB1 (LED3 ON)
- PORTC is and must be as digital input.
Code:
digital:
If PORTC = 0 then
PORTB.0 = 0
PORTB.1 = 1
PORTB.2 = 0
delay_ms(2)
goto digital
end If
IF PORTC.0 = 1 then
PORTB.0 = 1
PORTB.1 = 0
PORTB.2 = 0
delay_ms(2)
goto digital
end If
If (PORTC <> 1) or (PORTC <> 0) then
PORTB.0 = 0
PORTB.1 = 0
PORTB.2 = 1
end If
delay_ms(2)
goto digital