What do I have to disable ?


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Sep 2008
    Location
    Stockholm
    Posts
    80

    Default What do I have to disable ?

    I building a little thingie that are going to use alot of pins, and since some has to be analog, some CCP (PWM) and so on I really had to do some thinking of what pin to use where.

    Well, then I choosed RA0 RA1 and RA2 for the three LED's, fine, in the beginning I just used RA0 and RA1 and no problem, then I started to use RA2.. didnt work.

    It's nothing complicated, I just set all pins low in the beginning of the code, and just use:

    high porta.0
    high porta.2

    ..and so later on.

    If I look at the datasheet pin 4 on 16F877A is:

    RA2/AN2/Vref/CVref


    ..and pin 2 and 3 only is RA0/AN0 and RA1/AN1

    So, Vref or CVref seem to be the problem, wise of my earlier mistakes I started with disabling the comparators with "CMCON = 7", didn't help

    I tried to understand what do by reading the microchip dopcumentation, but no..

    I guess that its something else I have to disable to be able to use RA2 as an digital IO-pin ?

    anyone have an idea ?

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


    Did you find this post helpful? Yes | No

    Default

    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.

  3. #3
    Join Date
    Sep 2008
    Location
    Stockholm
    Posts
    80


    Did you find this post helpful? Yes | No

    Default

    Well, I readed it, but I still dont understand, I have readed the part in the datasheet about the ADC, and I guess its register 11-2 bit 0.3 I have to change, and since I use AN5,6,7 I dont really understand how to set this value.

    I want to use AN0,AN1,AN2 as digital IO, AN5,AN6,AN7 as analog inputs, Vdd as Vref+ and Vss as Vref-

    Is this possible ? or do I have to rethink ?

    The page in the datasheet (for 16F87XA) I'm looking at is 130, "

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


    Did you find this post helpful? Yes | No

    Default

    Well let's see what you got, post the code so we can see it.
    GIVE THIS A TRY:
    CCP1CON = 0 ' CAPTURE COMPARE MODULE DISABLED
    CVRCON = 0 ' CVRCON BIT 7 =1 ENABLES =0 DISABLES CVRCON
    ADCON0.0 = 0 ' TURN OFF A/D CONVERTER
    ADCON1 = 6 ' CONFIGURE ALL PORTS AS DIGITAL
    Last edited by Archangel; - 13th February 2009 at 04:44.
    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.

Similar Threads

  1. Disable Watchdog timer?
    By Art in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 21st December 2009, 04:59
  2. How to disable CVREF on PIC16F690?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th June 2009, 12:44
  3. tmr2 interrupt problem
    By ADCON in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 2nd January 2008, 18:49
  4. Enable and Disable in Interrupts
    By stevecrunch in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th October 2007, 01:10
  5. Interrupts and Disable 16f877
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th April 2005, 21:08

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