Programming a GSM device

Hi,

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

Sona

Reply to
Sona
Loading thread data ...

There is an Ethernut Mailing List available at

formatting link

A PPP sample is available here

formatting link
(Click on download)

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

formatting link

Hope this helps to get started.

Harald

--
For spam do not replace spamtrap with my name
Reply to
Harald Kipp

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.

Reply to
Gary Kato

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.

Regards,

-=Dave

--
Change is inevitable, progress is not.
Reply to
Dave Hansen

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.

Reply to
???

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.