Hiya-
O.K. now for the bad side of things. The 16F84s needs an external timing device to operate. Some of the newer chips
have internal oscillators that can allow the devices to self clock. HOWEVER, I have found that the internal oscillator is somewhat temperature dependant.
I did a "geek clock" (bcd with descrete LEDS) and used the internal oscillator and it lost or gained time depending on the season. Even in the air conditioned office.
This might not be a problem for you, just something to keep in mind if you want to do a time of day clock in the future.
Now, onto your other questions. First, might I suggest that you look at one of the newer PIC chips. The 16F84As have been replaced two generations ago with the counterpart of a 16f648A. IT DOES TAKE A DIFFERENT PROGRAMMER AND YOU HAVE TO ADD TWO MORE INSTRUCTIONS IN THE STARTUP CODE. Yes, I did have to shout that (sorry). The 16F648A has a full 4K of program flash memory, and many more "general purpose" registers (RAM). It also has another timer or two.
There are 4 digit displays out there and they can be used. They are available in both common anode and common cathode versions. I believe from the schematic that they use a common anode device. I might suggest a search for 4 digit (or 3 digit) common anode devices that have only 12 pins on the device. Will save a LOT of wiring if you are going to do this via the protoboard method described in the web page!
Even doing a home built PCB (Like I do. 4 digits times 8 or 9 pins (with the decimal point), is 36 holes to drill versus the 12 the other displays have. Tip. The displays that I am talking about are 0.6 inch width pinouts with 0.1 inch between pins on the same row. Get like a 24 pin wide socket we use for static ram or old Eproms and cut it half for the socket for the display. I suggest using machine pin sockets for this.
Yep, the circuit is a pretty straight forward implementation.
Now, as to using timers. Well, the simple example of doing a counted delay loop is all well and good if all you are doing is waiting. But, for this timer, I don't think that you desire to have the display go blank and show up for a brief spurt every second or so.
You should expect to have to change the display and show each digit about 50 or 60 times each second. Otherwise you might get flicker in the display.
O.K. that being said, we have to be doing something else while we are timing. So, we have to have other code executing. That code (most likely) will have one or two or (many) more branches in it. Each one with its own different execution time as the microcontroller goes through it's code. Therefore, it gets a tad bit complicated trying to figure out the timing variations in each code path.
I strongly suggest that you bite the bullet and learn to use the timers. You don't have to have them interrupt driven. The interrupts on the PIC timers can be disabled and one's code can poll the timer rollover bit to determine a fixed length of time. Please note that these are "up counters" and will "pop" as they roll from FFFF (or FF) to 0000 (or 00). So for a shorter time, put in a higher integer value into the timer/counter register.
You can also partition the problem. Try doing a one second timer example bit of code with a simple LED that turns on,
starts the timer and turns off. Or, better yet, get it to toggle (if it's on, turn it off, if it's off, turn it on) and get the LED to blink at the one hertz rate. That will get you the confidence of getting the timer operation to work more or less as you expect.
Of course, this is AFTER you get the PIC set up correctly as macgyvers2000 has said. Here a little delay loop blink first to get your toolchain and configuration words set up will get you over the first and biggest hurdle. Sorry, I should have had this paragraph much earlier.
After you get both the delay loop blink program and the timer blink working, then might I suggest that you get the multiplexed display working. Just put in fixed values for each of the digits. For example, see if you can get the display to show a 00, then a 01, maybe a 12, then a 34, etc.
After you get the display working the way you want it to, now you have a real good debugging tool in its own right. You can for example, read the BCD switches and display them on the leds.
You can check your BCD arithmetic, take a couple of sums and put that on the display.
Check your timer counting logic and display that. Start off at a preset value and count up (or down) once each second.
Put those all together and you have your program!
Oh, and you can keep all 4 digits, if you want. There is a spare output on th 138 (y3) that you can use like the start button.
And instead of the "point to point" wiring that they used in the project, might I suggest that you look into wire wrap and a resistor netork. You might also find some diodes in a 16 pin pack. Or at least descretes soldered onto a 16 pin header that fits in a wire wrap socket. I think that you will find the assembly much easier. I KNOW that there are some integrated circuits with PNP transistors in a DIP package (I just can't remember them off hand, sorry). Maybe someone else has a part number handy. Indeed, you can get DIP switches and use them in place of the rotary BCD switches that are used there in the web site.
Just some suggestions.
Well, I see that I've prattled on long enough AGAIN!
I hope that this gives you some food for thought. Now, with some thought, we might be able to reduce the parts count somewhat, but we can do that after we get this one done.
Best of luck! Keep us posted!
Cheers,
Rich S.