PLIZ CHECK MY SCHEMATIC,pic16f84->max232->gsm phone


Closed Thread
Results 1 to 39 of 39

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Posts
    20

    Default pic16f84

    Thankyou Ioannis, currently its pic16f84 available for my project and in my country its hard to get access to microcontrollers so i have to just utilize it.
    I have replaced HSERIN/HSEROUT with SERIN/SEROUT but still generating errors,probably i have change something again;
    After changing this is the code:
    DEFINE OSC 4
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1

    'Setup the names that will be used throughout the program
    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 ["AT" ,13,10] ' send AT to modem followed by a CR and line feed

    SERIN 5000, SMS, [WAIT("OK")] ' now wait for 5secs until OK is received however
    ' if it is not then goto the SMS routine again

    SEROUT ["AT+CMGF=1" ,13,10]

    SERIN 5000, SMS, [WAIT("OK")]

    SEROUT ["AT+CMGS=+256782277658"]

    SEROUT [13,10]

    SERIN 5000, SMS, [WAIT(">")]

    SEROUT ["BUTTON HAS BEEN PRESSED!"]

    SEROUT [26] ' this is ASCII for Ctrl+Z of which completes SMS sending

    SERIN 15000, SMS, [WAIT("+CMG")] ' then PIC should receive +CMG from modem

    SEROUT [10] 'ascii code for a line feed

    end

    regards
    dumato

  2. #2
    Join Date
    Feb 2003
    Posts
    432

    Default

    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

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,141

    Default

    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

  4. #4
    Join Date
    Mar 2010
    Posts
    20

    Default

    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

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,141

    Default

    How about obtain a legal copy of the PBP compiler?

    Ioannis

  6. #6
    Join Date
    Feb 2003
    Posts
    432

    Default

    Quote Originally Posted by dumato52 View Post
    pliz help me with the link for the manual and i try to follow it up. I dont have hard copy,
    Help terminated !!!!
    Keith

    www.diyha.co.uk
    www.kat5.tv

  7. #7
    Join Date
    Mar 2010
    Posts
    20

    Default

    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

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,141

    Default

    Something like this?

    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
    
    '---------- 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
    Ioannis

Members who have read this thread : 0

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