Thread: Pulse Width Measurement

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    4

    Pulse Width Measurement

    Anyone know code for measuring a pulse from a 555 timer?
    Any help would be much appreciated?
    Below is the code i have at the minute

    #include <16f874.h>
    #use delay (clock = 4000000)
    #byte PORTC = 7
    #bit INPUT = PORTC.0
    setup_timer_1(T1_INTERNAL , T1_DIV_BY_1);
    long int PERIOD;
    main()
    {
    set_tris_c (0x01); // setting up ports
    PERIOD= 0;
    while(INPUT==0)
    set_timer1(0);
    while(INPUT==1);

    PERIOD = get_timer1();

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Look up "Capture" in the Datasheet.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. rescaling areas
    By hannibar in forum C Programming
    Replies: 2
    Last Post: 02-28-2006, 03:22 PM
  2. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  3. Display list not displaying?
    By psychopath in forum Game Programming
    Replies: 5
    Last Post: 09-19-2004, 06:47 PM
  4. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM