# Problem while reading from GPI

**URL:** <https://forum.sierrawireless.com/t/problem-while-reading-from-gpi/2801>\
**Category:** Legacy AirPrime modules\
**Created:** [January 5, 2009, 12:06pm UTC](https://forum.sierrawireless.com/t/problem-while-reading-from-gpi/2801 "2009-01-05T12:06:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamed](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@hamed](https://forum.sierrawireless.com/u/hamed)\
**Post date:** [January 5, 2009, 12:06pm UTC](https://forum.sierrawireless.com/t/problem-while-reading-from-gpi/2801/1 "2009-01-05T12:06:22Z")

</div>

Hi!  
I’m trying to use this sample application to write 1 in GPIO\_0 and read GPI. I have connected GPIO\_0 and GPI and use this code:

```auto
void adl_main ( adl_InitType_e InitType )
{            

    adl_atSendResponse ( ADL_AT_UNS, "\r\nWe want to start to recieve sms1\r\n" );
       
    // TO DO : Add your initialization code here
   // adl_tmrSubscribe ( TRUE, 100, ADL_TMR_TYPE_100MS,TimerHandler );
    adl_simSubscribe (SimHandler,NULL);
    GPI_status=1;
            handle=adl_ioSubscribe( ADL_IO_Q24PLUS_GPIO_0, 0, 0x00000000, 0, NULL); // ((2))
            adl_ioWrite((u8) handle,ADL_IO_Q24PLUS_GPIO_0,1);
            adl_ioWrite((u8) handle,ADL_IO_Q24PLUS_GPIO_0,ADL_IO_Q24PLUS_GPIO_0);
   while (GPI_status<1000) //
       {
            handle=adl_ioSubscribe( ADL_IO_Q24PLUS_GPI, 1,0,0, NULL);
            Status=adl_ioRead(handle);
           if(Status==1)
           {
            adl_atSendResponse ( ADL_AT_UNS, "\r\n GPI is high \r\n" );
           }
           adl_atSendResponse ( ADL_AT_UNS, "\r\nNo one touch me!\r\n" );
           GPI_status++;
        }
    sms_automaton_Handle_txt = adl_smsSubscribe(SMS_AUTO_Handler, SMS_AUTO_ctrl_Handler, ADL_SMS_MODE_TEXT);
   
    if(sms_automaton_Handle_txt == ADL_RET_ERR_PARAM){
        adl_atSendResponse ( ADL_AT_UNS, "\r\nCan't subscribe to the sms\r\n" );
    }
    else
    {
        adl_atSendResponse ( ADL_AT_UNS, "\r\nsubscribed to the sms\r\n" );
    }      
}
```

The GPIO\_o is high but i can’t read GPI!  
What is wrong in this code?
