I'm just starting out using the pick2 starter kit. Lesson 1 is "Turn on an led"
This is the code to turn led DS1 on:
I can turn any single led on by changing TRIC,0 and PORTC,0.
I want to turn two or more leds on. I thought it would be as simple as this:
However, the only led that will turn on is the last one in the code. (in this case DS2) I've tried with 0,1,2,3. It is allways the last one in the code that lights.
What is the right way to turn on two leds?
This is the code to turn led DS1 on:
Rich (BB code):
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
bcf TRISC,0 ; make IO Pin C0 an output
bcf STATUS,RP0 ; back to Register Page 0
bsf PORTC,0 ; turn on LED C0 (DS1)
goto $ ; wait here
end
I want to turn two or more leds on. I thought it would be as simple as this:
Rich (BB code):
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
bcf TRISC,0 ; make IO Pin C0 an output
bcf TRISC,1 ; make IO Pin C1 an output
bcf STATUS,RP0 ; back to Register Page 0
bsf PORTC,0 ; turn on LED C0 (DS1)
bsf PORTC,1 ; turn on LED C1 (DS2)
goto $ ; wait here
end
What is the right way to turn on two leds?