Originally Posted by ajaustin12
I need a little help with a lab project that I am making for my Micro Processor class. My instructor gave me the idea of making a gun chronograph.
He wants me to use 4 qrb1134 reflective sensors to detect an object. The qrb1134's will be in two pairs set at a certain distance apart. The purpose for these sensors are to start and stop an internal clock of a MEGA16 micro processor trainer board.
I am also supposed to write a program for the MEGA16 to perform that function and to calculate the velocity of the object that passed through the two pairs of QRB1134. The program is also supposed to display the velocity on the CRT.
I am very new at programing and really don't know where to begin. Any help will be appreciative.
|
To use a uP for a timing task like this, you should probably use interrupts and the uP's internal timer/counter. I'd use two IOs (one for each sensor), and set up an interrupt on each line. The first interrupt would clear and start a timer, and the second interrupt would stop the timer, do the calculation, and send it to the display.
So I'd suggest reading some about interrupts and timer/counter use in your uP as a place to start.