Drawing a blank on trigger pin polarity


Results 1 to 5 of 5

Threaded View

  1. #2
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: Drawing a blank on trigger pin polarity

    That will work just fine Tony.
    The one A/D input can be used to monitor and trigger to many levels of the input range within tolerance, but your application is a snap with only three states: Max A/D, Mid A/D and Min A/D.

    Here's an example using a three state momentary switch:

    Name:  ADC in.JPG
Views: 637
Size:  33.0 KB

    Just make sure the switching value being monitored will not damage your uC.

    Now a simple routine can monitor and do what you need:

    Code:
    SW_1  VAR BYTE    ' A/D setup with 8bit
    
    ADCIN 0, SW_1     ' Assuming PIC Vdd is 5V and using A/D input 0
    
    SELECT CASE SW_1
       CASE IS < 26   ' Input less than 0.50V
          ' Do something
       CASE IS < 135  ' Input less than 2.64V
          ' Do something else or nothing at all
       CASE IS > 135  ' Input more than 2.64V
          ' Do something
    END SELECT
    Last edited by LinkMTech; - 20th October 2013 at 16:10. Reason: Fix schematic error
    Louie

Similar Threads

  1. Blank Variable
    By GatorGuy in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 5th February 2010, 17:05
  2. How to reverse polarity on output pulse??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th June 2009, 13:25
  3. Error blank check
    By MINHLE in forum General
    Replies: 0
    Last Post: - 3rd December 2008, 01:56
  4. How do I detect a polarity change on an input?
    By jessey in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 28th May 2008, 23:25
  5. max7219 blank leading zeroes
    By lutherblissett in forum General
    Replies: 0
    Last Post: - 13th November 2005, 16:46

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