# AT+CREG=1 not work in adl\_atCmdCreate();

**URL:** <https://forum.sierrawireless.com/t/at-creg-1-not-work-in-adl-atcmdcreate/2421>\
**Category:** Legacy AirPrime modules\
**Created:** [August 14, 2008, 12:50am UTC](https://forum.sierrawireless.com/t/at-creg-1-not-work-in-adl-atcmdcreate/2421 "2008-08-14T00:50:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjpking](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@cjpking](https://forum.sierrawireless.com/u/cjpking)\
**Post date:** [August 14, 2008, 12:50am UTC](https://forum.sierrawireless.com/t/at-creg-1-not-work-in-adl-atcmdcreate/2421/1 "2008-08-14T00:50:11Z")

</div>

Source:

s16 Creg\_Handler(adl\_atResponse\_t \*paras)  
{  
adl\_atSendResponse(ADL\_AT\_UNS, “\r\nThis is the feedback from AT+CREG=1\r\n”);  
adl\_atSendResponse(ADL\_AT\_UNS, paras-\>StrData);  
}

void adl\_main(adl\_InitType\_e InitType)  
{  
adl\_atCmdCreate(“AT+CREG=1”, FALSE, (adl\_atRspHandler\_t)Creg\_Handler, “\*”, NULL);  
}

When run this program the feedback is:

This is the feedback from AT+CREG=1

OK

Then I checked the result by manually input AT+CREG?, it still work as +CREG:0,1, NOT work as +CREG: 1,1.

So I have to manually input AT+CREG=1 to let module run on +CREG: 1,1.

Anyone can tell me what’s happened?

Thanks

---

<div class="post-metadata">

**Author:** ![cjpking](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@cjpking](https://forum.sierrawireless.com/u/cjpking)\
**Post date:** [August 14, 2008, 12:52am UTC](https://forum.sierrawireless.com/t/at-creg-1-not-work-in-adl-atcmdcreate/2421/2 "2008-08-14T00:52:48Z")

</div>

and I change to AT+CREG? and run this program.

The result is:

This is the feedback from AT+CREG?

+CREG: 2,1,“0113”,“2078”

This is the feedback from AT+CREG?

OK

But when I manually input at+creg? It displays as:

+CREG: 0,1

OK

---

<div class="post-metadata">

**Author:** ![cjpking](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@cjpking](https://forum.sierrawireless.com/u/cjpking)\
**Post date:** [August 14, 2008, 12:59am UTC](https://forum.sierrawireless.com/t/at-creg-1-not-work-in-adl-atcmdcreate/2421/3 "2008-08-14T00:59:50Z")

</div>

Here is the definition I copied from adl\_at.h

/\* --------------------------------- _/  
/_ Body for response message type : _/  
/_ --------------------------------- \*/  
typedef struct  
{  
#ifndef **REMOTETASKS**  
adl\_strID\_e RspID;  
adl\_atPort\_e Dest;  
#else  
u8 RspID;  
u8 Dest;  
#endif  
u16 StrLength;  
ascii StrData[1];  
} adl\_atResponse\_t;

So the question is: Why StrData is defined as StrData[1], not defined as ascii \*StrData or ascii \*StrData[100], and so on.
