trouble configuring 16F677


Closed Thread
Results 1 to 2 of 2
  1. #1

    Default trouble configuring 16F677

    I'm trying to use a 16F677 to read the input from a potentiometer and then output the position of the pot by turning on one of 8 LEDs. The ADCIN is a number between 0 - 255. The first LED is 0 - 31, the second LED is 32 - 63, the third LED is 64 - 91, ....the eighth LED is 224 - 255.

    PBP compiles my code OK, but when I use the programmer to write to the chip, I get an error message that there is a problem with the configuration. The problem is not with the chip or the programmer. I am able to write other programs to the chip. Just not this one. potentiometerx is connected to pin4/PORTA.3/AN3

    ANSEL = %10001000
    ANSELH = %00000000




    TRISA = %00001000
    TRISB = %00000000
    TRISC = %00001000




    x1 var PORTC.0
    x2 var PORTA.2
    x3 var PORTA.1
    x4 var PORTA.0
    x5 var PORTA.5
    x6 var PORTA.4
    x7 var PORTC.4
    x8 var PORTC.5




    positionx var byte


    mainloop:


    adcin 3, positionx


    if positionx < 32 then
    x1 = 1
    x2 = 0
    x3 = 0
    x4 = 0
    x5 = 0
    x6 = 0
    x7 = 0
    x8 = 0
    elseif (positionx >= 32) and (positionx < 64) then
    x1 = 0
    x2 = 1
    x3 = 0
    x4 = 0
    x5 = 0
    x6 = 0
    x7 = 0
    x8 = 0
    elseif (positionx >= 64) and (positionx < 96) then
    x1 = 0
    x2 = 0
    x3 = 1
    x4 = 0
    x5 = 0
    x6 = 0
    x7 = 0
    x8 = 0
    elseif (positionx >= 96) and (positionx < 128) then
    x1 = 0
    x2 = 0
    x3 = 0
    x4 = 1
    x5 = 0
    x6 = 0
    x7 = 0
    x8 = 0
    elseif positionx >= 128 and positionx < 160 then
    x1 = 0
    x2 = 0
    x3 = 0
    x4 = 0
    x5 = 1
    x6 = 0
    x7 = 0
    x8 = 0
    elseif positionx >= 160 and positionx < 192 then
    x1 = 0
    x2 = 0
    x3 = 0
    x4 = 0
    x5 = 0
    x6 = 1
    x7 = 0
    x8 = 0
    elseif positionx >= 192 and positionx < 224 then
    x1 = 0
    x2 = 0
    x3 = 0
    x4 = 0
    x5 = 0
    x6 = 0
    x7 = 1
    x8 = 0
    elseif positionx > 224 then
    x1 = 0
    x2 = 0
    x3 = 0
    x4 = 0
    x5 = 0
    x6 = 0
    x7 = 0
    x8 = 1
    endif


    goto mainloop

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: trouble configuring 16F677

    potentiometerx is connected to pin4/PORTA.3/AN3




    Pin 4 is RA3/MCLR/VPP not an3 and not an analog pin

    AN3 is RA4 Pin 3 that you are trying to use for led 6


    there is no #config info in you post so the actual configuration of pin 4 is unknowable here

















    Warning I'm not a teacher

Similar Threads

  1. Help with configuring
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 17th August 2014, 02:08
  2. 16F677 lcd troubles
    By 12aBridge in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 4th February 2010, 13:04
  3. 16F677 supported?
    By 12aBridge in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th October 2009, 04:27
  4. Configuring 16F616
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th February 2009, 17:28
  5. need help configuring 16F628
    By tcbcats in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd March 2004, 19:59

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