Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

dsPIC + GLCD = Spectrum Analyzer :D

Status
Not open for further replies.
Oh and also one thing in your GLCD code wait a little after toggling the E pin, sometimes the pulse is too short(too slow display,wire inductance/capacitance etc) because pouting a pin high then imidietly low in the next line will create a very short pulse because of the fast CPU speed.
I currently do this even when operating at 8Mhz. My GLCD write routine currently takes 150ms to refresh the entire display. The 256 point FFT only takes 6ms. I fixed the ADC sampling routine which was taking apx 160ms for 256 samples! Somehow I was sampling it really slowly and the aliasing above the nyquist frequency fooled me. Scoping the sampling time revealed this error, whereas the SIM wouldn't show it properly. This sped things up measurably. I also improved the square root routine by returning some arguments (0 & 1) as the answers.
Also use the busy flag its supposed to speed things up a considerable amount.
Yes, I think that is where I'll focus my efforts on improving fps.
If you are doing calculations betwen writes to the display it should be a big performance boost, since the PIC is never waiting for the display.This is already multitasking but without interrupts.
When I feel more ambitious, I'll look at using the DMA with the ADC for sampling. Especially if I want to try the max rate for the ADC.
bananasiong said:
Does you PIC work at maximum speed (40 MIPS) on the breadboard?
Haven't tried it yet, but I don't see why not, since those frequencies are all internal to the PIC. Toggling pins at the max rate might become an issue on a breadboard with long wires running here and there.
 
Well its fine to use fast crystal oscilators on breadboards. But 33F can do 40 MIPS from the internal clock.I find that a neat thing.Altho the internal osc is not as acurate as a cristal, but in most cases its not a isure.As for bananasong its not good to run SPI devices at there max speed its good to take a few MHz head room. Also at these speeds long wires can mess it up.
 
Thanks for the comment Funny NYPD. I haven't had much time to work on it lately, but I did manage to get 16 fps with the same clock speed by tweaking the code more. I'm down to 37.5ms for the display refresh and 23ms for the ADC and FFT combo.
 
Don't look on MicroChip, as far as I know their code doesn't work? - checkl on the PICList, where there's standard PIC code for a spectrum analyser displaying on a VGA monitor. It explains what's wrong wth the MicroChip code.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top