making a scope using PIC16F877a and RS232 and Computer prog.

Status
Not open for further replies.

TKS

New Member
Because i have no idea of what a scope can do apart from the basic.

and i needed one on a sunday, i thought of making one the easy / fast way.

soow i hooked up an pic to max 232 to pc..

and now i send 2 channels from de adc values to the pc.

because i have no idea what kind of functions i need to make in it

i started with the basics..
here a screenshot.

ohja what kind of sample time is wise to use?? uS?? i now use 200..??

regards,

TKS
 

Attachments

  • scope.jpg
    32.2 KB · Views: 1,714
Re: making a scope using PIC16F877a and RS232 and Computer p


This sort of thing is more a datalogger than a scope, it will only have a limited sample rate, limited by the speed of the conversion - and also by the speed of the transfer to the PC.

How fast is your RS232 running?, and are you using 8 or 10 bit samples?.
 
I agree, this solution is not gonna be fast enaugh... Maybe if you use paralel port, you could get to 600Khz maybe to 1Mhz, but that's it... If you use USB (which is kinda complicated) and a realy fast AD it would look more interesting...
 
uCs are essentially too slow for a practically useable scope. That's why diy scopes often involve FPGA solutions.
 
Looks like you made the software in visual basic. Do you think you could post a copy of the source code? I have used VB a few times in the past for simple serial stuff but I learned it all on-the-fly, so I really don't know how to do anything other than the few simple things that I have done already, and would really like to know how you accomplished the plotting of the data like that.

Although not good for high-speed, I think that a device like this could be handy in some situations, like making a low-speed logic analyzer or something. a fun project, at least...

Of course you could throw in an FPGA and some high speed ADC's and make a moderate-speed scope but that's a lot of work.
**broken link removed**
 
well...

i don't how to calculate it but have tested a bit arround

and i have tested 2 things...in the pic i start with a mesnr 1 wich every measurement i increment it up..

then on the pc side on the graph i replce the graph value with the measure ment value (the colum= mesuere ment nummer).

the problem i saw that the data arrived a bit strange in the port...

now i have deleted that port of code and now i simpel look wich channel and that line add a new value to the next column..

the serial speed = 38400Charc/sec (Baud) the sample quality = 10bit (as you see in my prog settings states 1024 steps 5volt ref.

the sample time is 150uS (think i need to increase..)

well that's it.

source code?? what i do there is soow basicly simple that you would see nothing..

i think you need to study / use de MSDE more.

u need the biggest version of visual basic to use the comm object.
my settings where (38400,8,n,1) its easy..

the only thing i used also the graph think, maybe i'm gonna change this with a self written routine using line command on form.

it should be faster...etc..


p.s. anyway it was useful because 10khz(if it is) of scope is always more than a multimeter.. :lol:

and i saw when looking @ the send enable lin of the max485 very interesting graphs....

TKS

p.s. de clue is the next part of VB code:

data=Mscomm1.input ''now data has all the recieved stuff
''my measurement arrived this way:'1:50 2:560 '
''mesearue number then a ":" then the value then a space.

then i use this:
ddata() as string ''makes a string possible wich is cut in parts...
ddata()=Split(data," ") now ddata contains all the data but seperated

ddata(0) ''contains1:50 and ddata(1) contains 2:560

now i simple split agian and i have seprated in 2 diff vars the mesnr and the val. its easy..

TKS
 
You're using 38,400 baud (BPS), that gives an absolute maximum transfer of 3,840 bytes per second - as you're using 10 bit resolution, you need to send two bytes per reading, which for two beams is 4 bytes in total. This gives 3840/4=960 - 960 samples per second, ignoring the time actually taken to read the samples.

Dropping to one beam would double this, to 1920 samples per second, and dropping to 8 bit resolution would double it again, to 3840 samples per second.

As it stands your bandwidth is only about 200Hz or so, and you should put lowpass filters on the inputs at this sort of frequency.

Like I said before, more a datalogger than a scope - but still VERY useful.
 
..

for example

how fast is a multimeter of mid-range ???


i was also thinking for more speed of using a serial eeprom

and write in it the samples then stop the sampling (what hapends will be in de eeprom...) then empty the eeprom to the pc..

maybe using another pic to do this??
how fast would it then be?? i only forgot that writing to a eeprom is slow.. soow 1200samples sec will be max then i guess..

let it be..

well at least i have now the max 485 working...

now the protocol ****...

some times i feel with those pics that we are working how the guys @ microsoft started with ugly chip // difficult debug etc..

any one good solutions for debug..??

TKS
 
Yes, EEPROM is far too slow, what you can do is use static RAM - a 16F877 has enough spare I/O to do the address and data lines for it.

EPE did just such a scope a number of years ago, using the parallel port to connect to the PC. But it's performance is still very low.
 
...

How works a normal scope then?

And what is what it does?



and the soundcard based ones is that something?? or not??

TKS
 
Re: ...

TKS said:
How works a normal scope then?

And what is what it does?

A 'normal' scope is purely analogue, the incoming signal is amplified and used to deflect an electron beam vertically. At the same time the beam is deflected horizontally by a sawtooth generator - this is triggered by a portion of the incoming signal to provide syncronisation.

and the soundcard based ones is that something?? or not??

It's a simple digital oscilloscope, where you digitise the incoming signal at a high rate (after passing it through a low-pass filter) and store the samples in memory. The soundcard hardware limits the frequency response, as it's only intended for audio use, but you don't have any transfer speed problems because it's already inside the PC.

A full digital oscilloscope uses extremely fast A2D, and fast memory as well, at the sorts of speeds where layout is critical.
 
what would you do for pic use??

a soundcard one??

or the one that i made??

or just search a old scope?? what does a scope i mean apart from wich information it gives you does it alter the data anyway??

o is it always live what you see??

TKS
 
TKS said:
what would you do for pic use??

a soundcard one??

or the one that i made??

If you can get hold of a real scope for a decent price, it will be much, much, better than either - but a soundcard scope is going to be better than a simple PIC one (compare the processing power!).

or just search a old scope?? what does a scope i mean apart from wich information it gives you does it alter the data anyway??

o is it always live what you see??

An analogue scope is simply 'real time' you see it 'as it happens', or miss it because it was too short an event!.
 
fast eeproms and scopes using PIC

If fast eeprom are needed then here is an alternative solution. EEPROM without write delays.

http://www.ramtron.com/doc/Press/faqs.asp

Bitscope use PICs in their scopes and they have used serial transmission between scope and PC. Newer scopes are though using Ethernet and USB instead of RS-232.
As you might have already guessed. PIC haven't been used doing A/D sampling, but doing other tasks.

http://www.bitscope.com/design/?p=2

Great job TKS !
 
this is my pc storage scope..
what i do is get a sample , store it in an array , then i can either save it to look at it again , or not..
 
the two main knobs on a scope are time per division and volts / division..
the time /div knob expands and contracts the horizontal scale ..
on my scope , which is not new , goes from .5 sec/div down to .05 uSec /div
 
Can you explain resolution

Hello ,
Can anybody tell me what is resolution of your oscilloscope.
Is it possible to measure 0.01 micro second using PIC.. I think your discussion could help me .. If you dont mind anybody who want discuss about tachometer using PIC can post me messages.. I am in trouble .need help of yours..
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…