PHY 406 - Microprocessor Interfacing Techniques

Module 4 - Time and Timers

In this module we look at some issues with counters and timers. There is only so much time and therefore we can only look at a few issues, but it is important to realise some of the problems and successes of the use of time as a variable.

Preparation

You will need the following VIs

Functions>>Data Acquisition>>Digital I/O>>Read From Digital Port.vi

We will be using an interface which will be used for the next two modules. It contains a counter and a digital-to-analog converter. In this module we will only be using the counter part. Make sure (by asking if necessary) that you understand the circuit diagram for the keypad and display interface timer_da.pdf

You are asked some questions which assume some knowledge of digital logic and how things are put together. In particular you should know about "ripple" counters and their foibles. If you are uncertain - or just need a refresher - look at the document counters.pdf

You will have realised from module 1 that the computer system has some troubles with timing. Just relying on the time it takes the computer to do something is not reliable at all, it may not be as obvious that relying on the computer timing is also a problem. The computer clock only has a finite resolution (1mS for Win95) and can also go wrong! In general the more you can move the timing into hardware, the better.

Equipment

You will need the timer and digital-to-analog converter interface which is kept in the cupboard. For this practical all the interfaces should be identical so there should be no need to record the number of the interface unless the thing doesn't work!

The interface consists of a ripple counter which is clocked by a 1MHz clock. The computer reads some lower bits of the counter which are counting at such a rate that you can see the individual counts.

There is a general issue with LabVIEW that it has problems distinguishing between various types of integer (they all have blue wires!) and this can lead to some very "mysterious" problems. I suggest that in order to avoid these, you convert your digital inputs to 16-bit signed integers as soon as you take them and proceed from there. Also watch out for type conversion "dots" on inputs which you didn't expect to be there.

Make a Clock

Does the Counter Work?

Advanced

This section is for the intelligent/bored or otherwise fascinated. There are no marks for this section - only the satisfaction of solving a problem or two.

Notes

This practical talks about two issues.