Hi,
I'am working on project where I have EVAL Aduc7020MKZ and MMA8452Q Accelerometer. Accelerometr can send interrupts when data ready. I'am using pins 20(IRQ0) and 21(IRQ1) for handling external interrupts. The problem is that I can't set IRQEN variable to XIRQ1_BIT.
void init_i2c_uart(){ GP1CON = 0x2211; // Set UART tx & rx pins on P1.0 and P1.1 = 0x0011 // and I2C on P1.2(SCL) and P1.3(SDA) = 0x2200 // Start setting up I2C at 100kHz I2C1CFG = 0x82; // Master Enable & Enable Generation of Master Clock I2C1DIV = 0xCFCF; // 0xCFCF = 100kHz, 0x3232 = 400kHz // Start setting up UART at 9600 bauds COMCON0 = 0x080; // Setting DLAB COMDIV0 = 0x88; // Setting DIV0 and DIV1 to DL calculated 19200 COMDIV1 = 0x000; COMCON0 = 0x007; // Clearing DLAB // Interrupt config IRQ = My_IRQ_Function; // Interrupt rutine // Interrupt enabled // SM_MASTER1_BIT = I2C1, XIRQ0_BIT = IRQ0, XIRQ1_BIT = IRQ1 IRQEN = XIRQ1_BIT; GP4DAT = 0x04000000; // P4.2 configured as an output. LED is turned on } int main (){ POWKEY1 = 0x01; POWCON = 0x00; POWKEY2 = 0xF4; init_i2c_uart(); i2c_byte_read(ACC_ADDR, WHO_AM_I); while (1) {;} }
The LED on GP4DAT won't lit after IRQEN = XIRQ1_BIT. I tried another varible like SM_MASTER1_BIT and everything worked fine and LED was turned on.