get a sensor digital input to work on a pickit 2 16f690 lpc


Closed Thread
Results 1 to 16 of 16

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: get a sensor digital input to work on a pickit 2 16f690 lpc

    Quote Originally Posted by Jasonstew View Post
    Also with the digital sensor program, the light turns on when the state changes, but won't shut off unless i push the button on the lpc. Why? Thanks again. This is the code:
    In your code, your TRISC line is not right, you must set some inputs there.... as it is right now, there's only OUTPUT. Change it to
    Code:
          ' 
          '  76543210
    TRISC = %10000000
          ' -1-------- PORTB.7 = INPUT
          ' --0000000- PORTB<6:0> = OUTPUT
    And then your main loop may looks like...
    Code:
    Start:
            IF PORTC.7 = 1 THEN
                    PORTC.0 = 1
                    ELSE
                            PORTC.0 = 0
                    ENDIF
            PAUSE 1000
            GOTO Start
    OR.. WAY easier
    Code:
    Start:
            PORTC.0 = PORTC.7
            PAUSE 1000
            GOTO Start
    In your code, you enable the Pull up on PORTA, there's no internal pull-up available for PORTC, so I hope you have one
    Last edited by mister_e; - 26th June 2011 at 10:31.
    Steve

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

  2. #2
    Join Date
    Jun 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: get a sensor digital input to work on a pickit 2 16f690 lpc

    mi pickit2 constantly gets busy after around 15 seconds and i am forced to recompile why?

  3. #3
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: get a sensor digital input to work on a pickit 2 16f690 lpc

    That's because of your code in line 11.

    Just kidding, how could we possibly know what the problem might be from what you wrote? So now I am going to sound like a teacher and ask for at least a sentence for each of these topics. (Nah, a teacher would have asked for a paragraph on each)

    1. Gets busy? Busy doing what?

    2. 15 seconds after what?

    2. Recompile, what is forcing you to do this, and why?

    3. What are you doing to get here?

    4. Any errors?

    5. Any code?

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


    Did you find this post helpful? Yes | No

    Default Re: get a sensor digital input to work on a pickit 2 16f690 lpc

    6. Are you using the PICKIT 2 Standalone application, or the command line? If so, make sure you don't run 2 instances (or more) of the application.

    7. What if you change TRISA to...
    Code:
    TRISA = 255
    Last edited by mister_e; - 26th June 2011 at 17:31.
    Steve

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

  5. #5
    Join Date
    Jun 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: get a sensor digital input to work on a pickit 2 16f690 lpc

    The problem was solved whjen i changed the code to portc.0 = portc.7. Thanks.

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