Programming a GSM device

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View

I've just started learning how to program a GSM device using the
etherNUT interface (in C). I was looking at some code examples and I
don't understand why everything needs to be an "unsigned char"? Also, in
a certain "checksum" check, the two numbers passed are being '&' with
0xff.. why is that? Can someone explain this to me or guide me to some
place where I can learn more about embedded programming? I'm very keen
in learning this and I know my questions may sound silly or dumb but
please bare with me. Thanks


Re: Programming a GSM device

Quoted text here. Click to load it

There is an Ethernut Mailing List available at

A PPP sample is available here
(Click on download)

In order to use a GSM device, you need to change NutChat,
which works similar to

Hope this helps to get started.


For spam do not replace spamtrap with my name

Re: Programming a GSM device
If you're talking about plain bytes, they are indeed "unsigned char". This is
important when you do any sort of shifting of the character, especially to the
right. Signed chars have the most-significant bit as the sign bit. If you shift
right, the compiler wil generate code for an arithmetic shift, which replicates
the sign bit.

Say your char is hex 83. If you shift it right one bit, you get hex C1 instead
of hex 41.

Re: Programming a GSM device

Quoted text here. Click to load it

This is not guaranteed.  Shifting signed integer values to the right
is a dicey operation, and should be avoided in code that is intended
to work on more than one platform.  At least in C...

Shifting unsigned integer values will always shift in zeroes,
regardless of the direction of the shift or the value of any of the
data bits.


Change is inevitable, progress is not.

Re: Programming a GSM device

Quoted text here. Click to load it

As too your two numbers & 0xff, some compilers will treat a char as
16bits, this ensures the upper 8 bits are reomved from the eqation.

i.e. shift 0x80 to the right and you get 0x100 in 16bit or 0 in 8bit.

Site Timeline