Pic to GSM Phone connection (HSerin problems)
Hi!
I am trying a project of remote control (SMS) using 16f628 connected to an Ericsson T10 mobile phone.
My problem is with the serial communication with the phone
I have tried everyting from software Serou/Serin to HSERIN/HDEROUT using build-in f628 USART.
Although Sending AT commands is ok receiving the reply from the phone is very difficult.
I think the phone response is too uick for picbasic to receive the stirng. What is your opinion. Is it possible from PBP Pro to cath-up the receiving data from the mobile?
(Using 9600,8,n,1) with no rs232-drivers - with inverted/noninverted modes -the same problem
Any ideas?
P.S: I have developed a PDU decoded with the pic. If it works properly I may public the code
Thank you all Pic-maniacs! :))
Tex node support on Nokias
NavMicroSystems thanks!
I think I will go for Nokia phone as it would be better to handle!
Anyway does al Nokia supports Text mode or only PDU format?
P.S I have a PDU decode routine available -as soon as I will try it out I will make the code available.
:)
Re: Tex node support on Nokias
Quote:
Originally posted by bitmaniac
NavMicroSystems thanks!
I think I will go for Nokia phone as it would be better to handle!
Anyway does al Nokia supports Text mode or only PDU format?
P.S I have a PDU decode routine available -as soon as I will try it out I will make the code available.
:)
@ bitmaniac
As far as I know do all NOKIA phones with embedded Modem support the text mode.
I have successfully tested it on 62xx and 63xx series.
The TEXT mode is easier to handle than PDU mode and it certainly saves some code space.
anyway: I am interested in your PDU encoding / decoding routines.
rgds
Pic to GSM Phone connection (HSerin problems)
Hi people,
I had implemented an interface with Ericsson and a 16F628 that worked fine.
I used a T65 model and pin 4 on the RS232 connector has to be driven high for the phone to accept and issue responces. For other models this can be different. Appart from pin 4, I used 3 more pins, Ground, TX and RX.
I used PDU mode due to the Ericsson and the fact that, any phone can be interfaced with virtually only hardware modifications.
I sample of my code is shown below:
@ DEVICE pic16F628, HS_OSC
' ---- High Speed Oscilator
@ DEVICE pic16F628, WDT_OFF
' ---- Watchdog Timer=OFF
@ DEVICE pic16F628, BOD_ON
' ---- Brown-Out Detect
@ DEVICE pic16F628, LVP_OFF
' ---- Low-Voltage Programming=OFF
@ DEVICE pic16F628, MCLR_OFF
' ---- Reset Pin=Internal
@ DEVICE pic16F628, PWRT_ON
' ---- Power-On Timer=Disabled
@ DEVICE pic16F628, CPD_OFF
' Data Memory Code Protect
' Set to CPD_OFF for Development Copy
@ DEVICE pic16F628, PROTECT_OFF
' Program Code Protection
INCLUDE "modedefs.bas"
' ******* Definitions *******
' ------------------------------
DEFINE OSC 16 ' Define clock Oscillator Frequency at 16Mhz
DEFINE HSER_RCSTA 90H ' Enable Hardware USART receive
DEFINE HSER_TXSTA 24H ' Set Hardware USART parameters
DEFINE HSER_BAUD 9600 ' Set baud rate to 9600
define HSER_CLROERR 1
CMCON=%00000111 ' Make PortA digital
' ****** Initialise PORTs ******
'----------------------------------
TRISA = %11110000 'Set PORTA status (Low byte=Output, for LEDs)
TRISB = %11100010 'Set PORTB status
PORTA = %00000000 ' Initial state of PORT A
PORTB = %00000000 ' Initial state of PORT B
' ****** Variables ******
'---------------------------
TXD VAR PORTA.0 ' Phone not responding
RXD VAR PORTA.1 ' Transmit to Phone
error VAR PORTA.2 ' Receive from Phone
deb var PORTA.3 ' Debugging led
relay0 VAR PORTB.3 ' First Relay
relay1 VAR PORTB.4 ' Second Relay
CALLER var byte[8] ' Callers ID Array
INSMS VAR BYTE[8] ' Incoming SMS message Array
cr con 13 ' Carriage Return character
lf con 10 ' Line Feed character
j var byte
goto start ' Jump to Main Program
' ****** SUBROUTINE AREA ******
' -------------------------------
meminit:
' Instract Phone to use it's own memory for storage and SMS manipulations
TXD = 1 ' Tx LED=ON
HSerout ["AT+CPMS=",34,"ME",34,44,34,"ME",34,44,34]
HSerout ["ME",34,cr] ' Command AT+CPMS="ME","ME","ME"
Pause 600
TXD = 0 ' TX LED=OFF
return
Some other ROUTINES reside here.......
' ****** MAIN PROGRAM AREA ******
' ----------------------------------
Start:
PAUSE 1000
TXD = 1 ' Tx LED=ON
HSerout ["at",cr] ' <----- Check for Phone presence
RXD = 1 ' Rx LED=ON
HSerin 400,nophone,[wait ("OK")]
Pause 500
TXD = 0 : RXD = 0 ' Tx & Rx LEDs=OFF
TXD = 1
hserout ["AT+CMGF=0",cr] ' <----- Initiate PDU Format
pause 400 ' Not needed for Ericsson Phones
' hserout ["ATE0",cr] ' <----- Turn Echo OFF
' pause 200
TXD = 0
Gosub meminit ' <----- Initialise Phone's SMS memory
TXD = 1
hserout ["AT+CSAS",cr] ' <----- SAVE SETTINGS
PAUSE 400
TXD = 0
' ++++ Read from Phone ++++
' -------------------------
GOSUB meminit
pause 3000
TXD = 1
HSerout ["AT+CMGL=0",cr] ' <----- Read Received and Unread Incoming messages.
TXD = 0
pause 2
RXD = 1
Hserin 800, msg_old , [wait ("+CMGL:")] ' If no +CMGL then no new SMS was read
hserin [skip 36, str caller\8 , skip 20, str insms \8]
RXD = 0
'GOSUB eepwrite
gosub meminit ' <----- Initialise Phone's SMS memory
hserout ["AT+CMGD=1",cr] ' <----- Delete the "read message" (First SMS)
pause 200
I do not decode the PDU but I use it ready made :) All the messages were sent and read from phone via HyperTerminal. The resulting PDU coded message was used. an example is shown below.
++++ An Unrecognised command was received ++++
' ----------------------------------------------
PAUSE 400
GOSUB meminit
TXD = 1 : deb = 1 : PAUSE 500
HSerout ["at+cmgs=33",cr] ' Intraction to Phone to send SMS in PDU mode
Pause 500 ' "Unrecognised Command" Message
HSerout ["0011000B915397490185F80000AA1455B7BC3C7E9FDDE9799 90C1ABEDBEDB09BEC02",26,cr,lf] ' PDU message of 33 bytes.
I hope that I helped a bit
Regards
Kypros V.
P.S. If you developed a PDU decoding code I woould appriciate if you share it.
Pic pdu encoding/decoding code
finally here is the forum linkfor the pdu encoding.decoding routine for anyone that is interested
http://www.picbasic.co.uk/forum/show...=&threadid=305