This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Re-Post on INT

Guys sorry for my poor format for the same issue previously....

Hey Linq,

A good news infact for your valuable support , today I was able to comunicate with I2C , almost 90% is done . Can you help me out for these issues listed below ..

the state where i get data ,i.e

case 0x50 ( Data Recieved with ACK) :

Master_Buff[Read_Index] = I2DAT ;

Read_Index++;

if(Read_Index != MAX_READ)
{
   I21CONSET = 0x04 (ACK bit)
}

else
{

Read_Index = 0;
I21CONSET = 0x10 (stop)

}

When I track Master_Buff 's value and use it within the Interrupt using UARTBYte out under CASE 0x50 , i get the correct data .

When I track Master_Buff''s value outside the IRQ and use it in my main , i am not getting the data .

To be noted that Master_Buff is a global variable , Then where should be the problem ???

Thanks for your support !

Looking forward,
Samjith

Parents
  • Hi Samjith Wasim,

    Please do NOT create new thread everytime when you just want to reply/update to your identical question/problem.

    If you create new thread everytime, then we are not able to know your progress correctly and not able to check you code easily.

    According to your another thread:

    Your Code:

    void main(void)
    {
    
            PCONP |= 0x00080000;
    
            PINSEL1 |= 0x000003C0;  /* Setting Pin Selection for I2C1 */
    
            I21SCLL   = 60;         /* Speed at 100Khz  */
            I21SCLH   = 60;
    
    
            VICIntEnClr |= (1<<19);
            VICVectPriority19 = 1;
            VICVectAddr19 = (unsigned long)I2C_IRQHandler;
            VICIntEnable |= (1<<19);
    
    
     while(1)
      {
    
            I21CONSET = 0x00000040;  /* Setting I2Enable bit   */
            I21CONSET = 0x00000020;  /* Setting Start Bit */
    
           if(Message == 1)
           {
              LcdDisplay("Message is 1");
           }
    
          and so on....till Message == 23..
      }
    

    If the above code remains your main() function, then [you can not get the data you want in main() function] is due to [ISR runs very quickly, when ISR finishs its work, main() has not started to work].

Reply
  • Hi Samjith Wasim,

    Please do NOT create new thread everytime when you just want to reply/update to your identical question/problem.

    If you create new thread everytime, then we are not able to know your progress correctly and not able to check you code easily.

    According to your another thread:

    Your Code:

    void main(void)
    {
    
            PCONP |= 0x00080000;
    
            PINSEL1 |= 0x000003C0;  /* Setting Pin Selection for I2C1 */
    
            I21SCLL   = 60;         /* Speed at 100Khz  */
            I21SCLH   = 60;
    
    
            VICIntEnClr |= (1<<19);
            VICVectPriority19 = 1;
            VICVectAddr19 = (unsigned long)I2C_IRQHandler;
            VICIntEnable |= (1<<19);
    
    
     while(1)
      {
    
            I21CONSET = 0x00000040;  /* Setting I2Enable bit   */
            I21CONSET = 0x00000020;  /* Setting Start Bit */
    
           if(Message == 1)
           {
              LcdDisplay("Message is 1");
           }
    
          and so on....till Message == 23..
      }
    

    If the above code remains your main() function, then [you can not get the data you want in main() function] is due to [ISR runs very quickly, when ISR finishs its work, main() has not started to work].

Children