Can't make RA1 a digital Input on (10 out of 20) 16F887.


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Can't make RA1 a digital Input on (10 out of 20) 16F887.

    Code:
    %000000010
    %00000010
    They are both the same number.

    Google RA1 Digital, and you can see the pain!

    if portA are all digital inputs, what value do you get reading portA into a byte?
    Code:
    byte = PORTA;
    What happens if you do this:
    Code:
    HIGH PORTA.0
    PAUSE 250
    LOW PORTA.0
    PAUSE 250
    So that portA isn't powering an LED while A1 is being read?
    Last edited by Art; - 11th October 2013 at 06:25.

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


    Did you find this post helpful? Yes | No

    Default Re: Can't make RA1 a digital Input on (10 out of 20) 16F887.

    This is your code tweaked for a PIC16F690, and it works:
    Code:
    #CONFIG
        __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BOR_OFF & _FCMEN_OFF & _IESO_OFF 
    ;__config _CONFIG2, _WRT_OFF & _BOR40V
    #ENDCONFIG
    
    
    DEFINE OSC 20
    
    ANSEL = 0
    ANSELH = 0
    ADCON0 = 0
    ADCON1 = 0
    CM1CON0 = 0
    CM2CON0 = 0
    CM2CON1 = 0
    CCP1CON = 0
    ;CCP2CON = 0
    portb=0
    portc=0
    porta=0
    TRISA = %00000010
    TRISB = 0
    TRISC = 0
    ;TRISD = 0
    ;TRISE = 0
    
    
    Startup:
    LOW PORTA.0
    PAUSE 250
    HIGH PORTA.0
    PAUSE 250
    
    IF PORTA.1 = 0 THEN
    LOW PORTc.1
    ELSE
    HIGH PORTc.1
    ENDIF
    GOTO Startup
    The registers a 690 does not have have been commented out. You will need a pull up on your input pin.
    Sorry I don't have an 887 to test upon.
    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. 16f887 portc input problems
    By lockjawz in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st March 2011, 15:02
  2. Replies: 2
    Last Post: - 1st May 2009, 09:23
  3. Really slow digital input
    By mbw123 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 30th March 2007, 05:06
  4. 18F4550 digital input
    By mbw123 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 29th March 2007, 03:43
  5. Replies: 2
    Last Post: - 5th June 2005, 20:55

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