



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Before programming the Flash area, the code must be compiled in ICC12 with changes to the pseudo-vector address locations of the interrupts. The current serial Boot Loader program that will be used in the programming the Flash memory corrupts the D-BUG12. Therefore, after you have demonstrated your code to the Lab Instructor the D-BUG12 Monitor program must be restored in the Flash in order to return the board to its factory condition. The example given in this Tutorial is based upon Timer 6 Interrupts. One should consider the code lines as a template only that needs to be revised for any other problem.
Steps to Program the Flash:
extern void TC6_ISR(); // Å to be added before the array
#pragma abs_address:0xEF
void (*interrupt_vectors[])(void) = {
/* to cast a constant, say 0xb600, use (void ()())0xb / DUMMY_ENTRY, /Reserved $FF80/ DUMMY_ENTRY, /Reserved $FF82/ DUMMY_ENTRY, /Reserved $FF84/ DUMMY_ENTRY, /Reserved $FF86/ DUMMY_ENTRY, /Reserved $FF88/ DUMMY_ENTRY, /Reserved $FF8A/ DUMMY_ENTRY, /PWM Emergency Shutdown/ DUMMY_ENTRY, /Port P Interrupt/ DUMMY_ENTRY, /MSCAN 4 Transmit/ DUMMY_ENTRY, /MSCAN 4 Receive/ DUMMY_ENTRY, /MSCAN 4 Error/ DUMMY_ENTRY, /MSCAN 4 Wake-up/ DUMMY_ENTRY, /MSCAN 3 Transmit/ DUMMY_ENTRY, /MSCAN 3 Receive/ DUMMY_ENTRY, /MSCAN 3 Error/ DUMMY_ENTRY, /MSCAN 3 Wake-up/ DUMMY_ENTRY, /MSCAN 2 Transmit/ DUMMY_ENTRY, /MSCAN 2 Receive/ DUMMY_ENTRY, /MSCAN 2 Error/ DUMMY_ENTRY, /MSCAN 2 Wake-up/ DUMMY_ENTRY, /MSCAN 1 Transmit/ DUMMY_ENTRY, /MSCAN 1 Receive/ DUMMY_ENTRY, /MSCAN 1 Error/ DUMMY_ENTRY, /MSCAN 1 Wake-up/ DUMMY_ENTRY, /MSCAN 0 Transmit/ DUMMY_ENTRY, /MSCAN 0 Receive/ DUMMY_ENTRY, /MSCAN 0 Error/ DUMMY_ENTRY, /MSCAN 0 Wake-up/
DUMMY_ENTRY, /Unimplement Intruction Trap/ DUMMY_ENTRY, /COP failure reset/ DUMMY_ENTRY, /Clock monitor fail reset/ _start, /Reset/ }; #pragma end_abs_address
TC6_ISR is declared in the code as:
Void TC6_ISR (void) { //now clear the Timer 6 interrupt TFLG1 = 0x40; } By using the vector_dp256.c file one doesn’t need to declare the interrupt vector array in the code, which is the case while running the code in the RAM.
Programming of the Flash: First, make sure that your MC9S12DP256 board is disconnected from any external hardware (i.e., your breadboard).
a. Erase Flash b. Program Flash c. Set Baud Rate d. Erase EEPROM