loading

how to turn led on and off in asm

in asm how do i turn this led on and off i inted ti build a 5x7 led dot matrix but first need help with the programming in asm to turn and led on and off rest i will work on from there if anyone can help the pic below is the shematic

Picture of how to turn led on and off in asm
purduecer8 years ago
First things first, make sure that your port pin (port b, in this case) is enabled as an output. To do this, add the following lines to the beginning of your code (after the 'org' statement:
bsf status,rp0 ; Switch to memory bank 1 (where tris registers are contained)movlw 0x00movwf trisbmovwf trisabcf status,rp0 ; Switch to memory bank 0 (where other registers are contained)

Once you have that established, the LED can be activated by either using
bsf portb,0bcf porta,0
or
bsf porta,0bcf portb,0
Depending on the polarity of your led.