|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
trouble with S12XS SCI controlleri'm developing an uart driver based on interrupts.
i've realized that when executing the ISr software failed to reset TDRE Flag.i made sure tha i've followed all steps listed in the datasheet to do so which are: 1-reading the SCI Status Register. 2-Writing to the SCI Data Low register. but the ISR Continue to go in Loop. i wish tha anyone could help me figure this out. |
|
|
RE: trouble with S12XS SCI controllerFlollowing an extract of the code I use for SCI.
When I send datas, via a buffer : SCI1DRL = data to send... SCI1CR2 |= 0x88; // enable interrupt on Xmit buffer empty //*********************************************************************** void SCI1_Init (Word baudrate, Byte sysclk) { SCI1BDH = // your value for speed SCI1BDL = // your value for speed SCI1CR1 = 0x00; SCI1CR2 = 0x2c; // enable xmit/receive, int on receive only } //************************************************************************ #pragma interrupt_handler ISR_Sci1 void ISR_Sci1 (void) { unsigned char sci_status; sci_status = SCI1SR1; // Interruption on receive buffer full if (sci_status & 0x28) // RDRF 0x20 : Receive data register full { // Your code for reception } // Interruption on xmit buffer empty if (sci_status & 0x80) // TDRE : 0x80 ; Transmit Data Register Empty { // Your code for transmission if (/* your condition for xmit not finished */) { SCI1DRL = .../... } else // nothing else to xmit { SCI1CR2 &= 0x3f; // disable xmit interrupt } } } Best regards. Joel -----Message d'origine----- De : 68HC12@... [mailto:68HC12@...] De la part de ben_smida_hamdi Envoyé : jeudi 9 avril 2009 13:02 À : 68HC12@... Objet : [68HC12] trouble with S12XS SCI controller i'm developing an uart driver based on interrupts. i've realized that when executing the ISr software failed to reset TDRE Flag.i made sure tha i've followed all steps listed in the datasheet to do so which are: 1-reading the SCI Status Register. 2-Writing to the SCI Data Low register. but the ISR Continue to go in Loop. i wish tha anyone could help me figure this out. ------------------------------------ Yahoo! Groups Links |
|
|
Re: trouble with S12XS SCI controllerIf you want to get S12X SCI interrupt info, go to my site at:
http://mamoru.tbreesama.googlepages.com/ I have a page explaining how to do interrupts with the S12X, using the SCI as an example. Furthermore, the code source I have posted includes a working, tested, and verified SCI interrupt handler. (In assembly, of course.) Of course, this is with the S12XD, but I assume it should be similar/identical for the S12XS. Have Fun! Dave On Thu, Apr 9, 2009 at 5:02 AM, ben_smida_hamdi <ben_smida_hamdi@...>wrote: > > > i'm developing an uart driver based on interrupts. > i've realized that when executing the ISr software failed to reset TDRE > Flag.i made sure tha i've followed all steps listed in the datasheet to do > so which are: > > 1-reading the SCI Status Register. > 2-Writing to the SCI Data Low register. > > but the ISR Continue to go in Loop. > > i wish tha anyone could help me figure this out. > > > [Non-text portions of this message have been removed] |
|
|
Re: trouble with S12XS SCI controllerthanks for ur help.I guess i've catched a wrong address of the SCICR2 when trying to disable Tx interrupt in the ISR before exiting it.
Now it is working.but i am having another situation,i am using a service PUT_Byte_Exe which puts a byte in Tx Buffer(circular buff) then enables TDRE Flag INT request so as the interruption could directly handle sending this Byte.but what if i'm exiting the ISR and calling this service again ?? i've found that data will be overwritten cause when enabling Tx Interrupt(TIE = 1) TDRE will be set to 1 regardless of previous data has been already sent or not. |
| Free embeddable forum powered by Nabble | Forum Help |