PDA

View Full Version : problem with the GSM controller



Dariolo
- 29th May 2009, 23:16
I worked on a GSM controller for my school project.
The GSM controller should controlling a 3 phase motor, I added an option to controlling them over push button's!

But i haw a problem with the communication to GSM phone!

I used 16F628 and Siemens M55 as GSM modem (PDU :mad:)!

The problem is when i try to read the message from phone with AT+CMGR=1, then the pic begins to send constantly that command to phone (faster and often then he should)! the phone answers every time with the last message as it should, but the pic doesn't recognize that!
When I disconnect the GSM from PIC, PIC begins to work as it should.

To connect the GSM to PIC i used that schematic

http://www.picbasic.co.uk/forum/attachment.php?attachmentid=3249&d=1236671766

Without the "amplifier" the pic doesn't recognize the GSM!

here is the part of code i wrote:


DEFINE OSC 12
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 77 ' 9600 Baud @ 0,16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
DEFINE HSER_BAUD 9600
SYMBOL SDA = porta.0
SYMBOL SCL = porta.1
DEFINE I2C_SDA PORTA.0
DEFINE I2C_SCL PORTA.1
DEFINE I2C_SCLOUT 1
SYMBOL LED = PORTB.3
SYMBOL RE1 = PORTB.4
SYMBOL RE2 = PORTB.5
SYMBOL RE3 = PORTB.6
SYMBOL RE4 = PORTB.7
symbol SW1 = PORTA.2
symbol SW2 = PORTA.3
symbol SW3 = PORTA.4
symbol SW4 = PORTA.5
symbol SW5 = PORTB.0
OUTPUT LED
OUTPUT RE1
OUTPUT RE2
OUTPUT RE3
OUTPUT RE4
input SW1
input SW2
input SW3
input SW4
input SW5
CMCON=7 'Ugasi komparatore
VRCON=0 'Ugasi VREF
broj var byte [12] 'Aray promjenjive za tel. broj
pdu var byte [4] 'PDU text poruke
tempb VAR BYTE [12] 'Temp za tel. broj
adr VAR BYTE 'promjenjiva za brojanje
a var BYTE
i VAR BYTE
c VAR BYTE
init:
high LED
Hserout ["ATZ", 13, 10] 'Standardne postavke
hserin 2000, init, [WAIT ("OK")] 'Čekaj OK odgovor
HSEROUT ["ATE0", 13]
pause 300
low led
sms_me:
HIGH LED 'upali LED1
HSEROUT ["AT+CPMS=ME", 13, 10] 'Postavi memoriju tel. za SMS
HSERIN 2000, sms_me, [WAIT ("OK")] 'Čekaj OK
pause 300
low led


taste:

iF SW1=0 THEN
i=1
ELSE
IF SW2=0 THEN
i=2
ELSE
IF SW3=0 THEN
i=3
ELSE
IF SW4=0 THEN
i=4
ELSE
IF SW5=0 THEN
i=5
ELSE
GOTO sms
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
GOTO rele

sms:
HIGH LED
HSEROUT ["AT+CMGR=1", 13, 10] 'Pročitaj zadnji primljen SMS
HSERIN 4000, taste, [WAIT ("+CMGR:"), SKIP 1, str a\1, SKIP 26, STR BROJ\12, SKIP 20, STR pdu\4]
IF A=0 THEN
GOTO taste
ENDIF

I hope someone can help me, because i must have it finished on Monday

P.S. SRY for my veryyyyyyy bad English :rolleyes:

THX

malwww
- 30th May 2009, 00:16
hi, im new in pbp but i think u should use max232 or 74hc244 between gsm and pic instead the transistors,i hope it will works

Archangel
- 30th May 2009, 00:37
HSERIN likes to idle in a HIGH state, so even without the "amplifier" it requires a pull up resistor, or it just locks up on boot.

Dariolo
- 30th May 2009, 10:44
@malwww, with the integrated USART i don't need them, because PIC and GSM works on the "same" signal voltage.

I tried the pull up without the "amp" but the GSM voltage is to low, and the PIC won't them recognize again!

I have no more ideas, helpppp!! :D :D

Archangel
- 30th May 2009, 20:33
I tried the pull up without the "amp" but the GSM voltage is to low, and the PIC won't them recognize again!

I have no more ideas, helpppp!! :D :D
So lower the voltage your PIC is operating on. The data sheet says the PIC you have selected will operate on voltages from 2.0 to 5.5 volts