Use this Site Map for guidance

.zip of 8 files for programming

This project is a combination Logic Probe and Logic Pulser. It is capable of testing all sorts of digital and microcomputer projects.  You will find it extremely handy when designing a project as the golden rule is to test everything in steps and stages during the design-and-construction process
If you are not sure how a Logic Probe or Pulser works, let me explain. 
Suppose you have a PIC project (or any type of digital project) with an output line that is connected to a LED. But the LED does not illuminate. The fault could be in the microcontroller, the program, the LED or the wiring. To "hone-in" on the problem, the quickest thing to do is measure the voltage on the output line. You can do this with a multimeter but a Logic Probe / Logic Pulser has other features, as you will see. 
Firstly the Logic Probe:
To use the Logic Probe, the earth lead of the Probe is connected to the negative rail of the project-under-test and both the Logic Probe and the project are turned on. The tip of the Logic Probe is then placed on the pin (or the component) to be tested. The sound from the Logic Probe will tell you if the point is HIGH,  LOW or contains a SIGNAL. A low-frequency sound will indicate a LOW and a HIGH frequency sound will indicate a HIGH. The Logic Probe also contains a red (HIGH) LED and a green (LOW) LED. If a signal is present BOTH LEDs will illuminate and the tone will be a mixture of HIGH and LOW.  The illumination of the LEDs will correspond to the percentage of HIGH and LOW signal. If the signal is a fairly low frequency, the LEDs will "oscillate." The oscillations don't correspond to the frequency but are simply a notification of its presence. 
Now we come to the other half of the project. 
The Logic Pulser section is designed to produce a low-frequency HIGH-LOW waveform that can be injected into a LED to turn it on and off, or into a speaker to produce a buzz.  The current from the Pulser is limited to about 20mA so that if you touch any point on a project, the component will not be damaged.  However, the current is just enough to turn on a LED and prove it is connected around the correct way.
The clever part of the project is highlighted by the dual feature of the Logic Pulser. The output goes HIGH-LOW at approx 2Hz  and every second pulse consists of a HIGH that has a 1kHz tone contained within the HIGH. This means you can probe a speaker and it will produce a 1kHz beep. 
To create all these features with individual chips would take 2 or 3 chips and the board would be twice the size. But with the PIC12c508A, this project can be made very compact and low-cost. 
Most Logic Probes are fairly expensive, because they come in a fancy case. The skill is to produce a cheap probe, and that's what we have done. The only difference is the speed of operation. Some of the expensive probes will detect very brief pulses. Our probe is only suitable for pulses up to about 1/10 microsecond - that is: circuits with a frequency of 10MHz - or a glitch of a similar duration.
But our probe has other advantages. It has an audible output as well as visual. This means you can hear what you are doing and speeds up the process of checking a layout when you have a lot of points to test.  
Some time ago Talking Electronics produced a Logic Probe with an audible output. But it required a lot of components. The '508A micro (or F84) has simplified the project to less than 20 components!

We have provided a circuit for both the PIC16F84 chip and PIC12c508A chip. Both circuits are the same and use the same program. The only difference is the R-C oscillator components for the F84 micro. The '508A has an inbuilt 4MHz oscillator. The only other difference is the 33k on the input line to make sure the line goes low. The 16F84 required a 100k to keep this line low but the '508A needed 33k - possibly due to the older technology in the chip.
The diagrams below show the two circuits:

Click for PIC16F84A datasheet (pdf)

In this article we show how you can build either version and the chip you use will depend on if you want to burn your own program using a PIC12c508A-blank
(a blank or empty '508A) or a PIC16F84 or buy a ready-programmed chip (PIC12c508A-Logic1). 
That decision is covered in other parts of the article. In this section we will explain how the circuit works. 
First we have to explain why the circuit is so complex. It's mainly because the PIC chip is not able to detect a tri-state input and this has necessitated a little extra circuitry. 
The tip of the Logic Probe line must be able to detect a HIGH and LOW input as well as when the tip is not connected to anything. This is a tri-state requirement but the input to the PIC chip can only detect a HIGH or LOW. 
The second problem that has to be addressed is the fact that when the probe is not connected to anything, none of the tones must be emitted. Most of the Logic Probes using a PIC chip have LEDs as the indicators and one LED is always glowing before and after a test procedure. This has to be avoided with tones as it would be quite annoying. 
To get around the problem the program was written to take the probe line HIGH and LOW very quickly and monitor the input to see if it reflected the way the line was being driven. 
If it did, the conclusion is the input is not connected to anything. 
If the line remains HIGH, the HIGH tone will be produced and if it remains LOW, the LOW tone will be produced.
To detect a pulse or frequency, the input line is taken HIGH-LOW 8 times and if the high and low values do not match-up, the conclusion is an input frequency is being detected. 
This is the requirement, now it's necessary to put these requirements into a program along with a 2Hz frequency on the pulser line to test a LED and speaker and a beep after 5-minutes to tell the user to turn the probe off.  
That's the requirement of the project. 
Firstly we will look at the circuit in detail. 
The front-end consists of an emitter-follower stage (also called a common-collector stage). We have studied this circuit in our basic electronics course (page34 and page35) and shown how raising the base causes the emitter to rise. This is the type of stage we need since the input has to rise to nearly rail voltage for the circuit to detect a HIGH.  The stage has another advantage. It creates a high-impedance input so that the Logic Probe does not "load" the circuit it is testing. (Read about the meaning of LOAD THE CIRCUIT in the basic electronics course, page 29). 
This stage amazingly converts the Logic Probe from a 1MHz Probe to 10MHz Probe. It does this by charging a delay circuit made up of a 100k resistor and 47p capacitor. When the tip of the Probe detects a very fast pulse (signal) it passes it to the base and the transistor rises very quickly. The emitter rises and charges the 47p capacitor and the transistors falls back. The capacitor remains charged for a few more microseconds (it is discharged by the 100k resistor). The program produces a "window" of about 12 microseconds in which the input is read 5 times. If the pulse or "glitch" occurs during this "window," the circuit will pick it up and the program turns on the HIGH LED. 
The program produces this window every 22 microseconds for more than 1,000 loops then output a LOW to the pulser section and repeats the above. If the signal is from a high-frequency oscillator (or repeated glitches), it will keep charging the capacitor at regular intervals and the program will flash the HIGH LED. 
The 10k resistor on the base of the input transistor prevents damage to the transistor if the voltage is above 6v. 
The Logic Pulser section has a 100R resistor to prevent damage to the output of the micro, if the tip is placed in a short-circuit condition. The 100R resistor also limits the output current to less than 25mA so that it will not damage any circuit being tested. 

As you can see from the diagrams above, we have provided two versions of the Logic Probe with Pulser. One version uses the PIC16F84 chip and the other uses the PIC12c508A chip. They both work the same and they are basically identical but the circuit you choose will depend on your programming facilities.
As you know, this project is part of a course to get you into programming PIC chips. The whole aim is to master this field as cheaply as possible. We have done everything to keep costs down and many experimenters will be able to do this course with very little outlay. 
However some things cost money and even the cost of downloading and using the phone-line is an expense, so some costs will inevitably be involved. 
This project can be constructed on matrix board, using your own components and all you will need to buy is a PIC chip. Or you can buy the PC board separately, or a complete kit. If you have bought the Multi-Chip Programmer, you will be able to program your own '508A PIC chips and build the '508A version of the Logic Probe. 
We have produced two PC boards, one for the '508A and one for the F84. This gives you at least three different paths to follow:
1. Build the '508A version using a pre-programmed chip. or
2. Build the '508A version and burn the chip yourself (you will need the Multi-Chip Programmer)  or
3. Build the F84 version and burn the chip yourself - this gives you the opportunity to work with the program and change any of the features. 
To cover all the possibilities, here is the list of parts and kits you can buy for the Logic Probe with Pulser.

LoPIC  - '508A version 
All components incl batteries, PC board & pre-programmed '508A-logic1 chip

LoPIC PC Board  - '508A version 
LoPIC  - '508A version 
All components incl batteries, PC board & Blank  '508A chip
 (you will need the '508A programmer - our universal programmer)
LoPIC  - PIC16F84 version 
All components incl batteries, PC board & Blank PICF84 chip
(you will need a PICF84 programmer - Use the: 5x7 Display Project or our Universal Programmer)

PIC PC Board  - PIC16F84 version 

Colin Mitchell recommends the Logic Probe with Pulser-PICF84 version. You can work on the program and change any of the features. 

PARTS LIST with F84 chip

1  -  100R    1/4 watt
2  -  220R        "
2  -  4k7          "
2  -  10k          "
2  -  100k        "
1  -  22p NPO ceramic
1  -  47p ceramic
1  -  3mm red LED
1  -  3mm green LED
1  -  1N 4148 signal diode
2  -  BC 547 transistors or similar
1  -  18pin IC socket
1  -  mini piezo diaphragm
1  -  on/off slide switch
4  -  LR932 button cells
1  -  black earth clip
1  -  30cm black hook-up flex
1  -  30cm tinned copper wire
1  -  30cm very fine solder 
2  -  long pins for probe tips
1  -  PIC16F84 microcontroller chip
                                        need to program the chip
1  -  Logic Probe-F84 PC board
(You will need  the  Universal Programmer to program the chip)

PARTS LIST with '508A-logic1
with pre-programmed chip

1  -  100R    1/4 watt
2  -  220R        "
1  -  4k7         "
2  -  10k         "
1 -  33k          "
1  -  100k        "
1  -  47p ceramic
1  -  3mm red LED
1  -  3mm green LED
1  -  1N 4148 signal diode
2  -  BC 547 transistors or similar
1  -  8pin IC socket
1  -  mini piezo diaphragm
1  -  on/off slide switch
4  -  LR932 button cells
1  -  black earth clip
1  -  30cm black hook-up flex
1  -  30cm fine tinned copper wire
1  -  30cm very fine solder 
2  -  long pins for probe tips
1  -  PIC12c'508A-logic1
Pre-programmed chip
1  -  Logic Probe-'508A PC board
(You will need the Universal Programmer to program the chip if you don't buy the pre-programmed chip)


The program is basically very simple. But since it has two different features (in the Logic Probe/Pulser section), running at the same time, the complexity builds up. 
There is also another section called "Sounds" on the "Going Further" page. We will not be covering this section at the moment.
First of all, let's try to simplify the Logic Probe/Pulser program. 
When a Low is detected, a LOW tone is emitted from the piezo and the green LED is illuminated. When a HIGH is detected, the HIGH tone is produced and the red LED is illuminated. When a Pulse or oscillation is detected, both the HIGH and LOW tones are produced and both the red and green LEDs are illuminated. Depending on the proportion of the HIGH and LOW signal,  the LEDs will have a varying degree of brightness and if the frequency is very low, the LEDs will oscillate. If a glitch or pulse is detected, the red LED will flicker.
The program is also required to produce a 2Hz pulse from the PULSER section that is suitable for testing both a LED and speaker and after 1 minute of non-operation the project sends out a burst to tell you to turn  it OFF
Both these programs are running at the same time and this can be seen in the Main routine. The Main routine consists of 4 parts. It starts by producing the LED ON period of time shown in the diagram below. This takes 1/4sec or 250,000 cycles. The next part of the Main routine produces the LED OFF time and this also takes 250,000 cycles The third section of the Main routine toggles the Pulser line and produces an output that produces an on-off waveform at the equivalent of 1,000 times per second. The final part of the Main routine is identical to the LED OFF section. 
These 4 sections are constantly looping and the signal it produces appears on the PULSER line. 



But the more-complex section is the LOGIC PROBE. It has a bigger job to do and requires a lot more thought in programming.
The first complexity is the need for a tri-state input. The Logic Probe must be able to detect a HIGH, a LOW and when the probe is not connected to anything. But the input of PIC chip is not tri-state. So, something has to be done to create this feature.
If a tri-state input is not created, when the tip is "floating," the input will detect either a high or low and one of the LEDs will be illuminated. But more annoying is one of the tones will be produced. 
To prevent this, the input is taken HIGH-LOW via another line and if the program detects the tip as following the high-low signals, it interprets this as a high impedance (floating) state and all tones and LEDs are turned off. 
When probing a digital project, any signal will easily over-ride the signals we are giving the "font end" 
and the program will respond by turning ON the tones and LEDs. 
Since the program responds very quickly to the signals on the input, the sound from the piezo and the illumination of the LEDs will provide a variety of effects. 
It is very easy to determine if the signal is a constant HIGH or LOW or the amount of activity (frequency) on the line. Even a 1uS pulse (glitch) will be picked up. 
Obviously this is not a 100MHz logic Probe but it is certainly suitable for all the digital projects we will be describing in the PIC series. 
The secret in the design of the Logic Probe is in the front end. We have described the operation of the transistor in the front end and now we will see how the program uses the information it gets from the input line (pin9) to turn on the appropriate LEDs and tones. 
Take one small portion of the routine where the output line RB4 is HIGH and this sends a HIGH to the input line (pin 9). If the tip of the probe is not connected to anything, the input will detect a HIGH. If the tip is connected to a circuit and a HIGH is present, the input will also see this as a HIGH. It is the "intelligence" of the program that determines if the HIGH is to be counted as "HIGH IMPEDANCE" or a "HIGH." We will cover this in a moment. One feature of the front end is the "pulse extender" consisting of the 47p capacitor on the input line. This capacitor is charged every time the line goes high and is gradually discharged through the 33k or 100k resistor across it. This capacitor extends very brief pulses so that the micro sees them as a HIGH. 
The input line is only open for a period of 1uS at a time and if the pulse is not present at the exact moment, the micro will not detect a HIGH. Even if the input is open for 2uS, it is only the last 1uS that records the information as the micro must read the line and during the next few instructions it deals with the information it receives. 
This takes a minimum of 2-3uS and the line can be open again for another measurement. 
This is exactly what we have done. We have read the line 5 times, in quick succession, during the "Input" sub-routine and this gives us a very good chance of detecting a pulse (or glitch). These are signals that appear only once in a very long (computer) time.
Opening the line like this is called "gating the line" as it is not open all the time. You have to be lucky to detect a signal, but if the line is open on a regular basis, the chance of detecting a signal is very high. 
Now, how does the program determine if the HIGH is from an external source or part of the "high impedance" determination? 
In the "Input" sub-routine, two files are incremented. File 1E is the HIGH file and 1F is the LOW file. The routine sends out a HIGH on RB4 and the state of the input (RB3) is detected. If it is HIGH, file 1E is incremented, if it is LOW, file 1F is incremented. This is repeated 8 times and any combination of results will be obtained, depending on the waveform being detected. 
The program then goes to another sub-routine "TestA" and makes an assumption that if the number of HIGH's is less than 3, a pulse is present. 
If the HIGH's and LOW's equals 8 each, the assumption is "High Impedance" and nothing is turned on. 
If the number of HIGH's is zero, the program assumes the input signal is a constant LOW. 
If the number of LOWs is zero, the program assumes the input is a constant HIGH.   
The program then goes to another sub-routine and turns on the appropriate LED and activates the piezo. 
Every time the Main routine makes a loop, it increments the "Alarm" file (file 11h). This file is then tested to see if it is 40h. At 40h the program goes to Alarm to beep the piezo to tell the user to turn off the project. If the Logic Probe is in use, file 11h is zeroed and only after 1 minute of non-use is the beep produced. 
The only technical (difficult to follow) instruction in the program, which we have not covered in our discussion,  is the subtract operation and test the carry flag. This is covered in our theory section in the Library of Routines under Comparison.

The last three lines of the F84 program set RB5 to output. I know this keeps resetting the line to output but the instructions in the Start routine did not always set the line and when the LoPIC probe was turned on (on some occasions), the output was very weak. The problem is in reset, and although an internal delay is activated to allow all the lines and files to settle-down before programming starts, this does not always solve the problem. 
If you encounter a fault like this, introduce a delay before the program or repeat the set-up instructions.  

Obviously the LoPIC program could be improved. It all depends on how you consider a good program should be laid out and how you like to create each of the operations. We have especially kept the routines simple so you can follow them through and see how they work.
However this does not stop you looking at the program and seeing what changes can be made to reduce the byte count. You can even devise different ways to do a particular task. 
You can also add features and modify those we have produced. The more you work on the program the more your programming skills will improve. We have already reduce some of the routines. We shortened the Alarm routine by introducing an instruction to toggle the Alarm line and this saved 10 instructions. We introduced a Delay routine for the Main routine and this saved a few lines of instructions. In fact the program has gone through more than 30 revisions and corrections and improvements. Getting the program to work with the '508A took a lot of problem-solving, until we realised the 100k front-end resistor had to be reduced to 33k. 
All the problem-solving was done with the two tricks we have covered in our PIC Programming Course. The first trick is to place a "Stop" instruction in the program to see how far the micro has progressed through the program. 
Anywhere in the program, insert the two instructions:

Stop   NOP
          GOTO Stop
Make sure you remove the instructions after use.

If you need to find out if the micro has reached a particular location, introduce a Tone routine.
At any location, insert the following instructions:

Tone1        MOVLW 080h       ;The duration of the High & Low 
                 MOVWF 15h 
LoopX        DECFSZ 15h,1 
                 GOTO LoopX 
                 MOVLW 20           ;To toggle GP5 
                 XORWF 06,1         ;Toggle GP5 
                 GOTO Tone1 

If you want to check the situation at another location, remove the instructions above and insert the following at the new location. Use a Tone with a different frequency, so that you know the new location has been reached:

Tone2        MOVLW 040h       ;The duration of the High & Low 
                 MOVWF 15h 
LoopY        DECFSZ 15h,1 
                 GOTO LoopY 
                 MOVLW 20           ;To toggle GP5 
                 XORWF 06,1         ;Toggle GP5 
                 GOTO Tone2 

This project has two main uses. It detects the "condition" of a line - HIGH, LOW or SIGNAL via the Logic Probe section, while the other end tests devices such as LEDs,  speakers, coils etc. The Logic Pulser will also act as a "signal injector" for testing and repairing audio equipment or as a "digital injector" to "clock" digital lines. 
You can use the Logic Probe as a CONTINUITY TESTER (because the green LED comes on when zero voltage is detected between the tip and clip), however you have to be careful as a Continuity Tester is really testing for zero potential between two points and if, say, the two points have a 1.5v cell in line with another 1.5v cell around the opposite way, the potential between the two points would be zero, but you could not classify them as having "continuity" as the word continuity means a direct path. The Logic Probe will produce a low tone and the green LED will illuminate but the two point will not have a DIRECT PATH!
However, when it's all said and done, it's a multi-function piece of test equipment that will come in very handy. The amazing thing is, it uses less than 20 components!
Now, to using the project. Don't forget, the project is two pieces of test equipment in one. It's a double-ended project and because of the large amount of information we have produced on its use, we have covered them both separately.  

 Go to: "Constructing the Logic Probe and burning the chip"