I'm using MPLAB X IDE v4.20 to compile the following code:
#INCLUDE <P18F4321.INC> CONFIG OSC=INTIO2 ; Select internal oscillator CONFIG WDT=OFF ; Watchdog Timer OFF CONFIG LVP=OFF ; Low Voltage Programming OFF CONFIG BOR=OFF ; Brown Out Reset OFF BSF TRISC,TRISC1; Configure bit 1 of Port C as input BCF TRISC,TRISC0; Configure bit 0 of Port C as output BSF TRISD,TRISD1; Configure bit 1 of Port D as input BCF TRISD,TRISD0; Configure bit 0 of Port D as output BACK RRNCF PORTC,F; Align data in Port C and output to LED RRNCF PORTD,F; Align data in Port D and output to LED BRA BACK END
and I get the following error message for all the lines starting on
BSF TRISC,TRISC1; to
BCF TRISD,TRISD0; and also for the line
"Error C:\ECE\ECE3301LRAFI\LAB4.X\LAB4RAFI.ASM 12 : Executable code and data must be defined in an appropriate section".
So it doesn't compile because of that.
Now, what it intrigues me is that if I compile it in MPLAB IDE v8.50 it does compile without any errors. The reason I was doing it in MPLAB IDE v8.50 is because my professor uses it for the labs, but he uses PICKit 3; however, I have a PICKit4, and MPLAB IDE v8.50 doesn't seem to be compatible with it. So I'm using MPLAB IDE v4.20. I know that it has to do with keywords or something like that, but I don't really understand. Do I need an ORG to compile even if I don't need it for the actual code? Any help will be appreciated. By the way, the experiment is really simple: "to perform a simple I/O experiment by interfacing DIP switches and LEDs to the PIC18F4321 using Microchip’s MPLAB assembler and PICKit3." He said that we can use either PICKit3 or PICKit4.