SFR Banked and Aceess issues for Newbie to PIC18f
My first post, appolgies in advance if my question is not in the right sub-forum.
I have been programming PIC16F883 for quite some years, and have a fairly good understanding of
programming this the PIC16 range.
But I have now had to upgrade to a PIC18f27K42 for various reasons [ more storage RAM ]
I am now in the process of re-writing my assembler code for the PIC18f series.
The problem I am coming against is the the Banking and Access bank aspect of SFRs
Previoulsy I have used BANKSEL for my PIC16f code, but having read and re-read the
PIC18f data sheet, I have seen that the PIC18f has an ACCESS bank to make life easier, or so I thought.
My understanding is that some SFRs such as ADRESH or T2PR are mapped into the ACCESS bank,
and that I will not need to set a BANKSEL or MOVLB command for instructions involving these registers.
When using MPLABx IDE V5.1, I seem to be getting inconsistant results with instructions involving
registers that are mapped to the ACCESS bank.
I have two subroutines that write to ADPCH and PWM6DCH SFRs which are both in the ACCESS bank.
When I run my code in the Simulator, the first routine does not update ADPCH, but does
But both SRFs are in the ACCESS bank, so I am not sure where I am going wrong.
Is the MPLABX Assembler not good to trust for chosing Banked or Access ?
Should I add lots of BANKSEL/MOVLB to my code instead ?
Appologies for not formatting this to Code, but I cant seem to find how to do that.
MOVLW b'00001000' ; Select input ANBO TEMPO
MOVWF PWM6DCH ; set MSB duty cycle
MOVWF PWM6DCL ; set LSB duty cycle
Thanks for any light on this.