i used pic16f873..nokia modem n30..lcd 2x16..3 sensors which give an input to pic +5V. this 3 sensor connected to portA from portA 0-2.rx and tx connected to max232 and used 4.5Mhz Crystal with 33pF capacitor. the LCD pins which are E connected to RB0, RS to RB3, DB4 to RB4, DB5 to RB5, DB6 to RB6, and DB7 to RB7.
well..my project do like this..if sensor 1,2,and 3 detect it will give an input to pic and LCD will diplay a message and nokia modem will send sms text message to specific phone number. well below is my program and it didnt work..the LCD didnt display anything and the modem didnt send any message.someone please help which part is wrong..
Pause 1000
DEFINE LCD_DREG PORTB 'Define PIC port used for LCD data line
DEFINE LCD_DBIT 4 'Define first pin of portC connected to LCD DB4
DEFINE LCD_RESREG PORTB 'Define PIC port used for RS line of LCD
DEFINE LCD_RSBIT 3 'Define PortC pin used for RS connection
DEFINE LCD_EREG PORTB 'Define PIC prot used for E line of LCD
DEFINE LCD_EBIT 0 'define the 3 bit communication
DEFINE LCD_LINES 2 'Define using a 2 line LCD
DEFINE LCD_COMMANDUS 2000 'define delay between sending LCD commands
DEFINE LCD_DATAUS 50 'Define delay time between data sent
DEFINE OSC 4
DEFINE HSER_TXSTA 20h
DEFINE HSER_RCSTA 90h
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1
GSMBUFFER VAR BYTE[16]
Caller VAR BYTE[13]
GSMTime VAR BYTE[17]
Init:
trisa = %11111111 'set portA-RA1 input
porta = %00000000 'set portA high to give an input sensor
SEN1 :
if portA.0 = 0 then SEN2 'If sensor 1 dont detect then jump to SEN2
if portA.0 = 1 then LCD1 'Sensor at level1 detect then go to LCD 1
goto SEN1
SEN2 :
if portA.1 = 0 then SEN3 'If sensor 2 dont detect then jump to SEN3
if portA.1 = 1 then LCD2 'Sensor at level2 detect then go to LCD2
goto SEN1
SEN3 :
if portA.2 = 0 then SEN1 'If sensor 3 dont detect then jump to SEN1
if portA.2 = 1 then LCD3 'Sensor at level3 detect then go LCD3
goto SEN1
LCD1:
LCDOut$fe,1 'Clear LCD
LCDOut$fe,2 'Position cursor at home
LCDOut "LEVEL 1 HAZARD"
Pause 1000
Goto SEND1
lcd2:
LCDOut$fe,1 'Clear LCD
LCDOut$fe,2 'Position cursor at home
LCDOut "lEVEL 2 HAZARD"
Pause 1000
Goto SEND2
LCD3:
LCDOut$fe,1 'Clear LCD
LCDOut$fe,2 'Position cursor at home
LCDoUT "lEVEL 3 HAZARD"
Pause 1000
Goto SEND3
SEND1:
'Send SMS Test-Message LEVEL 1
HSerout ["ATZ",13,10]
Pause 1000
HSerout ["AT+CMGF=1",13,10] 'Set Text Mode
Pause 500
HSerout ["AT+CMGS=",34,"+01234567890",34,",129",13,10]
Pause 500
HSerout ["LEVEL 1 HAZARD",10,13]
HSerout [26]
Pause 1000
goto SEN1
SEND2:
'Send SMS Test-Message LEVEL 2
HSerout ["ATZ",13,10]
Pause 1000
HSerout ["AT+CMGF=1",13,10] 'Set Text Mode
Pause 500
HSerout ["AT+CMGS=",34,"+01234567890",34,",129",13,10]
Pause 500
HSerout ["LEVEL 2 HAZARD",10,13]
HSerout [26]
Pause 500
goto SEN1
SEND3:
'Send SMS Test-Message LEVEL 3
HSerout ["ATZ",13,10]
Pause 1000
HSerout ["AT+CMGF=1",13,10] 'Set Text Mode
Pause 500
HSerout ["AT+CMGS=",34,"+01234567890",34,",129",13,10]
Pause 500
HSerout ["LEVEL 3 HAZARD",10,13]
HSerout [26]
Pause 1000
goto SEN1
Please someone took a look which part is wrong..
Bookmarks