The defines you have that start with "HSER" are for a harware serial port which the F84 doesnt have therefore the compiler will not be happy with you trying to define a non existant value.
The defines you have that start with "HSER" are for a harware serial port which the F84 doesnt have therefore the compiler will not be happy with you trying to define a non existant value.
Keith
www.diyha.co.uk
www.kat5.tv
Please READ the manual about the Syntax of the Commands.
You do not define the port pin, the baud rate. No wait for Serin (only for Serin2). No square brackets for the variables. Only in Serin2.
Same for the Serout/Serout2.
And as keithdoxey noted, no DEFINEs as these are for he Hserin/Hserout.
I do not like the "read he manual" statement but I cannot teach you the Lanquage and how to write programs. It is something you have to do it yourself.
Do you have a printed manual?
Start by flashing a LED, as trivial may sound this.
I even do this when I change PIC micro, just to be sure that I am in control of the new beast before I try anything more complicate.
Ioannis
Thankyou keith and Ioannis for ur contributions, pliz help me with the link for the manual and i try to follow it up. I dont have hard copy, mean while i wil make the changes u have told me
regards
I read through the manual and made the changes, now the new code is succesful with 16f84 but i wanted the same message to be sent to two phone numbers, pliz help me and check the code below;
code:
PushButton var PORTB.0 ' Setup the name PushButton to mean PortB input 0
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
SEROUT PORTB.1,6,["AT" ,13,10] ' send AT to phone followed by a CR and line feed
SERIN PORTB.2,6,["OK"] ' now wait until OK is received
SEROUT PORTB.1,6,["AT+CMGF=1" ,13,10]
SERIN PORTB.2,6,["OK"]
SEROUT PORTB.1,6,["AT+CMGS=+256782277658"]
SEROUT PORTB.1,6,[13,10]
SERIN PORTB.2,6,[">"]
SEROUT PORTB.1,6,["BUTTON HAS BEEN PRESSED!"]
SEROUT PORTB.1,6,[26] ' this is ASCII for Ctrl+Z of which completes SMS sending
SERIN PORTB.2,6,["+CMG"] ' then PIC should receive +CMG from modem
SEROUT PORTB.1,6,[10] 'ascii code for a line feed
end
regards
Something like this?
IoannisCode:PushButton var PORTB.0 ' Setup the name PushButton to mean PortB input 0 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 SEROUT PORTB.1,6,["AT" ,13,10] ' send AT to phone followed by a CR and line feed SERIN PORTB.2,6,["OK"] ' now wait until OK is received SEROUT PORTB.1,6,["AT+CMGF=1" ,13,10] SERIN PORTB.2,6,["OK"] SEROUT PORTB.1,6,["AT+CMGS=+256782277658"] SEROUT PORTB.1,6,[13,10] SERIN PORTB.2,6,[">"] SEROUT PORTB.1,6,["BUTTON HAS BEEN PRESSED!"] SEROUT PORTB.1,6,[26] ' this is ASCII for Ctrl+Z of which completes SMS sending SERIN PORTB.2,6,["+CMG"] ' then PIC should receive +CMG from modem SEROUT PORTB.1,6,[10] 'ascii code for a line feed '---------- second number------------ SEROUT PORTB.1,6,["AT+CMGS=+000222333666444"] SEROUT PORTB.1,6,[13,10] SERIN PORTB.2,6,[">"] SEROUT PORTB.1,6,["BUTTON HAS BEEN PRESSED!"] SEROUT PORTB.1,6,[26] ' this is ASCII for Ctrl+Z of which completes SMS sending SERIN PORTB.2,6,["+CMG"] ' then PIC should receive +CMG from modem SEROUT PORTB.1,6,[10] 'ascii code for a line feed end
Thank you Ioannis, i highly appreciate ur help;
Now i need to connect the phone to microcontroller, am looking for the models u told me nokia 6210, 6310 but i needed to know when i acquire the phone, how do i test whether it supports AT commands, any software i need to instal?
regards
dumato
Bookmarks