Help....


Closed Thread
Results 1 to 4 of 4

Thread: Help....

  1. #1
    Eng. Baby heart's Avatar
    Eng. Baby heart Guest

    Default Help....

    I am working on a project and wrote the following program but there was no response, so i wish that someone could help me in that?

    DEFINE LOADER_USED1 'only required if bootloader is used to program PIC
    DEFINE HSER_RCSTA 18h 'set recieve register to reciever enabled
    DEFINE HSER_TXSTA 98h 'set transmit register to transmitter enabled
    DEFINE HSER_BAUD 9600 'set baud rate
    DEFINE HSER_SPBRG 99h 'set SPBRG directly
    DEFINE HSER_CLROERR 1
    INCLUDE "modedefs.bas"
    init:
    TRISA=%111000 ' set port A status
    TRISB=%10000010 ' set port B status

    PORTA=%000000 'inital state of port A
    PORTB=%00000000 'initial state of port B

    freq VAR WORD
    dur VAR WORD
    Lock VAR PORTB.4

    main:
    GoSub Dial
    GoSub ME
    freq=4000
    dur=2000
    GoSub latch
    End

    Dial:
    IF PORTB.1 = Low Then

    HSerout["AT"] 'Initialize the Modem
    Pause 500

    HSerout["ATD0505969798;"] 'Store number
    Pause 500

    HSerout["ATDME0505969798;"] 'Dial the stored number
    Pause 500

    End IF
    Return


    ME:
    High TXD
    HSerout["ATX=[2]"] ' busy line
    Pause 2000
    Low TXD
    Pause 2000
    HSerin 500,ME,[wait("OK")]
    IF PORTC.7 Then
    GoSub msg
    Else
    High TXD
    Pause 2000
    HSerout["ATH"]
    Low TXD
    Pause 2000

    EndIF

    Return

    msg:
    RXD=0
    High PORTB.0
    Pause 2000
    Sound PORTB.0,[dur,freq] 'play msg on intercom
    Pause 6000
    Low PORTB.0
    Pause 2000
    Return

    latch:
    DTMFOut PORTB.1,[2]
    IF PORTB.1 Then
    High Lock
    Pause 2000
    Else
    Low Lock
    Pause 2000
    EndIF
    Return



    Note: I used GM29 Sony Ericsson modem and PIC16f876 micochip.


    Best Regards,

    Eng.Baby heart

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    you didn't tell us your osc speed, but i'll assume 4MHZ
    use the following setting and post your results
    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_SPBRG 25  ' 9600 Baud @ 0.16%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    Those lines above, are a courtesy of Mister E PICMultiCalc

    Zah Mister E PicMultiCalc... the calc who calc those calcs

    and this...
    Code:
    ME:
    High TXD
    HSerout["ATX=[2]"] ' busy line
    Pause 2000
    Low TXD
    
    Pause 2000
    HSerin 500,ME,[wait("OK")]
    probably a real killer and also golden to miss incomming data., remove the pause 2000
    Last edited by mister_e; - 13th December 2006 at 06:51.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Eng. Baby heart's Avatar
    Eng. Baby heart Guest


    Did you find this post helpful? Yes | No

    Default

    Mister_e, thank you for your reply.

    The oscillator value you assumed was right 4MHz, but the main problem is in the dial function.


    I wish you could help me in that



    Best Regards,

    Eng. Baby Heart

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    sure if your RCSTA and TXSTA setting wasn't good, it will never work. And you probably need a MAX232 between your modem and your PIC.

    I didn't read the 266 pages of the modem manual (Available here), but it state it use ATA command, so i guess those you have in your code are good... i said i guess, i think i hope....

    Don't give up!
    Last edited by mister_e; - 13th December 2006 at 07:17.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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