Searching \ for '[PIC]: speed display project - was 16F84 help need' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=16F
Search entire site for: 'speed display project - was 16F84 help need'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: speed display project - was 16F84 help need'
2001\02\04@231422 by Gennette, Bruce

flavicon
face
To get the signals into the PIC just tap into the wire between your detector
and the +V side of each LED.  Take this Lo-->Hi signal through 10K (quarter
watt) resistors to inputs on the PIC

To show the speed value you need 9 outputs - 7 connected through 220R
resistors to each segment of the displays (wire the displays in parallel
except for the 'common' connections).  Use 2 other outputs through 1K
resistors into the bases of 2 transistors which connect the common
connections of the displays to 0V (1 to each).

If multiple displays are required you need buffer chips and extra
transistors to drive each pair of 7 seg displays.  You should then look at
using BCD to 7 seg drivers which connect directly to the PIC via just 3
outputs instead of 7 (but the code gets a bit more complicated for a
beginner).


Use portA pins 0-1 for the detector inputs (through 10K)
Use portA pins 2-3 for the display transistors (through 1K)
(portA pin 4 unused)
Use portB pins 1-7 for the displays (through 220R)
(portB pin 0 unused) - maybe use to change units?

start:
Your software waits for detector 1 to go Hi.
Pause for about 5ms and check that it is still Hi
If no then goto start, if yes then goto gettime

gettime:
It then turns off both displays
and starts counting.

endtime:
count
When the second detector goes Hi pause for about 5ms and check that it is
still Hi
If no then goto endtime, if yes then goto calctime

calctime:
counting and calculate the speed to display.
Then break the number into tens and units.
Look up the patterns for the 2 numbers and store them in 'shadow' registers

showtime:
After 'a short period' load the units pattern from its shadow to portB
Switch the tens display off and the units display on.
Your software checks for detector 1 to go Hi.
Pause for about 5ms and check that it is still Hi
If no then goto showtime2, if yes then goto gettime

showtime2:
After 'a short period' load the tens pattern from its shadow to portB
Switch the units display off and the tens display on.
Your software checks for detector 1 to go Hi.
Pause for about 5ms and check that it is still Hi
If no then goto showtime, if yes then goto gettime


This is a solution which can have small timing errors due to actual response
to detection occuring after built-in pauses and it will be fooled if the
train is longer than the distance between the detectors, but it should be
easy to do so that you get a result (a working system) quickly.  Of course
you'll want to tackle these problems with Mark#2 after your initial success,
so a simple first solution should not be seen as demeaning but as being
suitable to 'give you the bug' to go on.

'a short period' should be around 5ms which flashes each display 100 times a
second - way too fast for the flicker to be visible.  If you shorten the
time you'll need to reduce the resistors a little to allow a larger current
into the LEDs.  If you lengthen the time the flicker will first become
visible as ghosts, then as eye-straining pulses.

Bye.

> {Original Message removed}

2001\02\05@093631 by David P. Harris

picon face
Hi Bruce and Ray-
This is an excellent letter, Bruce.  However, I would be inclined to use a LCD
display for this for the following reasons.  There is a wealth of code to drive
them, LCD code is in the Piclist archives.  They are quite cheap in surplus
market (for a 2 or 4 line x 20 character display about $5 at http://www.bgmicro.com or
other suppliers).  You wouldn't have to do your own decoding of segments.  You
could give a more informative messages.  Also, the experience would stand you in
good stead for further projects.

There are numerous pcboards availbale for small projects, see http://www.dontronics.com
, or, more in the line of model trains,
http://www3.sympatico.ca/robert.cote/dccnew0.htm  which has a small circuit
board with a LCD connector.

David

"Gennette, Bruce" wrote:

{Quote hidden}

> > {Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...