PIC16F917 - Not reading input


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2008
    Posts
    6

    Default PIC16F917 - Not reading input

    All,

    I am trying to read the input from RA7 from the PIC16F917. The problem is that I cannot do so. Does anyone know why? Thanks-N-Advance

    INCLUDE "modedefs.bas"
    DEFINE OSC 4 'SET OSCILLATOR SPEED TO 4 MHz
    OSCCON = %01100111 'Enable internal oscillator
    LCDCON=$40 'DISABLES LCD
    CMCON0=$07 'DISABLES COMPARITORS
    TRISA = %10101111 'Set PORTA IO Ports (0 = output, 1 = input)


    MAIN:

    PAUSE 1000

    SEROUT PORTc.1,N9600,[13,10,"pic_mon = ",#PORTA.7,13,10]
    GOTO MAIN
    END

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    What do you have A.7 connected to? What are you expecting?

    And the internal OSC may not be good enough for serial. What are you sending to?
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    This chip has ADCON0, ADCON1, and ANSEL registers, all affect PortA
    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.

  4. #4
    Join Date
    Feb 2008
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    mackrackit...

    What do you have A.7 connected to? I have it connected to a GPIO which outputs 3.3VDC
    What are you expecting? Either a logic 1 or 0

    And the internal OSC may not be good enough for serial. What are you sending to? I am sending to the com port on the PC, it outputs the message i want.

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by freddayz View Post
    What do you have A.7 connected to? >>>I have it connected to a GPIO which outputs 3.3VDC
    Well, that isn't going to be near enough voltage to connect into an RS232 port on a PC... A 5v signal is just barely enough, but seems to work in most cases. Either need to bump up to 5v or use a 3v-compatible MAX232-type chip in the middle.

    And the internal OSC may not be good enough for serial. What are you sending to? >>>I am sending to the com port on the PC, it outputs the message i want.
    Internal oscillators are sometimes accurate enough for serial communications, sometimes not. Best bet is to use an external oscillator.
    Last edited by skimask; - 15th July 2008 at 21:21.

  6. #6
    Join Date
    Feb 2008
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    I guess my question is not clear then...
    I am trying to program RA7 on the PIC16F917 as an input with no success all I read is 0

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    As Joe mentioned about the ADC.
    Take a look at this:
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Sony LanC Program
    By l_gaminde in forum Code Examples
    Replies: 2
    Last Post: - 25th September 2009, 18:51
  2. floating A/D input
    By muddy0409 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th April 2009, 13:21
  3. Timing input pulses and re-outputting them
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2007, 01:50
  4. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19
  5. 16F88 reading Analog Input
    By thunderstrike44 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th August 2004, 22:41

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