Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 27, 2024, 05:40:34 05:40


Login with username, password and session length


Pages: [1]
Print
Author Topic: SMS with PicMicro - PDU format  (Read 7564 times)
0 Members and 1 Guest are viewing this topic.
tango
Junior Member
**
Offline Offline

Posts: 52

Thank You
-Given: 28
-Receive: 11


« on: September 11, 2007, 12:00:13 00:00 »

This is NOT MY CODE but I was probe and is OK.
Maybe help to other user.

'****************************************************************
'*  Name    : pdupic.BAS   < TESTED on Pic 16fF628 >            *
'*  Author  : (c)2004 Alexandros Zachariadis                    *
'*  Notice  : Converting sms between txt and pdu format is      *
'*          : actually a matter of "septet" to octet convertion *
'*          : i.e: 7-bit data to 8-bit data and the oposite!    *
'*  Date    : 18/3/2004                                         *
'*  Version : 1.0c Final                                        *
'****************************************************************
include "modedefs.bas"

DEFINE OSC 20       '20Mhz crystal
DEFINE LCD_LINES 2

CMCON = %00000111   'PortA digital
;OPTION_REG.7 = 1   ' Disable PORTB pull-ups
clear
char    VAR BYTE [8]'text data
pdu     var byte [8]'pdu data
tmp     var byte [8]'temporary array
ch      var byte [8]'temporary array
b0      var byte
x       VAR BYTE


;---------your code from here...------------------
;fill-in the array with test data
start:
FOR X=0 TO 7
LOOKUP X,["hellohel"],B0 '8bytes textsms that will be converted in Pdu bytes
CHAR(X)=B0
NEXT X
FOR X=0 TO 7
LOOKup2 X,[232,50,155,253,70,151,217],B0 'pdu data:E8329Bfd4697D9...
pdu(X)=B0
NEXT X

;output the conversion results to LCD { 1stline>pdu2txt , 2ndline>txt2pdu }
;the Lcd I had was 2x8 ,so I can output a few bytes only.
gosub pdu2txt
lcdout $fe,$1,char(0),char(1),char(2),char(3),char(4),char(5),char(6),char(7)
gosub txt2pdu
lcdout $fe,$c0,hex pdu(0),hex pdu(1),hex pdu(2),hex pdu(3)
loop:
goto loop
;---------your code until here.----------------------

;-----CONVERSION ROUTINES-------
;---TXT2PDU--(sms_encoding)-----
TXT2PDU:
tmp(1)=char(1) << 7
tmp(2)=char(2) << 6
tmp(3)=char(3) << 5
tmp(4)=char(4) << 4
tmp(5)=char(5) << 3
tmp(6)=char(6) << 2
tmp(7)=char(7) << 1

ch(0)=chaR(0)                 
ch(1)=chaR(1) >> 1
ch(2)=chaR(2) >> 2
ch(3)=chaR(3) >> 3
ch(4)=chaR(4) >> 4
ch(5)=chaR(5) >> 5
ch(6)=chaR(6) >> 6
                     
pdu(0)=tmp(1) + ch(0)
pdu(1)=tmp(2) + ch(1)
pdu(2)=tmp(3) + ch(2)
pdu(3)=tmp(4) + ch(3)
pdu(4)=tmp(5) + ch(4)
pdu(5)=tmp(6) + ch(5)
pdu(6)=tmp(7) + ch(6)
RETURN

;---PDU2TXT--(sms_decoding)---
PDU2TXT:
tmp(0)=pdu(0) >> 7
tmp(1)=pdu(1) >> 6
tmp(2)=pdu(2) >> 5
tmp(3)=pdu(3) >> 4
tmp(4)=pdu(4) >> 3
tmp(5)=pdu(5) >> 2
tmp(6)=pdu(6) >> 1

ch(0)=pdu(0) & $7f                 
ch(1)=pdu(1) & $3f:CH(1)=CH(1) << 1
ch(2)=pdu(2) & $1f:CH(2)=CH(2) << 2
ch(3)=pdu(3) & $0f:CH(3)=CH(3) << 3 
ch(4)=pdu(4) & $07:CH(4)=CH(4) << 4 
ch(5)=pdu(5) & $03:CH(5)=CH(5) << 5 
ch(6)=pdu(6) & $01:CH(6)=CH(6) << 6 

char(0)=ch(0)
char(1)=ch(1) + tmp(0)
char(2)=ch(2) + tmp(1)
char(3)=ch(3) + tmp(2)
char(4)=ch(4) + tmp(3)
char(5)=ch(5) + tmp(4)
char(6)=ch(6) + tmp(5)
char(7)=tmp(6)
RETURN
END


Regards to all
Logged
memo333
Guest
« Reply #1 on: September 11, 2007, 05:26:56 17:26 »

thanks at first and i request schematic. which phones can be used and how we connect?
Logged
foxelec
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 11
-Receive: 12


« Reply #2 on: September 11, 2007, 07:40:11 19:40 »

hi friends,
most of phones can be used to send SMS from a pc (or a pic).You must connect it, for example with the serial cable, and send it "at commands".
The most simple to test it is to use a serial cable and the hyperterminal of windows.Select the com port and the correct speed, then just send : at (+ carriage return).
the phone should respond ok. if it's ok then you can try all the at commands it support and why not send sms (in pdu mode / sometimes in text mode=.


hope it helps

foxelec

Logged
Ret12_12
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 104
-Receive: 32


« Reply #3 on: September 11, 2007, 09:40:14 21:40 »

You said for  a serial cable what about if it has USB connection ? it is possible to "Speak" with the pic?
Logged
eleckits
Junior Member
**
Offline Offline

Posts: 54

Thank You
-Given: 36
-Receive: 18


« Reply #4 on: September 11, 2007, 09:48:22 21:48 »

You said for  a serial cable what about if it has USB connection ? it is possible to "Speak" with the pic?

You can do this via USB converter I mean USB converter to RS232 you can use FT232BM for this!

Hope to help !
Logged
Ret12_12
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 104
-Receive: 32


« Reply #5 on: September 11, 2007, 10:16:22 22:16 »

Yes i see ...

But the command will be by the same way ?

Logged
Parmin
Hero Member
*****
Offline Offline

Posts: 582

Thank You
-Given: 496
-Receive: 133


Very Wise (and grouchy) Old Man


« Reply #6 on: September 12, 2007, 08:57:10 08:57 »

just use somthing like 18f2550 and send AT commands to the phone bus.  simple
Logged

If I have said something that offends you, please let me know, so I can say it again later.
foxelec
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 11
-Receive: 12


« Reply #7 on: September 12, 2007, 07:28:19 19:28 »

hi friends,

Yes, in fact when i said a serial cable, it's a serial link. if it's a rs232 one, then no problem it's a normal com port.
If it's an IR link, it's the same it's a serial com port.
The USB case is very similar, in fact most of the usb link of mobile phone are "virtual serial com port".
When you install the drivers of the phone, a new virtual com port appears in the windows com port list, just look the com port number and the speed.
Then open the hyper terminal with these new settings and then use it like a real serial com port, just enter "at commands".

hope it helps

foxelec
Logged
pl4tonas
Active Member
***
Offline Offline

Posts: 145

Thank You
-Given: 318
-Receive: 195



« Reply #8 on: September 13, 2007, 08:18:36 08:18 »

For more information on SMS, PDU and phone interfacing you can visit the following links:

http://www.dreamfabric.com/sms/                                        info on PDU

http://www.smsmac.com/help/discover/about-sms/gsm7bit/      info about the 7-bit alphabet

http://www.traud.de/gsm/index.html                                     general info on SMS

http://www.riccibitti.com/tinyplanet/tiny_article.htm                a project using SMS to remote control devices

For the AT commands you can make a google search and find and download an AT-command manual for mobile phones
Logged
Ikaros
Junior Member
**
Offline Offline

Posts: 83

Thank You
-Given: 422
-Receive: 48


« Reply #9 on: September 13, 2007, 11:12:26 11:12 »

Why not use text format, most of the phones support? It is much more easy!

Logged
meax98
Active Member
***
Offline Offline

Posts: 167

Thank You
-Given: 1376
-Receive: 52


« Reply #10 on: September 13, 2007, 06:01:54 18:01 »

Because PDU mode, beside text message, contains a lot more meta-data about sender, time-stamp, network, delivery... If you need all this, than PDU mode is a must!
Logged
foxelec
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 11
-Receive: 12


« Reply #11 on: September 13, 2007, 06:38:52 18:38 »

hi friends,

yes text mode is simple but only pdu format is mandatory to be gsm compliant, so text mode is not present on all the phone

foxelec
Logged
margo
Junior Member
**
Offline Offline

Posts: 52

Thank You
-Given: 38
-Receive: 33


« Reply #12 on: September 13, 2007, 07:23:54 19:23 »

can someone tell me what info is available in pdu format that isnt in  text mode???
im buggered if i can see any difference
Logged
pl4tonas
Active Member
***
Offline Offline

Posts: 145

Thank You
-Given: 318
-Receive: 195



« Reply #13 on: September 15, 2007, 06:28:24 18:28 »

Text format is not available in many phones but in a few number. 
It is easyer to work with but in PDU you can have more options and it is also compatible with all phones in the market.
If you want to make a simple project then the TEXT format may be the solution.
Logged
margo
Junior Member
**
Offline Offline

Posts: 52

Thank You
-Given: 38
-Receive: 33


« Reply #14 on: September 15, 2007, 07:45:49 19:45 »

my personal opinion  Smiley

http://www.riccibitti.com/tinyplanet/tiny_article.htm

this project is the best reason NOT to go near the PDU mode

you have to store the message to be sent in memory, get the phone to generate the rest of the PDU. what a crap set up, if you wanted to send the temperature you would need to pre define all the poss values then look them up from the phones mem...rubbish...just set the text mode..sent it what you want (including the value of the variables) ending with ctrl-z..job done..the same applies with parsing the received message, instead of trying to find the 'data' you need in the pdu just wait for a pre arranged string to be sent i.e. 'record' 'lights on' etc etc, these keywords do not have to be at the exact start on the message making it all very easy and reliable...if you are new to sms with a pic the awkward PDU  looks daunting...IGNORE it, look up text mode and you will be up and running in no time.. yes not all phones support both text and pdu..but its worth finding the ones that do!!!
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC