Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 28th September 2008, 05:00 PM   #1
Default Oscilloscope from a PIC

Does anyone have any tutorials or links on how to make a simple PIC oscilloscope?

I just want to make one so i can measure pulses. I would like to make something like the PICkit 2 Logic Analyzer. It would basically start from a interrupt.

Measure the time High
Measure the Time Low

I dont care about visuals like waves and stuff i care more for numbers. Like a result should be like:

High 7us, low 22us, high 7us, low 22us, low 20us, high 14us, low 22us.

Hence it will display the information of the input for a specific period of time. Or Collect the information in a buffer of some sort and then save the buffer to eeprom and output the eeprom to pc.

The only thing i need help on is the timer and that rising edge and falling edge stuff. So any links or tips or anything of the sort would be awesome. Thanks !
AtomSoft is online now  
Old 28th September 2008, 05:09 PM   #2
Default

atom, if you do not want to fetch the signal shape, then you want to build logic analyser and not the scope...

check out:
PIC16F873: http://www.geocities.com/ted_rossin/...#LogicAnalyzer
PIC18C252: http://www.edn.com/article/CA56161.html
different PIC's: http://pe1grl.khds.nl/picla.htm
PC Parallel port: http://et.nmsu.edu/~etti/winter97/co...gic/logic.html
PC Parallel port: http://hackaday.com/2008/01/28/paral...ogic-analyzer/

and do not forget to check out the topic on this forum where ikalogic is making the LA but AVR based:
AVR based logic analyzer.

Last edited by arhi; 28th September 2008 at 05:11 PM.
arhi is offline  
Old 28th September 2008, 05:22 PM   #3
Default

Quote:
Originally Posted by AtomSoft View Post
Does anyone have any tutorials or links on how to make a simple PIC oscilloscope?

I just want to make one so i can measure pulses. I would like to make something like the PICkit 2 Logic Analyzer. It would basically start from a interrupt.

Measure the time High
Measure the Time Low

I dont care about visuals like waves and stuff i care more for numbers. Like a result should be like:

High 7us, low 22us, high 7us, low 22us, low 20us, high 14us, low 22us.

Hence it will display the information of the input for a specific period of time. Or Collect the information in a buffer of some sort and then save the buffer to eeprom and output the eeprom to pc.

The only thing i need help on is the timer and that rising edge and falling edge stuff. So any links or tips or anything of the sort would be awesome. Thanks !
hi atom,
Look at the PORTB.0 input as the trigger input.

Use a 10MHz xtal if you need a good timing resolution.
__________________
Eric " Good enough is Perfect "
I will NOT answer PM's requesting technical help, please use the Forum
PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/
ericgibbs is offline  
Old 28th September 2008, 06:40 PM   #4
Default

arhi: Thanks a bunch.. after i eat some lunch ill take a look at them.

Eric: I have some (3 or so) 20mhz crystals (1 resonator) and some 8 and 4 mhz also. I suppose for best timing i use the 20 MHz so i can get faster input. (am i right?)
AtomSoft is online now  
Old 28th September 2008, 09:37 PM   #5
Default

Yes, the faster the clock the finer resolution you'll get. Use the CAPTURE/COMPARE
MODULE in conjunction with a timer for best accuracy. What PIC did you have in mind?
__________________
Inside every little problem, is a big problem trying to get out.
kchriste is online now  
Old 28th September 2008, 09:45 PM   #6
Default

I was thinking about using a PIC18F448 or Similar like a 248 or even a 18F4525 or well anything i have that can run at 20MHz... 18F4620 etc...

I dont thing it matters with 18F pics. Most are the same almost or maybe ALL do have A/D and timers and most have Compare/Capture stuff so ill be set as long as its fast enough. Time to look at those links thanks again guys. If you have any other thoughts or tips ....

...Keep em coming...

Last edited by AtomSoft; 28th September 2008 at 09:45 PM.
AtomSoft is online now  
Old 28th September 2008, 09:57 PM   #7
Default

wow after i make this (for fun now) i will buy this maybe in like 1 month:

http://www.saleae.com/logic/features...FQHHGgod0HxWEA
AtomSoft is online now  
Old 28th September 2008, 10:13 PM   #8
Default

Quote:
Originally Posted by AtomSoft View Post
wow after i make this (for fun now) i will buy this maybe in like 1 month:

http://www.saleae.com/logic/features...FQHHGgod0HxWEA
Looks nice. Might be a very handy tool sometimes.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline  
Old 29th September 2008, 06:04 AM   #9
Default

Quote:
Originally Posted by AtomSoft View Post
wow after i make this (for fun now) i will buy this maybe in like 1 month:

http://www.saleae.com/logic/features...FQHHGgod0HxWEA
Nice catch! The price isn't bad either ~170$

Could be handy.

BTW There was an article in one of the electronics rags last year, I think it was Everyday Practical Electronics, with a four channel logic analyzer. Nice and simple. I would find the reference, but I'm in the middle of moving right now.

Last edited by BeeBop; 29th September 2008 at 06:07 AM.
BeeBop is offline  
Old 29th September 2008, 06:07 AM   #10
Default

What i recommend you use a dsPIC33F since they run at up to 160Mhz and it has a DMA. What the DMA dose is move data between preperials and ram or other preperials, and it dose it really fast and best of all without the CPU doing anything. I guess that would allow you to sample a port at 40Mhz.

Doing this on a 18F will probably end up with like 1 or 2 Mhz sample rate since they only go up to 10MIPS and the CPU has to do it all.

Also for analog signals some PICs can run the ADC at a 2Mhz sample rate. That could make a basic oscilloscope for simple things.

But your best method of making a logic analiser is a FIFO buffer chip. Basicaly you just clock the write pin with the sample rate you want and send the sigals in the data pins. A pic can then read out the buffer and send it to the PC. With this method its possible to get 200Mhz sample rates.
__________________
Il give you shocking experience.
Someone Electro is offline  
Old 29th September 2008, 10:47 AM   #11
Default

SomeoneElectro, can the dsPIC move the data from PIC to external RAM (parallel or spi) ?

for "just a logic analyser" I made (some time ago) LA that sampled data directly into RAM chips, and PIC was used only to select/start/stop external oscillator that was clocking the ram (and d-latch) and to read data from RAM and forward to serial port .. nothing else (no sampling done on PIC itself) and it was "ok" ..

If I do sampling on the PIC, can you write a "few line example" (pseudo lang .. just so I can see the techique) how can I "move" that data to external ram (as with high frequency sampling, storing data in PIC will give useless amount of data)


atom, for the LA itself, the application that is going to interpret the data is much more complex then the device collecting data ... fairly simple circuit (you have bunch of links now) will sniff out most of digital data running around the board, problem is interpreting is, the simple "show / measure" is not that hard to develop (you have bunch of sources around to use), but if you want to interpret / debug SPI, I2C, RS232, CAN..... you need much more complex software on the PC side (like app that comes with that device you posted link to)
arhi is offline  
Old 29th September 2008, 07:31 PM   #12
Default

Depending on what you need this for, you might consider either buying or building a pickit2 and using the microchip logic analyzer. Not super high speed but $35 or less...
philba is offline  
Old 30th September 2008, 12:59 AM   #13
Default

Quote:
Originally Posted by philba View Post
Depending on what you need this for, you might consider either buying or building a pickit2 and using the microchip logic analyzer. Not super high speed but $35 or less...
Since Microchip came out with the LA tool for PICkit2 I use my Junebugs instad of my analog scope for quite a few tasks. It is great for serial communication debugging.
__________________
Please post questions to the forums. PM's are for personal communication.

BCHS/3v0's Tutorials
Junebug USB PIC programmer kit., USB Bit Whacker,
The 15 Minute Printed Circuit Board! (+drill time)
3v0 is offline  
Old 30th September 2008, 03:50 AM   #14
Default

By the way, does anyone know the minimum you have to implement to to support the LA tool? My guess is GND, PGC, PGD, AUX and Vcc feedback circuits. Skip all the Vpp generation and control, I suppose. I'll give it a try someday.
philba is offline  
Old 30th September 2008, 07:31 AM   #15
Default

Nope, moveing data trough the pic in to external ram is too slow.You need a ram chip and feed it the data directly while giving it clock.The pic can however detect the triger start, to begin sampleing.. That's the best easy way to make a high speed analiser. I find the pickit 2 built in analiser too pour for bigger use. The 1Mhz only sample rate is offten too slow but mostly the small storage. Also it dosent decode serial lines. Meaby I'll make a 100MHz analiser with a few Megs of memory and serial decodeing. I just have to get around too it.
__________________
Il give you shocking experience.
Someone Electro is offline  
Reply

Tags
oscilloscope, pic

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
will this oscilloscope be enough? patroclus General Electronics Chat 18 8th February 2008 07:17 PM
The Oscilloscope ElectroMaster Electronic Theory 12 3rd February 2008 02:45 PM
What oscilloscope do i need? OY2L General Electronics Chat 9 25th December 2007 07:48 PM
TWD-120 oscilloscope help jpanhalt General Electronics Chat 4 2nd November 2007 11:20 PM
Which oscilloscope would you want??? pike General Electronics Chat 13 17th February 2004 09:40 AM



All times are GMT. The time now is 12:47 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker