writing master number in eeprom for sms controler simple example


Closed Thread
Results 1 to 1 of 1
  1. #1
    Join Date
    Mar 2009
    Posts
    48

    Default writing master number in eeprom for sms controler simple example

    here is a simple example, not so optimized , how to set up a master number for sms controller...hope someone find this usefull!!!
    Code:
    '
    'pic defines
    '------------------------------------------------------------------------
    	@ DEVICE pic16F887, WDT_OFF        ' Watchdog Timer
    	@ DEVICE pic16F887, PWRT_ON        ' Power-On Timer
    	@ DEVICE pic16F887, MCLR_ON        ' Master Clear Options (Internal)
    	@ DEVICE pic16F887, BOD_ON         ' Brown-Out Detect
    	@ DEVICE pic16F887, LVP_OFF        ' Low-Voltage Programming
    	@ DEVICE pic16F887, CPD_OFF        ' Data Memory Code Protect
    	@ DEVICE pic16F887, PROTECT_OFF    ' Program Code Protection
    '
    '
    '------------------------------------------------------------------------
    
    eeprom 128,["MP"]
    .
    .
    .
    '
    'wait for sms
    '-------------------------------------------------------------------------
    HSERIN 5000,ws,[WAIT("REC UNREAD"),skip 3,str telbr\12,skip 12,str TIME\6,skip 8,STR PORUKA\3\13]'trazi, cekaj unread
    pause 3000
    
    FOR h=128 TO 129'read out command from eeprom
    READ h,tbr[H]
    NEXT h
    
    flag=1
    FOR h=0 to 1  
        if poruka[h+1]<>tbr[h+128] then flag=0 'check the command message
    next h
    
    if flag=1 then gosub s6  'go and write last 4 numbers in eeprom
    
    
    '
    ' CHECK THE USER FOR EVERU SMS COMMAND
    '-------------------------------------------------------------------
    
    
    FOR y=48 TO 51
    READ y,telbrmp[y]
    NEXT y
    lcdout $FE,1,"x","x",telbrmp[48],telbrmp[49],telbrmp[50],telbrmp[51]
    pause 1000
    
    
    broj=1
    for x=8 to 11
       if TELBR[x]<>TELBRmp[x+40] then broj=0
    next x
    lcdout $FE,$c0,"x","x",TELBR[8],TELBR[9],TELBR[10],TELBR[11]
    pause 2000
    
    IF broj=0 then gosub s4 ' if the numebers dont fit send sms no right's
    
    s6:
    FOR x=8 TO 11
    WRITE x+40,telbr[x]'upisi master broj u eeprom
    NEXT x
    lcdout $FE,1,"YOUR MASTER NMB"
    LCDOUT $FE,$C0,"+38761XX",TELBR[8],TELBR[9],TELBR[10],TELBR[11]
    PAUSE 2000
    lcdout $fe,1
    return
    
    s4:
                LCDOUT $FE,1,"nemate prava!"
            HSerout ["AT",13,10]
                Pause 1000
            HSerout ["AT+CMGF=1",13,10] 'Postavi Text Mode
                Pause 1000    
            HSerout ["AT+CMGS=",34,str telbr\12,34,",129",13,10]
                pause 500
            HSerout ["nemate prava",str time\6,13,10]
                s12:
                HSerout [26]
                hserin 6000,s12,[WAIT("OK")]
    Last edited by xxxxxx; - 21st May 2009 at 02:00.

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 15:46
  2. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 04:17
  3. How to write/read strings EEPROM/LCD
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 11th February 2007, 07:26
  4. I2CWRITE writing Strings to EEPROM
    By NavMicroSystems in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 27th March 2005, 20:45
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 20:59

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts