Sujith Nair

MSP430 to HCS12 > 2 Days and still no working interrupt for a SIMPLE program :-(

Discussion created by Sujith Nair on Aug 23, 2006
Latest reply on Aug 24, 2006 by Sujith Nair

I am studying in Alaska and have only experience with MSP430 and this time decided to use HCS12 (MC9S12DT256) for desire of more POWER. I got the LED to flash and stuff but having spend two days, I still couldn't get a simple program i.e. the SCI0 to work properly. All I want is to go into the interrupt service routine when a character is received.

I tried the solution mentioned by " rhinoceroshead" in another thread Not sure if I am doing it right though.

Below is my code. Please look at it as its very simple.


#include /* common defines and macros */
#include /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dt256b" //The compiler put this here automatically!!

unsigned char TCHAR; //Received character placeholder

void main(void) {

COPCTL = 0; //Disabling Watchdog

SCI0CR1 = 0;
SCI0CR2_RE = 1; //SCI0 Receiver Enable
SCI0CR2_TE = 1; //SCI0 Transmitter Enable
SCI0CR2_RIE = 1; //SCI0 Receiver full interrupt enable

SCI0BD = 26; //For a 4MHz CLK, setting the Baud to 9600kbps

EnableInterrupts; //Enabling global interrupts

while(1){} //Just something so that the compiler does not exit the program

#pragma TRAP_PROC //my unsuccessful attempt at getting the program to jump here when a
void TEST() { //character is received


I am using the USB Multilink from P&E and CodeWarrior 4.5.

As mentioned by "rhinoceroshead" in another thread, when I put "VECTOR 20 TEST" or "VECTOR ADDRESS 0xFFD6 TEST" at the end of the P&E_Multilink_CyclonePro_Linker.prm file, I get the error message "Initializing of vector TEST failed because of over- or underflow of vector value". Am I putting it in the wrong place?

Don't know what I am doing wrong. Another issue is when I was sending characters from within the function main itself, I am getting garbage on hyperterminal. Really can't figure it out. The Baud is set correctly, 8 bit, no parity and 1 stop bit. It is not a issue with rewriting the TX Registers before shifting out because I was manually stepping the instructions one line at a time.

Thank you very much for taking the time in helping.