Hello,
I recently purchased a copy of Microchip's Pickit 2 programmer, with a low pin count demo board to play around with. The board comes with a PIC16F690 chip, 4 LEDs, a pushbutton, and a pot. I'm using Microchip's MPLAB development environment.
The Demo Board comes with several tutorials. The first one is called, "Hello World." It involves using Assembly language to light up a single LED, attached to one of the IO pins.
The Four LEDs are connected to pins RC0-RC3.
Here's the code that turns on LED RC0:
#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've done this, and it seems to work just fine.
My question is, how would I go about turning on 2 or more LEDs? The intuitive way seems to be to use the following code:
Start:
bsf STATUS,RP0 ; select Register Page 1
bcf TRISC,0 ; make IO Pin C0 an output
bcf TRISC,1 ; should this make pin C1 an output?
bcf STATUS,RP0 ; back to Register Page 0
bsf PORTC,0 ; turn on LED C0 (DS1)
bsf PORTC,1 ; shouldn't this turn on LED C1?
goto $ ; wait here
end
I've tried this, and many other combinations, but no luck. Any thoughts?
I recently purchased a copy of Microchip's Pickit 2 programmer, with a low pin count demo board to play around with. The board comes with a PIC16F690 chip, 4 LEDs, a pushbutton, and a pot. I'm using Microchip's MPLAB development environment.
The Demo Board comes with several tutorials. The first one is called, "Hello World." It involves using Assembly language to light up a single LED, attached to one of the IO pins.
The Four LEDs are connected to pins RC0-RC3.
Here's the code that turns on LED RC0:
#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've done this, and it seems to work just fine.
My question is, how would I go about turning on 2 or more LEDs? The intuitive way seems to be to use the following code:
Start:
bsf STATUS,RP0 ; select Register Page 1
bcf TRISC,0 ; make IO Pin C0 an output
bcf TRISC,1 ; should this make pin C1 an output?
bcf STATUS,RP0 ; back to Register Page 0
bsf PORTC,0 ; turn on LED C0 (DS1)
bsf PORTC,1 ; shouldn't this turn on LED C1?
goto $ ; wait here
end
I've tried this, and many other combinations, but no luck. Any thoughts?