Simple code but strange result - 877A


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default 877A with Modem. Communication Problem

    I have written a small code to send AT commands to the Modem and then get an OK back. I have put my computer's RS232 connections in Parallel to keep an eye on the communication.

    But My PIC is not Transmitting anything - I need help to make this work

    My code is as follows:
    Code:
    Include "modedefs.bas"
    DEFINE OSC 4
    @ __Config _XT_OSC & _WRT_256 &_WDT_OFF &_PWRTE_ON &_BODEN_OFF & _LVP_OFF
    
    PAUSE 10
    '-----------------------------------------------------
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    DEFINE HSER_SPBRG 25  ' 2400 Baud @ 4MHz, 0.17%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    
    @ ERRORLEVEL -306
    
    '------------------------------------------------------
    ADCON1=7
    CMCON=7
    INTCON=128
    OPTION_REG.7=0
    TRISA=0 : PORTA=0
    TRISB=0 : PORTB=0
    TRISC=%10000000 : PORTC=0
    TRISD=0 : PORTD=0
    TRISE=0 : PORTE=0
    CCP1CON=0
    '-----------------------------------------------------
    main:
    TOGGLE PORTA.0
    		HSEROUT  ["AT",10,13]
    		HSERIN 1000,main,[WAIT("OK")]
    PAUSE 2000
    goto main
    The receiving end is working fine, as I can send the "OK" from my terminal window and my PIC is getting it. But nothing appears on my Terminal window from the PIC.

    I have checked that there is a constant voltage on the TX pin, 4.6V. Is something wrong with my code?
    ___________________
    WHY things get boring when they work just fine?

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: Simple code but strange result - 877A

    Do you have a schematic? What's RC.6 connected to?

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Simple code but strange result - 877A

    Quote Originally Posted by scalerobotics View Post
    Do you have a schematic? What's RC.6 connected to?
    rc.6 ->Pin11 (MAX232) -> Pin14(MAX232) -> Modem Pin3 (Female RS232)
    ___________________
    WHY things get boring when they work just fine?

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Simple code but strange result - 877A

    Hi,
    I have NEVER used the USART to transmit so if I am wrong, . . . well here is my try . . .
    TXSTA.5 = 1 'which is transmit enable bit.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5


    Did you find this post helpful? Yes | No

    Unhappy Re: Simple code but strange result - 877A

    Quote Originally Posted by Joe S. View Post
    Hi,
    I have NEVER used the USART to transmit so if I am wrong, . . . well here is my try . . .
    TXSTA.5 = 1 'which is transmit enable bit.
    Didn't Work
    ___________________
    WHY things get boring when they work just fine?

  6. #6
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Simple code but strange result - 877A

    this is from the datasheet
    Bit SPEN (RCSTA<7>) and bits TRISC<7:6> have to be
    set in order to configure pins RC6/TX/CK and RC7/RX/DT
    as the Universal Synchronous Asynchronous Receiver

    Transmitter.


    So maybe you need to set trisc.6=1 also?
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: Simple code but strange result - 877A

    Quote Originally Posted by cncmachineguy View Post
    this is from the datasheet


    So maybe you need to set trisc.6=1 also?
    Thanks for the reply. Tried the above - NO Luck
    ___________________
    WHY things get boring when they work just fine?

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