AnsweredAssumed Answered

ADUC 7024 eval board I2C slave

Question asked by dududayan@gmail.com on Jul 9, 2014
Latest reply on Jul 9, 2014 by dududayan@gmail.com

hello

I am using an eval board for ADUC 7024 with IAR compiler. I am trying to work with the example of I2C slave and I am told that there is an error no. Pe[020]  "identifier IRQ is undifined ".

does anyone know how to overcome this problem? thank you

 

this the code-

 

#include<ioaduc7024.h>

#define __TMR_PWM;

#include <stdio.h>

#include <math.h>

void ADCpoweron(int);

unsigned short ADCDATA[100];                                    //array data of vin analog

void My_IRQ_Function();

int i=0, dat[9];

int main(void)

{

          //////////    I2C    \\\\\\\\\\

  GP1CON = 0x22; // I2C on P1.0 and P1.1

  IRQ = My_IRQ_Function; // Specify Interrupt Service Rountine

  IRQEN = 0x200; // I2C0 Slave Interupt

  I2C0CFG = 0x1;   // Slave Enable

  I2C0ID0 = 0xA0; // Slave ID

  I2C0STX = 0x77;

  while (1)

  {

  };

           

}

 

void My_IRQ_Function()

{

  // Slave Recieve

       if ((I2C0SSTA & 0x08)==0x08)   // Slave Recieve IRQ

       {

         dat[i] = I2C0SRX;

         i++;

       }

        // Slave Transmit

  if ((I2C0SSTA & 0x04)==0x04)   // Slave Transmit IRQ

  {

  if(i > 4) // Resetting value of i if it has been incremented by RX

  {

  i = 0;

  }

     i++;

  switch

  {

  case 1:

  I2C0STX = 0x55;

  break;

 

 

  case 2:

  I2C0STX = 0x33;

  break;

 

 

  case 3:

  I2C0STX = 0xAA;

  break;

 

 

  case 4:

  I2C0STX = 0x11;

  break;

  };

  }

}

 

 

void ADCpoweron(int time)

{

  ADCCON = 0x620; // power-on the ADC

  while (time >=0)   // wait for ADC to be fully powered on

    time--;

}

Outcomes