Migrating to the 18Fx3K22 from the 18f2221 I thought would be easy, after 2 days frustration I found out why I could not set the I/O ports, I eventually did a web search and Voilà found it, may help someone else.
Using
clrf ANSELA
clrf ANSELB
clrf ANSELC
clrf CM1CON0
Did not work in the usual way, after replacing this with the movff instr. it works.
clrf WREG
movff WREG, ANSELA
movff WREG, ANSELB
movff WREG, ANSELC
movff WREG, CM1CON0
Found in the manual. (it helps to read it!)
Note 1: Addresses F38h through F5Fh are
also used by SFRs, but are not
part of the Access RAM. Users
must always use the complete
address or load the proper BSR
value to access these registers.
Max.
Using
clrf ANSELA
clrf ANSELB
clrf ANSELC
clrf CM1CON0
Did not work in the usual way, after replacing this with the movff instr. it works.
clrf WREG
movff WREG, ANSELA
movff WREG, ANSELB
movff WREG, ANSELC
movff WREG, CM1CON0
Found in the manual. (it helps to read it!)
Note 1: Addresses F38h through F5Fh are
also used by SFRs, but are not
part of the Access RAM. Users
must always use the complete
address or load the proper BSR
value to access these registers.
Max.