If you use the 16F84A for this project the software needs to be updated for bank switching to access the OPTION, TRISA and TRISB registers. The OPTION and TRIS commands compile with a warning in MPIDE but do not execute when burned in the 16F84A microcontroller.
If you use the 16F84A for this project the software needs to be updated for bank switching to access the OPTION, TRISA and TRISB registers. The OPTION and TRIS commands compile with a warning in MPIDE but do not execute when burned in the 16F84A microcontroller.
I wasn't aware that the 16F84A had problems with the OPTION and TRIS commands, although MicroChip have been advising against their use for years - but I can't say I've ever actually 'used' one.
All you need to do is load W with the value you want, and then write it to the register, like this:
Code:
BANKSEL OPTION_REG
movlw 0x12 ;whatever value you need!
movwf OPTION_REG
And the same for TRIS:
Code:
BANKSEL TRISA
movlw 0xF0
movwf TRISA
Don't forget to switch back to bank 0 after setting TRIS and OPTION_REG, as they are both in the same bank you can do them together with only one BANKSEL line.
Don't forget to switch back to bank 0 after setting TRIS and OPTION_REG, as they are both in the same bank you can do them together with only one BANKSEL line.
Don't forget to switch back to bank 0 after setting TRIS and OPTION_REG, as they are both in the same bank you can do them together with only one BANKSEL line.