PDA

View Full Version : Hello,and my first question...



Moldava
- 8th June 2004, 01:50
Hello,i'm new here and new to the world of programming,ithough i've already had some success with picbasic,microcode ,pic12f629 asnd 16f628...my question... i want to replace a counter that writes and read a 1m x 8bits ram,so it has to be a 20 bit counter..the clock that drives that counter is between 20khz and 60 khz...i've tried performing that by polling the clock input pin (ra0 in a 16f628,using the internal 4mhz oscillator),incrementing the counter when it changes from 0 to one and using a flag to avoid increasing it twice on the same clock cycle...well,it works ok at low frequencies,but not at 20khz...i also have to control the read and write signals,monitor a run/stop input for storing ram locations...well,maybe is too much for pic basic,or i'm just an ignorasnt newbie(this is probably the case...)
Thanks for your help and ideas...

Moldava

Melanie
- 8th June 2004, 08:50
It's not too much for PICBasic at all (remember, this is NOT an interpretive Basic), but might be too much for a 4MHz PIC all depending what it's got to do besides counting 60kHz pulses. This little ditty will show you how far you can go before things start falling apart... use a Double-Trace Scope, monitoring the Input and Output pins, wind the frequency up until the output starts to fall over... you might be surprised...

TRISB=%00000001

InputPin var PortB.0
OutputPin var PortB.7

Start:
Low OutputPin
Loop:
While InputPin=0:Wend
High OutputPin
While InputPin=1:Wend
Low OutputPin
Goto Loop

End

Melanie

Moldava
- 8th June 2004, 11:19
Thanks,Melanie,i'll try it today...:-)