You will never get this to work if you don't take the time to read any datasheet.... do I need an hex inverter? or a max232?
You will never get this to work if you don't take the time to read any datasheet.... do I need an hex inverter? or a max232?
regards
Ralph
_______________________________________________
There are only 10 types of people:
Those who understand binary, and those who don't ...
_______________________________________________
don't quite understand your comment.
thanks for your input.
...nor RS232Originally Posted by dimitrin
regards
Ralph
_______________________________________________
There are only 10 types of people:
Those who understand binary, and those who don't ...
_______________________________________________
because it does work with rs 232.
thanks again for you help
I got an Ericsson T18 phone, which works with the data cable for AT commands.. Going through the internet I found that it doesn't support Text mode, Only pdu mode available. So can I make it work by using bitmaniac's PDU decoder. And I am going to use PIC16F877A. If I do the necessary changes it should work right......
thanks in advance
aruran
Hello,
I am look out for technical details of Samsung SCH-N356. I also want to make SMS controled relay. Please suggest.
Bye
Hai all,
First of all thank you all for the help rendered. I have successfully made a Ericsson T18 to send SMS using PIC16F877A. I give the PIC using I2C bus some data from a main PIC for my microcontroller project. I have written a dynamic PDU encode routing to handle the dynamic texts sent by the main pic. This was achieved mainly from the help of bitmaniac's PDU encode...
Thank you all
aruran
Hi
I am very new to PIC's so please excuse some of the comments that I have added to the following code.
I have put this together using data that was available earlier in this post. I have got the SMS sending working great whenever I push a button but I am also wanting an LED to be switched on when the GSM modem receives and SMS containing "SWITCH"
I think I have got everything that I require within the program but I am wondering what commands I should use in order to read the GSMBuffer then if it is true then switch on the LED.
I have added the line just to give an idea of what I'm trying to do:
IF GSMBUFFER = "SWITCH" THEN LED = 1
Here is the code:
' Setup PIC tx and rx serial port
DEFINE OSC 8
DEFINE HSER_TXSTA 20h
DEFINE HSER_RCSTA 90h
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1
'Setup the names that will be used throughout the program for the led and switch
PushButton var PORTB.0 ' Setup the name PushButton to mean PortB input 0
LED VAR PORTB.1 ' Setup the name LED to mean PortB output 1
' SMS receive buffer setup:
GSMBUFFER VAR BYTE[16] '16 is used to tell buffer to store max of 16 characters
Caller VAR BYTE[13] '13 is used to tell buffer to store max of 16 characters
GSMTime VAR BYTE[17] '17 is used to tell buffer to store max of 16 characters
' Set all PortB i/o 1 to be an output and all other i/o as inputs
TRISB = %11111101
Main:
IF PushButton = 0 THEN SMS 'If button is pressed then run the SMS routine below
goto main ' however if the button is not pushed then just go back to the Main
' routine to wait for the button to be pressed
SMS: ' this is the SMS commands routine in order to send an SMS
HSEROUT ["AT" ,13,10] ' send AT to modem followed by a CR and line feed
HSERIN 5000, SMS, [WAIT("OK")] ' now wait for 5secs until OK is received however
' if it is not then goto the SMS routine again
HSEROUT ["AT+CMGF=1" ,13,10]
HSERIN 5000, SMS, [WAIT("OK")]
HSEROUT ["AT+CMGS=+447977578999"]
HSEROUT [13,10]
HSERIN 5000, SMS, [WAIT(">")]
HSEROUT ["BUTTON HAS BEEN PRESSED!"]
HSEROUT [26] ' this is ASCII for Ctrl+Z of which completes SMS sending
HSERIN 15000, SMS, [WAIT("+CMG")] ' then PIC should receive +CMG from modem
HSEROUT [10] 'ascii code for a line feed
goto main
READSMS: 'Use this routine to read first 16 characters of new messages and then
' store them in the GSMBUFFER variable above then you are able to add a line at
' the end in order for an led to be switched on whenever the modem receives the
' correct SMS command such as LED ON or SWITCH etc
HSEROUT ["AT+CMGF=1",13,10] 'Instruct modem to use text mode
HSerout ["AT+CMGL",13,10] 'List new Messages
' Below I Read Caller ID, time and 16 CHARs of Message
' The timeout value in the HSERIN statement is important, it takes some time
' before the phone replies to the AT+CMGL command
' skip works like this: skip 4 (skips 4 characters) - this is a sample of the
' message that would be received after the AT+CMGL command is sent:
' +CMGL: 2,"REC UNREAD","+447977578999" Test
' Please note that I can't seem to receive the time in the reply as in this
' example: (of which the line of code is written for below - so maybe I should
' edit the line of code below in order to miss it - also remember to update
' GSMTime variable above i.e. remove it if your going to adit the line below)
' +CMGR: "REC READ","+xx1234567890",,"05/05/26,17:19:23+00" GOOD
' Loop could be setup as a routine such as:
' Loop:
' List new Messages again - as above (think about it)
' HSerout ["AT+CMGL",13,10]
HSerin 5000,loop,[wait("UNREAD"),skip 3,STR Caller\13,skip 4,STR GSMTime\17,skip 6, STR GSMBUFFER\16\13]
' Basically in the above line, \13 - stores 13 characters and \17 - stores 17 characters etc into
' each of the buffers i.e. Caller & GSMTime etc etc
HSerout ["AT+CMGD=1;+CMGD=2",13,10] 'Intruct modem to delete SMS's from location
' 1 & 2 as this is where any new messages will be stored, so its a good idea to
' delete them after we have processed the SMS command above - please note that
' it would be a good idea to wait for an OK after this command but we can add
' this at a later time
' --- Put your code to output the result here i.e. IF gsmbuffer = (your sms command) then goto
' subroutine etc
IF GSMBUFFER = "SWITCH" THEN LED = 1
Thank you for your time.
Kind Regards,
Royce
On the following code the phone responds ..."REC READ",... if the message was read sometime before. If you have a fresh new message then this becomes UNREAD as you state on your code.
So, why don't you change your code to:
HSerin 5000,loop,[wait("READ"),... since the word READ is present all the time?
Ioannis
' +CMGR: "REC READ","+xx1234567890",,"05/05/26,17:19:23+00" GOOD
' Loop could be setup as a routine such as:
' Loop:
' List new Messages again - as above (think about it)
' HSerout ["AT+CMGL",13,10]
HSerin 5000,loop,[wait("UNREAD"),skip 3,STR Caller\13,skip 4,STR GSMTime\17,skip 6, STR GSMBUFFER\16\13]
Thank you for the info.
I was wondering if you could tell me how I should use the data that is captured within the GSMBuffer i.e. the SMS text as I would like use this to switch on an LED. Should it be something like this:
IF GSMBuffer = Switch on then LED = 1
Thanks in advance.
Kind Regards,
Royce
PBP does not have such string compring capabilities.
You have to make your own subroutine to compare byte to byte the two string array. Like that:
i=0
while i less_than gsmbuffer_length (I cant sen the less character! Why?)
if gsmbuffer[i]=compare_array[i] then
'gsmbuffer[i]=0
i=i+1
else
goto wrong_sms
endif
wend
correct_sms:
'your code here
wrong_sms:
'your code here
You understand that in compare_array you have to put your characters in some other place of the program prior to the above subroutine.
Last edited by Ioannis; - 26th July 2005 at 11:25.
Thanks again but I'm afraid I dont quite understand. Really sorry but would it be possible to be little clearer.
Thanks again.
Kind Regards,
Royce
Hmm, what part you are not understanding?
Ioannis
Bookmarks