hello,
I am trying to read data from sci by handling RDRF interrupt. i had some trouble with it and then i found sample source codes from Internet. also i tried the sample project which is in code-warrior examples.
1) Codewarrior provides an example project for mc9s12c32. it uses vector table in isr_vectors.c
typedef void (*near tIsrFunc)(void);
const tIsrFunc _vect[] @0xFF80 = {
.....
}
i tried same way in my project but i couldn't handle any sci interrupts.
2) i checked code-warrior help. it gives two way to use interrupts.
define
VECTOR ADDRESS 0x8A INCcount
or
VECTOR 69 INCcount
in prm file then use
interrupt void INCcount() ..
or
#pragma TRAP_PROC
void INCCount() ..
or directly use
interrupt 69 void INCcount(void) ...
when i try defining vectors in prm file, something strange is happening. when i send a byte to mcu i get back '0xE0 0xF2 0x3E' messages in endless loop.
3) i have found a source code from my school. they are using it on the same module i have.
i checked the code and they are handling IRQ interrupt not SCI. IRQ is vector 6 and SCI is vector 20. i didn't have time to ask about this. i read all data-sheets again and again but no answer.
also there is a weird thing about their code. they use vector table for interrupt definitions. what that code do is transmitting the received byte back by appending it to a message "you send a byte ...".
for the first byte i send, mcu handles interrupt but always sends back 'a', smiley face and '>'.
sometimes after i send a new byte, it sends back previous byte.
also i edited that code a bit. i am turning led1 on and off each almost each second. until i send a byte to mcu led blinks very well. but after the first byte i send blinking stops and never starts again.
and i am changing the state of led2 in interrupt function. it must be turn off after nth interrupt and turn on n+1th interrupt. but what happens is in turns off and on (very fast blinking) in one interrupt.
i hope I'm missing a simple point.
waiting for all ideas and working source codes if possible.
have a nice day