Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/10/04 10:28
Read: times


 
#77183 - another problem with IRQ from SPI CC03
Responding to: ???'s previous message
Now everything works fine, but ...

I'm unable to get ANY IRQ from the SPI hardware.

component AT89C51CC03


I've enable the bit for IEN1 register 0x04.
I've enable the bit for global EA for IRQ's

I've created an ISR routine to process the request.

BUT I never get any irq when transmission has ended.

Code :

#include "systemreg51cc03.h"
#include "systemc51_drv.h"
#include "spi_drv.h"

bit transmit_done = 0;
unsigned char serial_data = 0x00;

void SPI_init(void)
{
SPCON |= 0x10; // Master Mode
SPCON |= 0x82; // FClk Periph/128
SPCON |= 0x20; // P1.1 is standard I/O pin
SPCON &= ~0x08; // CPOL
SPCON |= 0x04; // CPHA
IE1 |= 0x04; // enable SPI interrupt
SPCON |= 0x40; // run spi core
transmit_done = 0;
EA = 1; // enable interrupts
}

unsigned char send_SPI(unsigned char MastData)
{
SPDAT = MastData;
while (!transmit_done);
transmit_done = 0;
return (serial_data);
}

void spi_isr (void) interrupt 10 using 0
{
transmit_done = 1;
}


void main (void)
{
SPI_init();
printf("init donen");
while (1)
{
send_SPI(0xAA);
printf("never reached, cause IRQ does not flag"):
}
}


When replacing the while loop with a waitloop, things are working just great .... but not as I want...

:-(

List of 12 messages in thread
TopicAuthorDate
SPI sample code ATMEL AT89C51CC03            01/01/70 00:00      
   RE: SPI sample code ATMEL AT89C51CC03            01/01/70 00:00      
      RE: SPI sample code ATMEL AT89C51CC03            01/01/70 00:00      
      Book vs teacher            01/01/70 00:00      
         RE: Book vs teacher            01/01/70 00:00      
      RE: SPI sample code ATMEL AT89C51CC03            01/01/70 00:00      
         another problem with IRQ from SPI CC03            01/01/70 00:00      
            RE: another problem with IRQ from SPI CC03            01/01/70 00:00      
               RE: another problem with IRQ from SPI CC03            01/01/70 00:00      
                  RE: simulator            01/01/70 00:00      
                     RE: simulator            01/01/70 00:00      
                        RE: simulator            01/01/70 00:00      

Back to Subject List