Forum Replies Created
-
AuthorPosts
-
Amy
Participanthi i’ve been tying to create a new program but it’s not working properly in proteus… i used PROTON IDE.. basic language THANK YOU AGAIN
‘****************************************************************
‘Home Automation controlled by Android Mobile Phones
‘****************************************************************
Device 16F877A ‘define device used
Declare Xtal = 4 ‘define oscillator used
‘****************************************************************
‘define configuration word bits
Declare Reminders OFF
Config XT_OSC,WDT_OFF,PWRTE_ON,BODEN_OFF,LVP_OFF,CP_OFF,DEBUG_OFF
Declare Reminders On
‘****************************************************************
‘assign values to serial communication
Hserial_Baud = 9600 ‘set BAUD rate to 9600 BAUD
Hserial_Clear = On
‘****************************************************************‘set port assignments 1-input ; 0-output
TRISB = %00000000 ‘set all PORTB as outputs
TRISA = 0
TRISC = 0
‘****************************************************************
‘microcontroller declarations
RCSTA = $90 ‘ 10010000 Enable serial port & continuous receive
TXSTA = $24 ‘ 00100100 Enable transmit, BRGH = 1
‘SPBRG = 25 ‘ 9600 Baud @ 4MHz, 0.16%
ADCON1 = 7 ‘disables ADC
CMCON = 7 ‘disables Comparators
T1CON = $01 ‘00000001, 1:1 prescale value, enable TMR1
PIR1.0 = 0 ‘must be cleared: TMR1 overflow interrupt flag bit
PIE1 = $01 ‘enable TMR1 overflow interrupt
‘****************************************************************
‘program constants
‘assigned string values will be used instead of actual port assignments
‘for more convenient programming
Symbol app1 = PORTB.0
Symbol app2 = PORTB.1
Symbol app3 = PORTB.2
Symbol app4 = PORTB.3
Symbol app5 = PORTB.4
Symbol app6 = PORTB.5
Symbol app7 = PORTB.6
Symbol app8 = PORTB.7
Symbol mnum = 09157003397
‘****************************************************************
‘program variables
‘variables for global time
Dim SMS As Byte
‘Str mnum = “09157003397”,0
Clear ‘clear all RAM contents at startup
‘****************************************************************
‘initialize comm to GSM Module
gsm:
HSerOut [“AT”] ‘start serial communication
‘HSerIn 5000,sms ‘wait for GSM Module response OK
HSerOut [“AT+CFUN=1”]
DelayMS 2000
HSerOut [“AT+CMGF=1”] ‘set text mode
DelayMS 2000
HSerOut [“AT+CNMI=1,1,0,0,0”]
DelayMS 2000
‘****************************************************************
main:
While 1
HSerIn 5000,
HSerOut[“AT+CMGR=”,SMS]
DelayMS 2000
‘Hserin [“+CMGR”,SMS]
GoSub execute
‘GoSub deleteSMS
Wend
‘****************************************************************
execute:
If SMS = 10 Then
PORTB.0 = 1
GoSub replyOnSMS
EndIf
If SMS = 11 Then
PORTB.1 = 1
GoSub replyOnSMS
EndIf
If SMS = 12 Then
PORTB.2 = 1
GoSub replyOnSMS
EndIf
If SMS = 13 Then
PORTB.3 = 1
GoSub replyOnSMS
EndIf
If SMS = 14 Then
PORTB.4 = 1
GoSub replyOnSMS
EndIf
If SMS = 15 Then
PORTB.5 = 1
GoSub replyOnSMS
EndIf
If SMS = 16 Then
PORTB.6 = 1
GoSub replyOnSMS
EndIf
If SMS = 17 Then
PORTB.7 = 1
GoSub replyOnSMS
EndIf
If SMS = 21 Then
PORTB.1 = 0
GoSub replyOffSMS
EndIf
If SMS = 22 Then
PORTB.2 = 0
GoSub replyOffSMS
EndIf
If SMS = 23 Then
PORTB.3 = 0
GoSub replyOffSMS
EndIf
If SMS = 24 Then
PORTB.4 = 0
GoSub replyOffSMS
EndIf
If SMS = 25 Then
PORTB.5 = 0
GoSub replyOffSMS
EndIf
If SMS = 26 Then
PORTB.6 = 0
GoSub replyOffSMS
EndIf
If SMS = 27 Then
PORTB.7 = 0
GoSub replyOffSMS
EndIf
‘***************************************************************
End
‘***************************************************************
‘subroutines
deleteSMS:
HSerOut [“AT”]
DelayMS 2000
HSerOut [“AT+CMGD=”,SMS]
DelayMS 2000
Return
‘***************************************************************
replyOnSMS:
HSerOut [“AT”]
DelayMS 2000
HSerOut [“AT+CMGS=”,mnum]
‘ Write = Your appliance is ON
DelayMS 2000
Return
‘***************************************************************
replyOffSMS:
HSerOut [“AT”]
DelayMS 2000
HSerOut [“AT+CMGS=”,mnum]
‘ Write = Your appliance is OFF
DelayMS 2000
Return
‘***************************************************************Amy
Participanthi sir nidhin. k,, can i ask if we will connect the GSM modem to the PIC16f877a without a computer, will we use RS232?? thank you
Amy
Participantthank you again nidhin.k.. our project is like this only the phone that we will use will be notify that the command has been executed.. in that command we will use AT+CMGS??
Amy
Participantnidhin.k thank you again.. you’ve been so helpful in our project.. i have another question.. can i directly connect the GSM’s rx and tx to my PIC(PIC16f877a). i will not use rs232.. thank you again
Amy
Participanthi nidkin.k,, can i ask where is the command that says that the PIC already recieved the SMS from the phone?? also where is the command in the program were in the GSM modem decodes the SMS? thank you very much
)
Amy
Participanthi nidgin.k,, can i ask where is the command that says that the PIC already recieved the SMS from the phone?? also where is the command in the program were in the GSM modem decodes the SMS? thank you very much
)
Amy
Participanthi nidhin.k,, is this program for PIC16f877a and what if we will not use LCD?? just the PIC and GSM.. thanks you very much
Amy
Participantwhere can i create this program? MPLAB or Micro C? thanks
Amy
Participantnidhin.k,, thank you for the codes
what if we will not use LCD??
Amy
Participanthi M. Khalil,, our project is to control the on/off of ligths and appliances. we will send message to the gsm modem an then the gsm is the one that is connected to the PIC16f877a. after that the PIC is connected to the relays that is connected to the appliances or ligths. after that the gsm will send a message to the phone that the command has been executed. its as if it will upadate the phone that this particular applaince is turned on… we will not use lcd. just the phone, GSM modem and the PIC…
we are having a difficult time in the programming part
Amy
ParticipantHi sir, i somehow have a similar project. we are planning to use GSM and pic16f877a… our problem is the program in interfacing the gsm with the PIC.. thank you very much
-
AuthorPosts