MichaelaJoy
Active Member
Ok. Here's my PIC24F32kA304 Assembler skeleton. (And I do mean skeleton)
I have no idea how this works as the CPU isn't here yet.
But it does compile successfully in MPLAB-X.
If I did this correctly, I've got some of the config registers programmed and the first Interrupt vector set up.
If anybody wants to tinker with this in MPLAB-X, just set up a new project with XC16 C as the tool.
Then, create a file called "whatever".s (The extension has to be ".s" or it'll fail.
Then, transplant this code in the Assembler file and build it.
It's not going to run; I'm still learning how to create an ISR for the main timer, and I have to cascade Timer #1 with timer #2
(more config stuff)
Please let me know what you guys think. I'm experimenting with removing the C runtime alltogether.
There's a line that are commented out. The 'goto __reset' might be a spillover from the C compiler. If I remove the semicolon,
it seems to change the order of the segments.
I have no idea how this works as the CPU isn't here yet.
But it does compile successfully in MPLAB-X.
If I did this correctly, I've got some of the config registers programmed and the first Interrupt vector set up.
If anybody wants to tinker with this in MPLAB-X, just set up a new project with XC16 C as the tool.
Then, create a file called "whatever".s (The extension has to be ".s" or it'll fail.
Then, transplant this code in the Assembler file and build it.
It's not going to run; I'm still learning how to create an ISR for the main timer, and I have to cascade Timer #1 with timer #2
(more config stuff)
Code:
include "p24F32KA304.inc"
.section __FWDT.sec, code
.global __FWDT
__FWDT: .pword FWDTEN_OFF
.section __FDS.sec, code
.global __FDS
__FDS: .pword DSWDTEN_OFF
.section __FICD.sec, code
.global __FICD
__FICD: .pword ICS_PGx1
.section __FOSCSEL.sec, code
.global __FOSCSEL
__FOSCSEL: .pword FNOSC_PRI & OSCIOFNC_ON & LPRCSEL_HP & IESO_OFF & POSCFREQ_HS
.section __FOSC.sec, code
.global __FOSC
__FOSC: .pword FNOSC_PRI & OSCIOFNC_ON & LPRCSEL_HP & IESO_OFF & POSCFREQ_HS
.section ivt, code
; goto __reset
.pword paddr(KeyScanISR)
.global KeyScanISR
.text
KeyScanISR:
bra KeyScanISR
.global __reset
.text
__reset:
bra __reset
.end
Please let me know what you guys think. I'm experimenting with removing the C runtime alltogether.
There's a line that are commented out. The 'goto __reset' might be a spillover from the C compiler. If I remove the semicolon,
it seems to change the order of the segments.
Last edited: