The Philippine Electronics and Technology Forum
May 17, 2012, 06:26:26 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: 1 ... 3 4 [5] 6 7 ... 48   Go Down
  Print  
Author Topic: "Interfacing EGISMO BenQ/Sim900D with PIC MCU & Proton Code"  (Read 26223 times)
Co0LėT♥
Hydroelectric
***

Pogi/Ganda Points: 368
Offline Offline

Gender: Female
Posts: 3330



« Reply #80 on: February 09, 2010, 07:48:13 PM »

hardware nga.. di na nagtetext yung gsm namin.. may error..

so sad..


sa hyperterminal ayaw na din? sayang naman.  Embarrassed
Logged

Simpler designs are usually better.
The Philippine Electronics and Technology Forum
« Reply #80 on: February 09, 2010, 07:48:13 PM »

 Logged
freakything
Size C Battery
*****

Pogi/Ganda Points: 12
Offline Offline

Gender: Female
Posts: 199


aw!


WWW
« Reply #81 on: February 09, 2010, 07:50:55 PM »

sa hyperterminal ayaw na din? sayang naman.  Embarrassed

ok na... yung nakaset palang baud eh 0..

alam ba ninyo yung command ng pagsave ng settings ng gsm?

wala akong makita sa list ng at commands eh..
Logged

Resistance is futile (if <1 ohm)
The Philippine Electronics and Technology Forum
« Reply #81 on: February 09, 2010, 07:50:55 PM »

 Logged
Co0LėT♥
Hydroelectric
***

Pogi/Ganda Points: 368
Offline Offline

Gender: Female
Posts: 3330



« Reply #82 on: February 09, 2010, 07:59:56 PM »

Save Settings AT+CSAS ... not yet tried by me  Grin


bakit kailangan pang i-set? pwede naman sa umpisa ng program i-set  Wink
Logged

Simpler designs are usually better.
The Philippine Electronics and Technology Forum
« Reply #82 on: February 09, 2010, 07:59:56 PM »

 Logged
freakything
Size C Battery
*****

Pogi/Ganda Points: 12
Offline Offline

Gender: Female
Posts: 199


aw!


WWW
« Reply #83 on: February 09, 2010, 08:08:30 PM »

Save Settings AT+CSAS ... not yet tried by me  Grin


bakit kailangan pang i-set? pwede naman sa umpisa ng program i-set  Wink

panu naman yun?

aaahhh.. alam ko na..

lagyan ng at+ipr=9600 yung program.. haha
Logged

Resistance is futile (if <1 ohm)
Co0LėT♥
Hydroelectric
***

Pogi/Ganda Points: 368
Offline Offline

Gender: Female
Posts: 3330



« Reply #84 on: February 09, 2010, 08:23:58 PM »

panu naman yun?

aaahhh.. alam ko na..

lagyan ng at+ipr=9600 yung program.. haha

hehehe ano  ba gamit mo sister? M23 ba? bakit yung saken auto-detect ang baud rate? hindi ko na isini-set kahit ang speed ko 9600,14400,19200,115200 nadi-detect ng M23 ko.  Wink
Logged

Simpler designs are usually better.
freakything
Size C Battery
*****

Pogi/Ganda Points: 12
Offline Offline

Gender: Female
Posts: 199


aw!


WWW
« Reply #85 on: February 09, 2010, 08:29:29 PM »

hehehe ano  ba gamit mo sister? M23 ba? bakit yung saken auto-detect ang baud rate? hindi ko na isini-set kahit ang speed ko 9600,14400,19200,115200 nadi-detect ng M23 ko.  Wink

ganun ba? m23 din gamit ko..

panu naman nangyari yun?

kasi dati di ko sinet eh.. ayaw magreply yung gsm..
Logged

Resistance is futile (if <1 ohm)
Co0LėT♥
Hydroelectric
***

Pogi/Ganda Points: 368
Offline Offline

Gender: Female
Posts: 3330



« Reply #86 on: February 09, 2010, 08:34:39 PM »

page 156

Recommended default setting
It is recommended that the default for this parameter be the automatic detection setting (0),
which facilitates initial DTE-DCE communications.
Information examples
-Initial the HyperTerminal
-Initial the MS
-AT Command
AT+IPR=?
+IPR:(),(75,150,300,600,1200,2400,4800,7200,9600,14400,19200,28800,33900,38400,
57600,115200)
OK
AT+IPR?
+IPR: 115200
OK
DTE-DCE character framing (+ICF)
Table: Syntax (+ICF)
Command Possible response(s)
+ICF=[<format>[,<parity>]]
+ICF?
+ICF:<format>,<parity>
+ICF=?
Logged

Simpler designs are usually better.
freakything
Size C Battery
*****

Pogi/Ganda Points: 12
Offline Offline

Gender: Female
Posts: 199


aw!


WWW
« Reply #87 on: February 09, 2010, 09:56:48 PM »

waaaaaa.. yeah yeah..

nagtataka nga ako kung bakit 0 lagi yung ipr niya.. hehe.

Logged

Resistance is futile (if <1 ohm)
freakything
Size C Battery
*****

Pogi/Ganda Points: 12
Offline Offline

Gender: Female
Posts: 199


aw!


WWW
« Reply #88 on: February 11, 2010, 02:14:38 PM »



anu ba ang mali kung ganito ang nakikita namin sa hyperterminal..?

hindi at-commands.
Logged

Resistance is futile (if <1 ohm)
tiktak
Gas Turbine
**

Pogi/Ganda Points: 180
Offline Offline

Gender: Male
Posts: 2598



WWW
« Reply #89 on: February 11, 2010, 02:23:34 PM »

hindi tugma baud rate
Logged

Bakit andaming hindi marunong gumamit ng search?Huh
freakything
Size C Battery
*****

Pogi/Ganda Points: 12
Offline Offline

Gender: Female
Posts: 199


aw!


WWW
« Reply #90 on: February 11, 2010, 08:25:28 PM »

owkay na.. hehehe.. Cheesy

thanks richard..
Logged

Resistance is futile (if <1 ohm)
mye♥
Size AAA Battery
***

Pogi/Ganda Points: 32
Offline Offline

Gender: Female
Posts: 54



« Reply #91 on: February 13, 2010, 12:58:55 PM »

subscribing... Cheesy

need ko pag-aralan to, wala pa talaga ako idea..
Logged

♥♥♥
Co0LėT♥
Hydroelectric
***

Pogi/Ganda Points: 368
Offline Offline

Gender: Female
Posts: 3330



« Reply #92 on: February 19, 2010, 03:33:38 PM »

Update lang... tested in Proteus using BenQ M23


Part 1 of 2
Code:
'****************************************************************
'*  Name    : BenQ.BAS                                          *
'*  Author  : Coolet                                            *
'*  Notice  : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 02/17/2010                                        *
'*  Version : 1.0                                               *
'*  Notes   : Proton V3.4.0.8                                   *
'*          : IDE V 2.0.0.5                                     *
'****************************************************************
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    '
' Device Programming Options
' --------------------------
'
Device 16F628                ' We are using a PIC16F628 (18PIN SMD)
Declare Xtal = 20            ' And a 20MHz crystal
Declare Reminders OFF
    Config HS_OSC , WDT_OFF , PWRTE_ON , BODEN_OFF , LVP_OFF , CP_OFF , MCLRE_OFF
Declare Reminders On
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

'
' Hardware Assignments
' --------------------
'
   
    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $24 ' Enable transmit, BRGH = 1
    SPBRG = 129 ' 9600 Baud @ 20MHz, 0.16%
    Hserial_Clear=On

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    '
' RAM Assignments and Variables
' -----------------------------
'
Dim Reply    As Bit   ' Phone Reply status
Dim Compare    As Bit ' Use for 8byte data comparison
Dim ArmedFlag          As Bit   ' Use to inform micro is Alarm is Armed or Disarmed
Dim VarX    As Byte ' Global variable
Dim SMSLength    As Byte ' Length of sms
Dim VarY               As Byte  ' Global variable
Dim VarZ    As Byte ' Global variable
Dim Address    As Byte  ' Onboard eeprom Address
Dim DataLength    As Byte  ' Use for tracking 1st character
Dim DataBuffer[8]    As Byte ' Extracted 8 byte storage
Dim MobileBuffer[12]   As Byte ' Mobile phone storage
Dim GlobalBuffer[120]  As Byte ' Sms storage & General storage

' PIN assignment
Symbol Sensor1    = PORTA.1   ' Any Sensor  and any port you like
Symbol Relay1      = PORTA.3   ' Any Port you like
Symbol PWON        = PORTA.2   ' Any port you like
'
' Program Constants
' -----------------
'
    Symbol CR            =    13   ' Carriage Return
Symbol LF            =    10   ' Line Feed
Symbol CTRL_Z        =    26   ' Control + Z key
Symbol Err           =    0    ' As in Error
Symbol OK            =    1    ' I'm fine
Symbol Equal         =    1    ' As in Equal
Symbol NotEqual      =    0    ' As in not Equal
Symbol NoMessage     =    0    ' No Message in Memory Location 1

    DelayMS 500                    ' Half seconds delay  for Pic to initialized
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
; ------------------ added code ---------------------------------
    '
'
' Stored Data to onboard Eeprom at program time
'
' 00 TO 11 ................ 12 BYTES USER MOBILE PHONE NUMBER STORAGE
' 12 TO 19 ..."9359A402"... 8 BYTES USER COMMAND ID IN PDU MODE "COOLET" DEFAULT PASSWORD
' 20 TO 27 ..."33286D02"... 8 BYTES USER COMMAND ID IN PDU MODE "DISARMED ALARM" 
' 28 TO 35 ..."99416913"... 8 BYTES USER COMMAND ID IN PDU MODE "ARMED ALARM"
' 36 TO 43 ..."053D8D46"... 8 BYTES USER COMMAND ID IN PDU MODE "RELAY OFF"
' 44 TO 51 ..."98053D9D"... 8 BYTES USER COMMAND ID IN PDU MODE "RELAY ON"

EData 0,0,0,0,0,0,0,0,0,0,0,0,"9359A402","33286D02","99416913","053D8D46","98053D9D"
; ------------------ added code ---------------------------------


'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~MAIN PROGRAM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   
START:
Clear                         ' Reset Ram
High PWON                     ' Turn on BenQ   (Via transistor)
DelayMS 200                   ' BenQ needs at least >150mS pulse to power on, Lets give it 200mS
Low PWON                      ' Set to low
INITIALIZED:
   ; Lets wait to GSM to read the SIM
   HSerOut ["AT$SRN=1",CR]
   HSerIn 1000,DIDTOY,[Str GlobalBuffer]
DIDTOY:
   ; $SRN: READY
   If GlobalBuffer[15] = "$" Then 
'      HSerOut [Str GlobalBuffer,13,10]
      GoTo CONNECT 
   EndIf       
   GoSub CLEAR_BUFFER
   GoTo INITIALIZED   
   
'     Mobile Auto Detection 
   
CONNECT:    
GoSub SEND_AT_COMMAND       ' Check for Phone activity
' HSEROUT ["helo WORLD",13,10]
If Reply = OK Then          ' Yes! Phone found!
   Inc VarX                 ' Let's check again to be sure connector...
       If VarX > 3 Then         ' ... is properly fixed! Try 3x
          GoSub DELETE_IT       ' Delete 1st 2 memory location
          Clear VarX            ' Reset counter
          DelayMS 1000          ' Wait
          GoSub PDU_MODE        ' Set to PDU Mode
          GoTo MAIN_LOOP        ' Bye! Ready for action
       EndIf                    ' End of statement
    Else                        ' Otherwise
       DelayMS 3000             ' Rest for 3Secs   
    EndIf                       ' End of statement
    GoTo CONNECT                ' Check the phone again

MAIN_LOOP:
       '
   ' Let's see if a new message arrive
   '    
   ' Phone reply if no message(ONLINE): +CMS ERROR: 321 (without "OK")
   ' Variable REPLY always contains ERR. It will change only
   ' when it detects "OK".
   '
   '   
GoSub READ_GSM ' Check Inbox for new message
   '
   '   No message or message too long
   '   this is one method of filtering incomming messages specially
   '   when the networth send you a promotional messages
   ' 
   '   
    If Reply = Err Then SCAN_SENSOR ' Check Sensor activity      
         
If SMSLength > 118 Then    ' If message too long then...
   GoSub DELETE_IT     ' ... delete it.
    EndIf          ' End of statement

   


; ------------------ added code ---------------------------------
       ' 
       '    Extract last 8 byte of recieved message in pdu format
   '    and store it in DataBuffer
   '
DataLength = 16      ' Set the Data Lenght
GoSub TRACK_1ST_CHAR    ' Find it!
; Now VarX has the location of 1st character
Clear VarY         ' Clear counter        
    Repeat          ' Make another loop
       DataBuffer[VarY]=GlobalBuffer[VarX]       ' Store data
   Inc  VarY : Inc VarX          ' Increment array counter
Until VarY = 8              ' Finish the job
GoSub COMPARE_8BYTE_DATA ' Compare Data for posible command
GoSub PDU_MODE ' Set Phone to PDU Mode
GoTo MAIN_LOOP ' Go back to main loop
; ------------------ added code -------------------------------



   
SCAN_SENSOR:
     '
     ' Your sensor monitoring here    
     '
     ' if any abnormalities then send a message
    If Sensor1 = 1 Then
       GoSub CLEAR_BUFFER
       Str GlobalBuffer = "Sensor 1 Activated"
       GoSub SEND_MESSAGE
    EndIf   
       
    GoTo MAIN_LOOP
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BEGIN_COMPARE: 'RETRIEVE_EEPROM_DATA:
      '
  '   First we will check the sender mobile number if valid
  '   if not valid go direct to delete-it and go back to main_loop
  '
    Clear VarX              ' Point to Address 0  of onboard eeprom
      Repeat            ' Make a loop as dictated by VarX
      If ERead VarX <> MobileBuffer[VarX] Then ' Compare Mobile number
         GoTo DELETE_IT        ' Delete message if not valid
      EndIf    ' End of statement
  Inc VarX    ' Increment counter
  Until VarX = 12    ' Finish The Job 

RETRIEVE_EEPROM_DATA:
  '     
  '   Next we will retrieve the eeprom data and store it to GlobalBuffer for comparison
  '
GoSub READ_EEPROM
      '
  '   Then let's Compare the extracted last 8byte (PDU FORMAT) which was previously
  '   stored in DataBuffer to GlobalBuffer (Now holding the eeprom data)
  '  
Compare = Equal : Clear VarX               ' Set Initial value
    Repeat             ' Make a loop as dictated by VarX
     If GlobalBuffer[VarX] <> DataBuffer[VarX] Then ' Compare data
        Compare = NotEqual       ' Clear if not Equal
        Return         ' Bye!
     EndIf   ' End of statement
Inc VarX   ' Increment counter
Until VarX = 8   ' Finish the job
  '
  ' Here the result Comparison is Equal
  ' So lets clear the GlobalBuffer for acknowledgement
  '
GoSub CLEAR_BUFFER          ' Clear GlobalBuffer
Return    

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

COMPARE_8BYTE_DATA:
   '
       '    This lines are in  text mode except when commented
   '
   ' Lets extract first the sender mobile number in text mode
   ' and store it to MobileBuffer
   '
       '  Here is the received message in text mode after executing HSEROUT ["AT+CMGR=1",CR]
   '  HSERIN 1000,MESSAGE_TIMEOUT,[WAIT(CR,CR,LF),STR GlobalBuffer]
 
   '  CR = CARRIAGE RETURN - LF = LINE FEED
   '
       '           111111111122222222223333333333444444444455555555 5 566666666 6 6 7 777 7 777..
       ' 0123456789012345678901234567890123456789012345678901234567 8 901234567 8 9 0 123 4 567..
       ' +CMGR: "REC READ","944502414110","BONI SATO","10/02/18,13:56:53+18",145,4,0,0,"966505031999",145,6
   '
   '  We can then see the exact location of phone number starting at array 20
   '
    GoSub TEXT_MODE                          ' Set Phone to TEXT Mode
GoSub READ_GSM                           ' Read Phone Memory 1
    Clear VarY          ' Clear the counter
    VarX = 19      ' Point to 1st number

    Repeat     ' Make a loop as dictated by SMSLength    
   MobileBuffer[VarY]=GlobalBuffer[VarX] ' Store it to MobileBuffer
   Inc VarX:Inc VarY   ' Increment counters
    Until VarY = 12      ' Finish the job

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Logged

Simpler designs are usually better.
Co0LėT♥
Hydroelectric
***

Pogi/Ganda Points: 368
Offline Offline

Gender: Female
Posts: 3330



« Reply #93 on: February 19, 2010, 03:34:28 PM »

Part 2 of 2

Code:
   '
   '    So far we have all the needed data ready to check...
   '
   '    Check if DataBuffer  is "COOLET" Default
   ' This will save your mobile number to onboard eeprom
   ' Eeprom Data = "9359A402"
   '     
Address = 12                              ' Point to Eeprom Address
GoSub RETRIEVE_EEPROM_DATA   ' Retrive eeprom data & Compare it
If Compare = NotEqual Then COMPARE_1A   ' Decide!
   
Clear Address   ' Clear Address 
Clear VarX   ' Clear counter
    Repeat   ' Make a loop as dictated by VarX
       EWrite Address , [MobileBuffer[VarX]] ' Save mobile number
       DelayMS 50              ' Wait
       Inc Address   ' Increment Address
   Inc VarX   ' Increment Pointer
    Until Address = 12   ' Finish the job   
Str GlobalBuffer="OK! YOUR NUMBER SAVE"   ' Prepare the message to be send
GoTo SEND_MESSAGE
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
COMPARE_1A:
        '
    '    Check if DataBuffer  is "DISARMED ALARM"
' This will  disArmed the alarm if sender mobile number is valid
' Eeprom Data = "33286D02"
'   
Address = 20                            ' Point to Eeprom Address
GoSub BEGIN_COMPARE ' Compare it
If Compare = NotEqual Then COMPARE_1B ' Decide!
ArmedFlag = 1                           ' This only example you have to manipulate your own code
Str GlobalBuffer="OK! ALARM DISARMED"   ' Prepare the message to be send
GoTo SEND_MESSAGE ' Write and send message at once!
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
COMPARE_1B:
       '    Check if DataBuffer  is "ARMED ALARM" in pdu mode
   ' This will Armed the smart SmartCarBuddy if sender mobile number is valid
   ' Eeprom Data = "99416913"
   ' 
Address = 28                            ' Point to Eeprom Address
GoSub BEGIN_COMPARE       ' Compare it
If Compare = NotEqual Then COMPARE_1C ' Decide!
    ArmedFlag = 0                           '
Str GlobalBuffer="OK! ALARM ARMED"      ' Prepare the message to be send
    GoTo SEND_MESSAGE     ' Write and send message at once!
       
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
COMPARE_1C:
       '
       '    Check if DataBuffer  is "RELAY OFF"
   ' This will  diactivate relay if sender mobile number is valid
   ' Eeprom Data = "053D8D46"
   '
Address = 36                            ' Point to Eeprom Address
GoSub BEGIN_COMPARE ' Compare it
If Compare = NotEqual Then COMPARE_1D ' Decide!
Low Relay1           ' Deactivate relay
Str GlobalBuffer="OK! RELAY OFF"        ' Prepare the message to be send
GoTo SEND_MESSAGE                       ' Write and send message at once!
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
COMPARE_1D:
        '
'    Check if DataBuffer  is "RELAY ON"
' This will activate the relay if sender mobile number is valid
' Eeprom Data = "98053D9D"
'   
Address = 44                            ' Point to Eeprom Address
GoSub BEGIN_COMPARE ' Compare it
If Compare = NotEqual Then DELETE_IT ' Decide!
High Relay1         ' Activate onboard relay
Str GlobalBuffer="OK! RELAY ON"         ' Prepare the message to be send
GoTo SEND_MESSAGE     ' Write and send message at once!
       
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DELETE_IT:
       '
   '    DELETE MEMORY LOCATION 1 TO 4 OF SM
   '
DelayMS 1000              ' Go and take a nap
HSerOut ["AT+CMGD=1;+CMGD=2",CR] ' Delete Phone memory 1 & 2
DelayMS 2000      ' Wait Phone to finish the job
Return ' Bye!
 
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'
    ' Check gms if present
'
SEND_AT_COMMAND:
    GoSub CLEAR_BUFFER          ' Prepare Array
HSerOut ["AT",CR]     ' Check ONLINE connection
    GoSub GET_REPLY      ' Check the responce of Phone
    Return ' Bye!

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PDU_MODE:
       '
       '    Instruct the phone to use Text Mode  
       '
   '    CR = 13 CARRIAGE RETURN
   '
HSerOut["AT+CMGF=0",CR]                    ' Send AT COMMAND
Return ' Bye!

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TEXT_MODE:
       '
       '    Instruct the phone to use TEXT Mode
       '
   '    CR = 13 CARRIAGE RETURN
   '
HSerOut ["AT+CMGF=1",CR]                        ' Send AT COMMAND
Return                     ' Bye!

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CLEAR_BUFFER:
    Clear Address   ' Clear Address
  Repeat   ' Make a loop as dictated by Address
    GlobalBuffer[Address] = 0 ' Clear Array
    Inc Address     ' Increment Address
  Until Address = 120 ' Finish the job!
    Return   ' Bye!
           
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'
'    Track the first character of passcode
'
'    Here is the received message in PDU mode after executing HSEROUT ["AT+CMGR=1",CR]
'    HSERIN 1000,MESSAGE TIMEOUT,[WAIT(CR,CR,LF),STR GlobalBuffer]
'
' CR (*)= CARRIAGE RETURN ; LF (^) = LINE FEED
'
'            11111111112222222222333333333344444444445555555555666666666677777777778888888888999 
'  012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012 
'  +CMGR: 1,,26*^0791695650309299040C9169562014100600004090611132602107D0E493F904C500*^*^OK*^###
'
'  In this case if the datalenght is 16, VarX will point to array number 74 which is
'  the first data we need.
'
'  I came to this idea of tracking the 1st character of USER-DATA, because
    '  PDU format varies in length depends upon the incomming messages.
'  Otherwise we can point directly to the exact location of the 1st charater.
'
TRACK_1ST_CHAR:
    Clear VarX                               ' Clear  VarX
Repeat                                   ' Make a loop
       Inc VarX                              ' Increment VarX
Until GlobalBuffer[VarX+DataLength]="#" ' Look for "#" character
Return

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

READ_EEPROM:
Clear VarX                                  ' Point to Address 0 of eeprom
Repeat                                      ' Make a loop as dictated by DataLength
    GlobalBuffer[VarX] = ERead Address      ' Store Eeprom data to GlobalBuffer
    Inc VarX:Inc Address                    ' Increment Address
Until VarX = DataLength +1                  ' Finish the job
Return     ' BYE!

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BURN_EEPROM:
    Repeat                                     ' Make a loop as dictated by DataLength
EWrite Address,[GlobalBuffer[VarX]] ' Save new passcode in txt mode
        Inc Address        ' Increment Address
Inc VarX     ' Increment pointer
        DelayMS 50                ' Wait    
Until VarX = DataLength +1     ' Finish the job
    Return     ' Bye!

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

READ_GSM:       
       '    Let's Mask the GlobalBuffer first
       '
       '    Insted of clearing the array, we will fill it with "#" character.
       '    This is one way of tracking the end of line and for tracking the "OK"...
       '    ... returned by the phone.
       '
       '
Clear VarX        ' Clear counter VarX
    Repeat    ' Make a loop as dictated by VarX
       GlobalBuffer[VarX]="#"  ' Fill array with "#" character
       Inc VarX    ' Increment counter
    Until VarX = 120    ' Finish the job
DelayMS 50                 ' Wait
       '
   '
       ' Read memory location 1 of the phone sim card 
       '
   '    CR = 13 CARRIAGE RETURN
   '
HSerOut ["AT+CMGR=1",CR]      ' Read memory location 1

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
GET_REPLY:
       '
       '    Wait for CR,CR & LF before storing data
       ' When no more data, exit to "TIMEOUT" label
       '
    HSerIn 1000,TIMEOUT,[Wait(CR,CR,LF),Str GlobalBuffer] 
TIMEOUT:
       '
       '    Let's see now if a message is present at memory location 1
       ' Phone will return "+CMS ERROR: 321" if no message and obviuosly "OK"
       '    if the memory is loaded.
       '    SMSLength will determine the lenght of the message
Reply = Err : Clear SMSLength                   ' Set Initial value
    Repeat                                      ' Make a loop as dictated by SMSLength     
      If GlobalBuffer[SMSLength]="O" Then ' Sort ASCII "O"
         If GlobalBuffer[SMSLength+1]="K" Then  ' Sort ASCII "K"
             Reply = OK                         ' Set if True
'              HSEROUT ["OK",13,10]               ' FOR TEST ONLY
             Return                             ' Bye if True
         EndIf                                  ' End of 2nd statement
      EndIf                                     ' End of 1st statement
    Inc SMSLength                               ' Increment Array pointer
    Until SMSLength = 120                       ' Finish the job
Return                                          ' Bye!

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SEND_MESSAGE:
       ' AT+CMGS=" PHONE NUMBER " <CR> 
       ' HELLO <CTRL+Z>
       '
       ' CTRL_Z= Control + Z
       ' 34 is character "
   ' CR = 13 CARRIAGE RETURN
   
    HSerOut ["AT+CMGS=",34,Str MobileBuffer,34,CR] ' Send phone number to BenQ
    DelayMS 2000                                   ' Wait 1 sec
    HSerOut [Str GlobalBuffer\21,CTRL_Z]           ' Send the Message
    DelayMS 3000                                   ' Wait Phone to process the job     
GoTo DELETE_IT                                 ' Again clean SIM mem 1 & 2     

Logged

Simpler designs are usually better.
Kaizer03
Nuclear Reactor
****

Pogi/Ganda Points: 219
Offline Offline

Posts: 4624


C#<-->Android<-->Java


WWW
« Reply #94 on: February 19, 2010, 03:56:55 PM »

^

sis ano ang pinagkaiba sa previous? =)

yung baudrate at Timeout lang ba?=)
Logged

Lend a hand for those who are in need!=)

Stop Hijacking!=) More Technical Posts!=)
DataSheets are enough to answer your questions! Wink

Kaizer Killer EX Pre-Alpha
Co0LėT♥
Hydroelectric
***

Pogi/Ganda Points: 368
Offline Offline

Gender: Female
Posts: 3330



« Reply #95 on: February 19, 2010, 04:10:09 PM »

Tama sis baud at timeout saka yong extracting ng sender number.

1. Added AT$SRN AT command
2. added complete data in onboard eeprom and comparison ng data receive. bali kumpeto recado na yan hehehe.
Logged

Simpler designs are usually better.
conime.exe
CR2032 Battery
**

Pogi/Ganda Points: 0
Offline Offline

Posts: 22


« Reply #96 on: February 23, 2010, 09:48:34 PM »

elow po ms. coolet,
uhm, ggmit din po kmi ng benq m23 sa thesis nmin tpoz mikrobasic ggmitin nmin. panu q poh ba xa ggwin pag mikrobasic? aun po, dq po xe  alam kung panu xa ggwin at iinterface sa pic.. :-(

any help would be very much appreciated...<3

salamat po ng marami at God Bless.


Logged
maldihtah13
Technical People
Nuclear Reactor
*****

Pogi/Ganda Points: 114
Offline Offline

Gender: Female
Posts: 4499


Everyday is a learning process so try to learn ;D


WWW
« Reply #97 on: February 24, 2010, 05:22:30 AM »

almost same din ng program ni sis coolet itranslate mo lang yung ibang syntax.
Logged
conime.exe
CR2032 Battery
**

Pogi/Ganda Points: 0
Offline Offline

Posts: 22


« Reply #98 on: February 24, 2010, 11:58:16 AM »

ukey po.thanks po sa pagreply ms. maldihtah13...
Logged
conime.exe
CR2032 Battery
**

Pogi/Ganda Points: 0
Offline Offline

Posts: 22


« Reply #99 on: February 26, 2010, 08:53:38 PM »

uhm...hello po ulet... aun poh..dq poh xa ma translate eh...
haist...pde po bang manghingi ng tulong..

uhm, cnu pong nkapag interface na ng pic16F877a sa benq m23 gsm module gamit ang mikrobasic, pde nio po ba qng tulungan?

x_x kahit sample lng poh ng cmula na nkakapag send at nkakakaread ng mga txt message..

hay,bibigyan q po keo ng 1 milyon... 1 MILYONG PASASALAMAT GALING SA PUSO. :-)
maapreciate q poh lahat ng suggestions.aun poh.. thesis din eh. o_0.

apir sa mga nakakarelate. =))

kya nten toh. <3 ASTIG ANG PINOY EH.

Sincerely,

conime.exe








 



Logged
The Philippine Electronics and Technology Forum
   

 Logged
Pages: 1 ... 3 4 [5] 6 7 ... 48   Go Up
  Print  
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
ATTENTION: All "Size C", "Size D", "Lead Acids" and "Diesel Generators" members « 1 2 3 »
Contest and Prizes
Ate Shey 54 7485 Last post July 27, 2011, 01:46:14 AM
by enriz622
anong difference ng PIC na may suffix na "A" sa part# sa walang "A"
PIC Microcontrollers
'yus 12 1828 Last post February 08, 2012, 08:22:31 PM
by Hotguy
"4 wheeled car LINE FOLLOWER" " the tracks are black and white only" « 1 2 »
Mechatronics and Robotics
eugene 26 3987 Last post September 19, 2008, 11:30:24 AM
by maldihtah13
Thesis project ( hELP US) sa "statement of the problem" at "hypothesis"
Thesis and Project Proposal
jennylyn 3 1970 Last post December 04, 2009, 12:12:48 PM
by thesisworks
DO NOT POST "Paid To Click", Pay to Surf and other "Pay To" Sites on this forum
Money Talk
Ate Shey 1 282 Last post August 14, 2011, 09:26:09 AM
by Quw3rTii
DO NOT POST "Paid To Click", Pay to Surf and other "Pay To" Sites on this forum
Chit Chat
Ate Shey 3 299 Last post April 07, 2012, 09:20:30 PM
by glutnix_neo
GSM MOdule Sim900d of Egismo connecting to Pic16f900d please help...............
PIC Microcontrollers
monarjay11 4 345 Last post January 09, 2012, 06:10:42 AM
by monarjay11
Powered by MySQL Powered by PHP Powered by SMF 1.1.15 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!