I have compiled with MPLAB (a free compiler from Microchip) , and programed my pic with icprog.
ORG function - Programs starts at 0x000 in pic's memory
bsf - bit set f
bsf f,b
bit "b" in register f is set.
movlw -move literal to 'w'
movlw k
bit literal "k" is loaded into the 'W' register.
movwf function -move data from "W" reg to "F" register.
bcf -Bit clear f
bcf f,b
bit 'b' from 'f' register is cleared.
Why did I change my place from Bank0 to Bank1 and viceversa? (I am talking about bsf STATUS,RP0 and bcf STATUS,RP0 line code)
Answer: Because TRISA register is located in Bank1 for this microcontroller and PORTA register is located in Bank0 . So , I wrote to reg TRISA , status '0' for output pins :
bit 0 -for output pins : LEDS, LOADSPEAKERS, etc
bit 1 -for input pins: Buttons ,etc
and 1 (movlw 0xff , movwf PORTA) at PORTA to turn on the leds from A pins .
Take a look at Bank0 and Bank1 locations:

No comments:
Post a Comment