- #1
lightgreen
- 14
- 0
Homework Statement
I'm learning PIC recently. Below is the coding that i have prepared and the attachment is the connection that I used. My question is, why the 2 LEDs will on immediately once i trigger the PIC? This is because the result is not something that should be coming out. What's wrong with my connection or my coding?
Below is the coding part:
define osc 8
TRISA.0 = 1
TRISA.1 = 1
TRISD.0 = 0
TRISD.1 = 0
L1 var portd.0
L2 var portd.1
s1 var porta.0
s2 var porta.1
Main
portd = 0
if s1 = 0 then
L1 = 1
else
L1 = 0
endif
if s2 = 0 then
L2 = 1
else
L2 = 0
endif
pause 500
goto Main
end