Re: Trying to learn Assembly
Quote:
The problem must be with moving the config data to the port.
Code:
MOVLW B'00011110' ;Set RA<4:1> H
BANKSEL LATA
MOVWF LATA
Re: Trying to learn Assembly
You did a BANKSEL TRISA and configured that register, then you loaded W and tried to shove it into PORTA register without resetting the Bank Select Register. TRISA is in BANK 1 while PORTA is in BANK 0. Without selecting BANK 0 with "BANKSEL PORTA" you simply wrote over your TRISA; TRISA & PORTA share the same Register address, though in different Banks.
BANKSEL PORTA
MOVLW B'00011110
MOVWF PORTA
Re: Trying to learn Assembly
Got to thinking after posting, I gave you an answer, but didn't share any knowledge.
In the Data Sheet there is a section called 3.0 Memory Organization. On page 23, Table 3.3 shows where SFR are stored; both Bank# and Address#. You should be able to look at that Table and see PORTA located in BANK 0 at address 000Ch. Next row in BANK 1 you see TRISA at address 008Ch, but the same position within the BANK. Next you can see TRISA in the same position in BANK 2.
Using BANKSEL is a shortcut that allows the Compiler to find the proper BANK for you. In the Instruction Summary, Section 24, Table 24-3 lists the Assembly Instructions applicable to this PIC. Towards the bottom under the heading Literal Operations is the command MOVLB. If you know TRISA is in BANK 1 you can:
MOVLB 0x01
Page 272 shows the expanded explanation of MOVLB.
I hope this helps you better understand how the Banking system works (at least in the PIC family).