What is a 'packed' SMS
1) What is a packed SMS?
The packed SMS for ‘hello’ is
48
|
49
|
50
|
51
|
52
|
E8
|
32
|
9B
|
FD
|
06
|
SMS='hello'
|
Actually you can find more info on this subject by googling for PDU format or TPDU
The site www.embedtronics.com also gives good info on this.
Now how do you decode this SMS?
Simply DON’T! I didn’t!
Instead store coded templates of the SMS (as the above one) in code memory for your various devices to be controlled.
E.g. If you have 4 devices to be turned on and off, name them
Device1, Device2, Device3, Device4
So now if Device2 (connected to P2.5) has to be turned on, send SMS
Device2 on
Which when coded is C4 B2 3D 3D 2E CB 40 6F 37 (hex)
So now you can put this code in Code memory and compare the received ‘packed’ SMS instead of decoding/unpacking the SMS. Quite easy!
But otherwise you can write the unpacking code too at the cost of memory.
We are using AT89S52 which has got 256 bytes RAM and 8K code memory.
But since it does not have EEPROM, there is no point customizing SMS for user and therefore no need unpacking the SMS.
To summarize, whichever way, you can now take appropriate action according to the SMS received.