Can anyone please help me with my project? - Rate meter


+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2007
    Location
    Philippines
    Posts
    9

    Exclamation Can anyone please help me with my project? - Rate meter

    Utilizing a laserlight and a phototransistor (RA0), I have created a counter. I'm using PIC16F628A with an onboard 4mhz oscillator. Right now it only displays how many objects have passed by. I would like to add another function which is to display the rate of objects that pass per min. or per hour. I don't know how to incorporate this into the program. Can anyone help me?
    Last edited by Humbleworker; - 27th March 2007 at 08:02.

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,177

    Default Details !

    By "rate", did you mean the number of people passed in one minute?

    IF yes, then use Timer1 module of the PIC at 1:8 scale and have 500ms timing interval. This way, you can have Timer1 module timing in the background while you can at the sametime have your counting in the foreground.

    OR

    You can just use simple PAUSE command to create 1 minute timing interval and have your counting in a WHILE statement.

    For example,
    Code:
    CountPin VAR PORTA.0
    Timing   VAR WORD
    Counter  VAR WORD
    Timing = 0
    Counter= 0
    
    Start:
    
    WHILE Timing < 6000
    	IF CountPin = 0 THEN
    		WHILE CountPin = 0 : WEND
    
    		Counter = Counter + 1   'Number of people Passed
    		Timing  = Timing  + 1	'Timing: 6,000x10ms=60,000ms (1 min) 
    		PAUSE 10
    
    	ENDIF
    WEND
    
    Timing = 0
    
    Goto Start
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. A Temperature & Humidity Data Recorder Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 9th July 2008, 18:47
  3. Auto Baud Rate Detection
    By mytekcontrols in forum Serial
    Replies: 10
    Last Post: - 31st October 2005, 02:17
  4. PIC12F675, accuracy of baud rate with Internal Oscillator
    By Chris Mayhew in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2005, 22:41
  5. Baud Rate and Timing Calculator
    By picnaut in forum General
    Replies: 3
    Last Post: - 23rd January 2004, 16:48

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts