Using 16f676 with comms


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Posts
    67

    Talking Using 16f676 with comms

    Hi,

    Usind debug and setting the correct pins, there should be no reason that 16f676 for it to send and reeive rs232 data?

    I have setup up CMCON =7 ( comparators off)
    ANSEL = 7 (A-D 0,1,2 rest digital)
    ADCON0.7 = 1 (right justify)
    ADCON0.6 = 1 (ext vref)

    DEFINE DEBUG_REG PortC
    DEFINE DEBUG_BIT 1
    DEFINE DEBUG_BAUD 9600
    DEFINE DEBUG_MODE 1

    after turnon and wait I send

    DEBUG REP $00\8,13,10,"Hello"

    but no "hello"

    any inputs?

    thnks

    Peter
    Pete

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Two things...

    Firstly check the SPELLING of your DEFINES. They have to be EXACTLY right, any typo's will NOT be flagged as an error. You might also want to set PortC as all CAPS ie PORTC in the DEFINE statement.

    Finally, although it should not affect transmission, some terminal programs only display what you're sending after receiving a CR, LF... so try...

    DEBUG REP $00\8,13,10,"Hello",13,10

    You should be in business. If you haven't got a crystal or resonator as OSC to your PIC, drop down in speed as it's unlikely you'll get relaible comms at 9600 on the internal or RC oscillator.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    I would suspect the PortC thing to be the source of the trouble since the DEFINE lines are case sensitive.

  4. #4
    Join Date
    Feb 2005
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Thks,

    PORTA, PORTC worked well.

    Peter
    Pete

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Good to hear Peter. Thanks for the update.

  6. #6
    Join Date
    Sep 2003
    Location
    INDIA
    Posts
    161


    Did you find this post helpful? Yes | No

    Exclamation Similar Problem With Comm - Rs485

    Instead of starting a new thread , I thought of just adding my problems story to this one.

    I am have a network of RS485 using 16F676 IC. I am having a big problem with communicating with the PC.

    My harware config is :
    Pin#1 of RS485 ----> MCLR/RA3
    Pin#2&3 of RS485 --> RA4
    Pin#4 of RS485 ---> RA5

    My code is as follows:

    @ DEVICE PIC16F676,INTRC_OSC_NOCLKOUT,WDT_ON,PWRT_OFF,BOD_O N,PROTECT_OFF,CPD_OFF,MCLR_OFF
    Include "Modedefs.Bas"
    ANSEL = 0 ' DISABLE THE ANALOG INPUT
    CMCON = 7 ' DISABLE COMPARATOR ON PORTA
    VRCON = 0 ' A/D Voltage reference disabled
    TRISA = %00101000 ' SETS ALL PORTA PINS TO INPUT ' Set PORTAA to all input
    TRISC = %00000000 ' 6 Pins - LCD and 2 Pins RF Module
    LED VAR PORTC.5 ' LED (SINK)
    SER_IN VAR PORTA.3 ' DATA INPUT PORT
    DO VAR PORTA.5 ' DATA OUTPUT PORT
    RS485 VAR PORTA.4 ' RS485 CONTROL PIN
    HIGH RS485 :
    ' ----------------------------------------------------------------------
    ' ** Declare the Variables **
    I VAR WORD ' TEMP VARIABLE
    ' ----------------------------------------------------------------------
    HIGH RS485
    LOOP:

    FOR I = 16400 TO 16900 STEP 10
    SEROUT2 DO,I,["VALUE: ", DEC I,10,13] ' FOR RS232
    PAUSE 500
    NEXT

    GOTO LOOP
    END

    I seem to have lost my OSCAL value and I am trying to get a reliable comm using Hyperterminal software over RS485.

    I am getting no Output on the Hyperterminal @2400

    Can anyone help.

    regards

Similar Threads

  1. 16F676 programming problem
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th May 2009, 17:39
  2. PIC12F675 comms issues
    By Peter1960 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 25th March 2007, 04:24
  3. Remote comms
    By thirsty in forum Serial
    Replies: 1
    Last Post: - 23rd June 2006, 15:42
  4. Pic to Pc Comms
    By Darrenmac in forum General
    Replies: 2
    Last Post: - 21st May 2005, 01:44
  5. USB comms
    By rastan in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 24th March 2005, 17:14

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