pic - W Register in Assembly Not defined? - Microchip pic16f84a -
pic - W Register in Assembly Not defined? - Microchip pic16f84a -
i using instruction:
dec count movf count,w bsf portb,w i getting next error: symbol not defined (w) in w ment of course of study register w.
the problematic instruction
bsf portb, w bsf takes bit number, not register - interestingly enough, when switching capital w goes through assembler, generates other code intended. utilize like
bsf portb, 2 ; set bit number 2 (0b00000100) instead. if need calculate bit number, have manually, e.g. through rotate instruction, this:
... movlw 0b00000001 ; bit 0 movwf count loop: movfw count ; count => w movwf portb ; count => portb (8 bits!) bcf status, c ; clear carry rlf count, f ; shift left count btfss status, c ; 8 bits rotated? goto loop ; no, go on ... assembly pic
Comments
Post a Comment