Beginner in need of help !!


Closed Thread
Results 1 to 40 of 72

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Beginner in need of help !!

    Not sure how much help you need. I'm assuming you know input/ output, high/ low...

    Google "Pull down switch" and see how the level goes from high to low when the button is pressed (there is a pull up as well); use standard input technique to read the level change when the switch is pressed. To control the LED output, I think an if/ then will work well:

    If Button press = 0 and LED = off then [turn on LED]
    If Button press = 0 and LED = on then [turn off LED]

    You should also look at "debounce" as there is some issue to mechanical switches.

    Also, without some programming to limit the speed, the switch will turn the LED on/ off very quickly. A pause will work (to give the user time to release the button) or, you can look for a "1" on the switch (released) before allowing another button press to register.

    HTH,
    Last edited by Amoque; - 15th January 2015 at 13:35.

  2. #2
    Join Date
    Jan 2015
    Posts
    45


    Did you find this post helpful? Yes | No

    Default Re: Beginner in need of help !!

    Okay I think I have made sense of this now - correct me if I'm wrong.

    So if I wanted to set the comparator up with say an internal reference & output (cm<2:0> = 011), I would set the cmcon0 register as CMCON0 = %00000011 ?

    Now to the VRR -

    I think Im right in saying that the comparator uses the main VDD+ pin on the chip to compare the internal reference to? What I dont understand is this -

    IF VRR=1 and VR3 ... VR0 = 1111 (15) with a VDD of 5V the Vref will be (15/24)*5 = 3,125V

    ^^ Where are they getting that 15 from? Also where do you get the 24 from?

    IF VRR=0 and VR3 ... VR0 = 1111 (15) with a VDD of 5V the Vref will be 5/4+(15/32)*5 = 3,593V

    ^^ Also why has the 24 changed to a 32 just from vrr=1 changing to a 0?

    One last question, Am I right in thinking that you have to use the CIN- pin on the chip to provide the voltage to check? Cant you use a comparator on any pin of the chip (apart from gp3, vdd & vss).

    Thanks again,
    Rob

Similar Threads

  1. Beginner help!
    By Recognize in forum General
    Replies: 14
    Last Post: - 26th April 2012, 14:55
  2. pic24 beginner
    By robertpeach in forum General
    Replies: 23
    Last Post: - 13th August 2009, 11:57
  3. need help! to beginner
    By emilhs in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 6th May 2009, 18:44
  4. Beginner at PB
    By alphahr in forum Off Topic
    Replies: 1
    Last Post: - 21st April 2008, 17:43
  5. Can anyone help a beginner in a struggle?
    By douglasjam in forum mel PIC BASIC
    Replies: 1
    Last Post: - 5th May 2005, 23:29

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