Reply by "smith.jeff28" November 22, 20082008-11-22
Did you download the sample code on the evbplus site for the dragon12?

It has samples of a complete serial port driver.

Reply by jmey...@emittechnologies.com November 18, 20082008-11-18
Sorry....OutChar too

// checks for transmit flag
// handles one char at a time
void SCI1_OutChar(char data) {

while((SCI1SR1 & TDRE) == 0){};
SCI1DRL = data;
}

Reply by jmey...@emittechnologies.com November 18, 20082008-11-18
CR2 is only set for transmit enable, receiver enable, and receiver interrupt enable.

Here is my OutString:

// takes null terminated string
// transmits one char at a time using SCI1_OutChar
void SCI1_OutString(char *pt) {

while(*pt) {

SCI1_OutChar(*pt);
pt++;

}
}

CW may be optimizing something out, because this just isn't making much sense. It's really too bad because I don't really have time to learn how to read the optimized code.

I appreciate everyone's input, but I think I'm just going to accomplish my goal using polling.

Reply by "Rao, Lakshman " November 18, 20082008-11-18
May be your SCI1_OutString function is configured interrupt based
transmission. Just check whether you are reconfiguring the SCIxCR2
register to enable TX interrupts and forgot to reset it back to

Receiver Interrupt Enable to allow further incoming bytes reception.

With regards,

Lakshman

________________________________

From: 6... [mailto:6...] On Behalf
Of j...@emittechnologies.com
Sent: Saturday, November 15, 2008 4:29 AM
To: 6...
Subject: [68HC12] SCI Rx Interrupt Only Works Once On S12DP256

I'm working on a Dragon12-P board from evbplus.com containing the
mc9s12dp256 and using CW 5.9.0 for a compiler. I'm a beginner, too. :)

I've got a C program that collects data from about 10 inputs, concats
the data into a single string, and transmits the data upon receiving
anything on SCI1. Eventually, I want to send specified data based on
different string inputs.

I am using Receiver Interrupt Enable(RIE) for my interrupt, and it works
but just once. I've done several things to figure out it out, and I know
for sure it will not interrupt at all after it interrupts the first
time. Here is my ISR:

__interrupt void SCI1_isr(void) {

//clearing
c = SCI1SR1;
c = SCI1DRL;

SCI1_OutString(message);

engineData();
}

Reading SR1 and DR clears the RDRF flag right? Why can't I continue to
use this interrupt after only using it one time?

Thanks in advance!


Reply by Arlin L Pierce November 17, 20082008-11-17
Have you looked at the actual code that is being generated.
If you are not using it, the compiler may optimize it out.

Arlin L. Pierce
Principal Software Engineer
Raytheon Company / Rancho Innovations

10606 Seventh Street
Rancho Cucamonga, CA 91730-5438
909. 483.4104 office
a...@raytheon.com

j...@emittechnologies.com
Sent by: 6...
11/17/2008 03:40 PM
Please respond to
6...
To
6...
cc

Subject
[68HC12] Re: SCI Rx Interrupt Only Works Once On S12DP256

Yes, c is a char. I'm not doing anything with it. I'm just using it to
read and clear SCI1SR1 flags. I'm using hyperterminal to generate the
input.

Here is my initialization code:

void SCI1_Init() {
//Baud = 9600
SCI1BDH=1;
SCI1BDLV;

// 1 start, 8 data, 1 stop
// no parity
SCI1CR1 = 0x00;

//Transmit enable
//Receive enable
//Receiver interrupt enable (RIE)
SCI1CR2 = 0x2C;
}


Reply by jmey...@emittechnologies.com November 17, 20082008-11-17
Yes, c is a char. I'm not doing anything with it. I'm just using it to read and clear SCI1SR1 flags. I'm using hyperterminal to generate the input.

Here is my initialization code:

void SCI1_Init() {
//Baud = 9600
SCI1BDH=1;
SCI1BDLV;

// 1 start, 8 data, 1 stop
// no parity
SCI1CR1 = 0x00;

//Transmit enable
//Receive enable
//Receiver interrupt enable (RIE)
SCI1CR2 = 0x2C;
}

Reply by Arlin L Pierce November 17, 20082008-11-17
What are you setting the SCI1CR2 register to?
It should only have RIE and RE set.

Arlin L. Pierce

j...@emittechnologies.com
Sent by: 6...
11/14/2008 02:59 PM
Please respond to
6...
To
6...
cc

Subject
[68HC12] SCI Rx Interrupt Only Works Once On S12DP256

I'm working on a Dragon12-P board from evbplus.com containing the
mc9s12dp256 and using CW 5.9.0 for a compiler. I'm a beginner, too. :)

I've got a C program that collects data from about 10 inputs, concats the
data into a single string, and transmits the data upon receiving anything
on SCI1. Eventually, I want to send specified data based on different
string inputs.

I am using Receiver Interrupt Enable(RIE) for my interrupt, and it works
but just once. I've done several things to figure out it out, and I know
for sure it will not interrupt at all after it interrupts the first time.
Here is my ISR:

__interrupt void SCI1_isr(void) {

//clearing
c = SCI1SR1;
c = SCI1DRL;

SCI1_OutString(message);

engineData();
}

Reading SR1 and DR clears the RDRF flag right? Why can't I continue to use
this interrupt after only using it one time?

Thanks in advance!


Reply by Anders Friberg November 17, 20082008-11-17
> -----Original Message-----
> From: 6... [mailto:6...]
> On Behalf Of j...@emittechnologies.com
> Sent: Monday, November 17, 2008 10:32 PM
> To: 6...
> Subject: [68HC12] Re: SCI Rx Interrupt Only Works Once On S12DP256
>
> Yes, with all the function calls removed, it will only go
> into the ISR once.
>

Assume c is a char? Does the value c make sense after reading? Like status
bits from SCI1SR1 and received data from SCI1DRL? No strange framing error
etc?

c = SCI1SR1;
c = SCI1DRL;

What generates the input char? Hyperterminal?

The chip is probably capable to receive a char and interrupt, maybe best to
check init code (only RIE enabled?) and also check or disable other code in
main loop?

Regards,
Anders

>
Reply by jmey...@emittechnologies.com November 17, 20082008-11-17
I think SI1SR1 is read-only?? Anyways, I appreciate everything, but I think I'm just going to go with polling instead of the interrupt....

Reply by nixknacks November 17, 20082008-11-17
Ummmm...I still don't have time to work on this...
But at the risk of being worse than useless...

You could try manually setting the flag? Throw in a ...

Read SCI1DRL first and then set...

SCI1SR1=0x20;

--- In 6..., jmeyer@... wrote:
>
> Yes, with all the function calls removed, it will only go into the
ISR once.
>