New project USB scope.

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
New project USB scope with FFT.

Just started on a new project, a USB scope.
It has 8 levels of voltage input.
It currently has 8 levels of time base but I will expand that.
Uses a PIC usb micro.
Uses a 4051 analogue selector, a TL2272 rail to rail op amp and a 7660 negative voltage generator.

http://www.ckpr.talktalk.net/usb1.pdf
http://www.ckpr.talktalk.net/usb2.pdf
 
Last edited:
Found a couple of problems.
I accidentally put 15pf instead of 220nf for ac coupling.

RAM address line A9 was running beneath input resistor and was adding glitches to the input signal. I have rerouted this with a wire link.

I got thrown a bit by the Microchip C18 compiler in its order of operations.
if (ax&1==1) needs to be if ((ax&1)==1) to work properly.
You live and learn.
 
USB oscilloscope.

I cant find my previous thread on this so started another one.

I use an op amp with a 1meg input resistor.
In the feedback loop of the op amp I have a 8 way analogue multiplexor to attach different resistors for voltage gain.

On my first design I just used the PIC18f4550 a2d controller to capture data.
With this the highest frequency I could capture was around 2KHz with 45000 samples per second
The data is put into a memory chip as the PIC is a bit poor on RAM storage.

On my latest design I use an external a2d which is running at 1 meg samples per second.

The pc software is just a simple graticule display.
I have added move waveform up/down and left/right.
I have also added two movable pointer so I can measure between two points time and volts.
An externally hosted image should be here but it was not working when we last tested it.

An externally hosted image should be here but it was not working when we last tested it.
 
Last edited:
I decided to flash an LED if no trigger occurred.
I used a for/next loop for flashing the LED 10 times but the outer for/next loop got stuck forever. It seems the C18 compiler has a bug in it concerning for/next loops so I have to use the while function instead.

I have got used to Microsofts C# compiler for pc work and that is great.
The Microchip C18 compiler is poor in comparison.
I see now why it was abandoned for the new XC8 compiler.
 
Here are the two loops of code.
The important bit is the time in the loop as that happens 256000 times.
You can see one is more cycles.


3689: fasttimeout=256000;
2804 6A18 CLRF 0x18, ACCESS
2806 0EE8 MOVLW 0xe8
2808 6E19 MOVWF 0x19, ACCESS
280A 0E03 MOVLW 0x3
280C 6E1A MOVWF 0x1a, ACCESS
3690: loop2:
3691: fasttimeout--;
280E 0618 DECF 0x18, F, ACCESS
2810 0E00 MOVLW 0
2812 5A19 SUBWFB 0x19, F, ACCESS
2814 5A1A SUBWFB 0x1a, F, ACCESS
3692: if (fasttimeout!=0)
2816 5018 MOVF 0x18, W, ACCESS
2818 1019 IORWF 0x19, W, ACCESS
281A 101A IORWF 0x1a, W, ACCESS
281C E001 BZ 0x2820
3693: goto loop2;
281E D7F7 BRA 0x280e
3694:
3695: fasttimeout=0;
2820 6A18 CLRF 0x18, ACCESS
2822 6A19 CLRF 0x19, ACCESS
2824 6A1A CLRF 0x1a, ACCESS
3696: loop: fasttimeout++;
2826 2A18 INCF 0x18, F, ACCESS
2828 0E00 MOVLW 0
282A 2219 ADDWFC 0x19, F, ACCESS
282C 221A ADDWFC 0x1a, F, ACCESS
3697: if (fasttimeout!=256000)
282E 5018 MOVF 0x18, W, ACCESS
2830 E105 BNZ 0x283c
2832 0EE8 MOVLW 0xe8
2834 1819 XORWF 0x19, W, ACCESS
2836 E102 BNZ 0x283c
2838 0E03 MOVLW 0x3
283A 181A XORWF 0x1a, W, ACCESS
283C E001 BZ 0x2840
3698: goto loop;
283E D7F3 BRA 0x2826
 
I wasn't terribly happy with the FFT display.
It seemed to have a lot of noise in it for a pure sine wave.
I also found doing a reverse FFT it didn't go back to the original sine wave very well.

I had a hunt around on the Internet and found another FFT.
While this one is a little slower it gives much better results.
An externally hosted image should be here but it was not working when we last tested it.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.