I don't understand


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107

    Default I don't understand

    You folks have been very helpful as I am learning to program. My question is: what do I have to do to make porta.0 an input? My program, which does not work, is below:

    REM DEVICE = 16F627A
    REM DISABLE LOW VOLTAGE PROGRAMMING
    REM CONFIGURATION: INTOSC CLOCKOUT, WDT DISABLED, PWR UP ENABLED,
    REM MCLR enabled, BROWNOUT DISABLED, NO PROTECTION

    REM PORT B ARE OUTPUT, PORTA NOT USED, EXCEPT FOR PORTA.0

    TRISA = %10000000 'PORTA.0 IS STOP INPUT, ALL OTHERS OUTPUT
    TRISB = %00000000 'ALL OUTPUTS

    IF PORTA.0 = 0 THEN STOP
    HIGH PORTB.0
    HIGH PORTB.1
    HIGH PORTB.2
    HIGH PORTB.3
    HIGH PORTB.4
    HIGH PORTB.5
    HIGH PORTB.6
    HIGH PORTB.7

    start:
    low portb.0
    pause 5000
    high portb.0
    goto start

    END

    When I apply power, porta.0 is low even tho there is a 10K pullup. All portb outputs are low. When reset is low, all portb outputs are high.

    Russ

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


    Did you find this post helpful? Yes | No

    Default

    your TRISA setting is backward.
    TRISA= %00000001

    and you have to disable the analog comparator
    CMCON=7
    Steve

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

  3. #3
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    Thanks, I should have known it was backward, but I didn't know I had to disable the comparator.

    Russ

Similar Threads

  1. How to read / understand the config file P16fxxx.inc
    By jmj882 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 14th January 2010, 19:53
  2. HSEROUT and Commas, What? Help Me Understand
    By altech6983 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th July 2009, 19:12
  3. Trying to understand config fuses
    By GoldStar in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 19th May 2009, 03:20
  4. I don't understand this program
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th June 2006, 23:03
  5. Need Help To Understand This Program
    By Danish in forum mel PIC BASIC
    Replies: 2
    Last Post: - 9th August 2005, 22:07

Members who have read this thread : 1

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