PICAXE Logic Analyzer

George Sephton

Senior Member
Hi All,
I was considering building myself a logic analyzer but I figured I should ask a few questions first. Like I'm not entirely sure what one does. At the moment I have a device in mind that has a probe that will simply store the value (1 or 0) of that probe for X number of samples when the user hits go and then that can be displayed. This would effectively just need a PICAXE and a RAM chip that supports fast write speeds and then the values could then be stored. However this seems a bit simple given that Logic Analyzers cost £80 upwards. What else do they do and would be first idea be a good way of doing things? Can I simply attach a probe to an i2c bus (for example) wire and then connect the other end to the input of a PICAXE or will it interfere??
Thanks,
George.
 

eclectic

Moderator
I suggest two things.

1. A bit of research on what an analyser does.

2. Use Advanced search using both terms

logic analyser


The LA project has already been successfully made
using Picaxe.

The fun is in the finding out. :)

e
 

graynomad

Senior Member
A logic analyser using external RAM chips typically requires input latches, address generator, pre/post sample counter, trigger logic, and some dual porting for the data on the RAMs. It's not rocket science but does need quite a few chips.

Another popular option is to just sample IO and store internally to the processor, this is very simple but also very limited.

And somewhere in between these two options you can use SPI SRAM chips or FIFOs to do the sampling, they have just about all the above hardware included and can sample at 20MHz+.
 

womai

Senior Member
The problem is less the principle, this can be as simple as you describe, but to do the sampling fast enough. Rule of thumb, for a LA you need at least a factor of 4 oversampling, so to look at the I2C bus running at e.g. 400 kHz you'd need to acquire samples at 1.6 Msps (1.6 million samples per second). The Picaxe will be hard pressed to do much more than maybe 1000 samples/sec. A PIC programmed in assembler or some compiled language (e.g. C) can do up to ~1 Msps. A somewhat professional logic analyzer for hobby use needs to do at least ~20 Msps to be useful for I2C, SPI etc. Typical approaches to get there are:

- implement the sampling in digital logic - e.g. with 74xx gates or, more modern, a CPLD or FPGA. That can go up to hundreds of Msps.
- stream data in real time over USB to your PC - allows huge data sets but limits speed to around 24 Msps for USB 2.0. The Saleae logic analyzer works that way.

There are a few low-end microcontroller based LA designs out there as well. Incidentally, once I get back to working on my DPScope SE (see separate threads on this webboard) it will include a 4-channel LA. I hope to get to a few 100 ksps, sufficient for most Picaxe work. Storage with these designs is often in microcontroller-internal RAM, so limited to a kB or so.

Another area where there are huge difference in LA capabilities is triggering, i.e. deciding when to start capturing. Good LAs allow for very advanced trigger conditions (e.g. start when channel 1 is high, channel 2 is low, channel3 just had a transition from low to high, etc. etc.)
 

George Sephton

Senior Member
I have done research and I know there are dozens of tutorials about usb/parallel port logic analyzers but I was looking to build a handheld thing. I'm not particularly fussed about speed right now because if needs be I'll move this up to a more advanced microcontroller but I wanna start simple atm. I wud basically just sample an input pin for however many samples (that would be stored in ram) and then generate an image to display on an LCD display (or whatever). What I was wondering was how attaching a probe to a signal line and inputting it into a picaxe would affect the signal? Like picaxe inputs would be pulled high which would affect the signal so how could I go about doing this. I've seen a lot of tutorial use the 74HC245 and that seems like the way forward I just don't understand what that IC does...??
Cheers.
 

srnet

Senior Member
What I was wondering was how attaching a probe to a signal line and inputting it into a picaxe would affect the signal?
If the the PICAXE pin is an input, and the PIC is operating at the same voltage level as the signal line you are looking at, it will have little effect in the digital sense.

However one of the issues to consider is that make a mistake on where you connect the PICAXE pins too, or in the supply volts of the circuit you are looking at and it can be goodbye PICAXE.

So some sort of buffer, that can be replaced, and has input protection is a good idea.

A 74HC245 is a octal bus tranciever, a bi directional buffer.
 

graynomad

Senior Member
attaching a probe to a signal line and inputting it into a picaxe would affect the signal?
Any microprocessor has very high impedance inputs, you won't affect the "normal" logic circuits of the type you'll be testing.

Like picaxe inputs would be pulled high
By what? They will be driven high or low by the circuit you are measuring. You may have a pull up or down resistor I suppose to cut noise on unused inputs.

74HC245 and that seems like the way forward I just don't understand what that IC does...??
That is a buffer chip, it's normally a good idea to use one to protect the processor pins from the big bad world. Better to blow up a 245 than a Picaxe. Having said that there are many simple LAs and logic sniffers etc that don't use them. I would.
 
Top