to pic 32 genuises

Thread Starter

teeka1983

Joined Jan 30, 2009
0
hello Pic geniuses;



i have been debuging a code in my pic32 starter kit and when i try to send data through SPI1BUF and checking the watch for the contents in this buffer,i am always geting FFFFFFFF,it looks like my buffer is always like this.
here is a snap of my code (suppose all the inturupt initialization is done correctly)
#define CONFIG (CN_ON | CN_IDLE_CON)
#define PINS (CN8_ENABLE| CN9_ENABLE| CN10_ENABLE)
#define PULLUPS (CN8_PULLUP_ENABLE | CN9_PULLUP_ENABLE |CN10_PULLUP_ENABLE )
#define INTERRUPT (CHANGE_INT_ON | CHANGE_INT_PRI_2)
#define SPI_CONF 0x8D20 // cke=1 ckp=0,32 mode master mode
#define SPI_BAUD 0 // clock divider Fpb/(2 * (00+1))

int outputs[8]={0xdfae,0x12eda,0x22,0xee4,0xdfe5,0x1237,0x12ee}; ////array table for desired outputs
main{
SPI1CON = SPI_CONF; // select mode and enable
SPI1BRG = SPI_BAUD; // select clock speed
PORTSetPinsDigitalIn(IOPORT_G, BIT_6 | BIT_7 | BIT_8| BIT_9);//thise bins are input from portG
// read port(s) to clear mismatch on change notice pins
unsigned int i;
i=mPORTGReadBits(BIT_6 | BIT_7 | BIT_8| BIT_9);
//clear change notice interrupt flag
ConfigIntCN(INTERRUPT);
// enable multi-vector interrupts
INTEnableSystemMultiVectoredInt();

while(1){}////////looop for ever
}


/////here is the inturupt

ivoid __ISR(_CHANGE_NOTICE_VECTOR, ipl2) ChangeNotice_Handler(void)
{
unsigned int i;
// clear the mismatch condition
i=mPORTGReadBits(BIT_6 | BIT_7 | BIT_8);
SPI1BUF=outputs;
mCNClearIntFlag();
} //end of the inturupt
 
Top