Hi!
I just thought i'd post my problem here and hopefully one of you would be albe to help me out. PLEASE.
I have a mega128 and am using a 5001, 501 combo for the evaluation.
Currently i am also using TI 7844 A/D chip for which i intend to use the SPI bus to gather data.
This is what i've done so far
I initialized the SPI bus as follows
//initialize the clock
//XDIV = XDIV | (1<<XDIVEN) | (1<<XDIV0)|(1<<XDIV4);
//PORTE = PORTE | (1<<PORTE7);
PORTB |= (1 << PORTB1);
/*----------------------------------
Set MISO Input, all other pins as output for Master Mode
PORTB Pin 0, 1, 2
------------------------------------*/
DDRB = (1 << DDB0) | (1 << DDB1) | (1 << DDB2);
DDRE = 0x00;
//Clear SPCR
SPCR = 0x00;
//Clear SPI Status Register
SPSR = 0x00;
/*----------------------------------
Enable SPI in the Slave Mode
SPE:- Enable SPI
SPIE:- Enable SPI Interrupts
MSTR:- Master/Slave Mode
DORD:- Xmit MSB first
CPOL:- Falling Edge Clock
CPHA:- Leading Edge Clock
SPR:- F(osc)/4 SPR1 and SPR2 0
------------------------------------*/
SPCR = ((1<<SPIE) | (1 << SPE) | (1 << MSTR)) /*| (1 << CPOL) */| (1<<SPR0);
//Enable external interrupt 7
// this interrupt is controlled by the busy signal from the A/D
EIMSK = 0x00; /* Disable external interrupts */
EICRB = (1 << ISC71) | (0 << ISC70);
EIMSK = (1 << INT7);;
EIFR |= (1<<INTF7);//0xFF; /* Clear all flags */
__enable_interrupt();
I am trying to use the SPI interrupt to send the data
and external interrupt7 to receive data.
I am not able to interrupt the internal interrupt.
and also can never see any changes to the SPDR when i put the value in the register.
am i missing something. PLEASE help