How to read pulse from reed switch


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Thanks! Wow, PBP is really powerful!
    I assume that as long as the voltage coming out of the reed switch is < 5V, it should be OK to connect the reed switch directly with any pin on the PIC.

    If I use the command
    COUNT PORTB.1,1000,w1
    I will be counting the number of pulses on pin1 in 1000 milliseconds.
    During the period of 1000 milliseconds, does the program 'pause' or does it continue to execute in the background, in other words, will any ON INTERRUPT commands execute during the 1000 milliseconds?

  2. #2
    Join Date
    May 2007
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    The manual says "With a 20MHz oscillator it checks the pin state every 4us, thus I assume the program continues to execute during the 1000 milliseconds period of the COUNT command, or am I wrong?
    Last edited by passion1; - 8th June 2007 at 21:56.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by passion1 View Post
    The manual says "With a 20MHz oscillator it checks the pin state every 4us, thus I assume the program continues to execute during the 1000 milliseconds period of the COUNT command, or am I wrong?
    Nope, the program stops during the counting.
    If you want the program to keep running, you have to start looking at interrupts and timers, etc...

  4. #4
    Join Date
    May 2007
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Skimask

    Thank you for the help!

Similar Threads

  1. Cleaning up code
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2009, 07:14
  2. SEROUT WORD variable problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th April 2009, 11:20
  3. Replies: 3
    Last Post: - 13th September 2008, 17:40
  4. Changing declared variables names on the fly
    By jessey in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th December 2006, 06:34
  5. read the pulse of a bobbin
    By savnik in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th July 2006, 22:09

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