Page 1 of 1

Simple Oscillator

Posted: Thu Feb 01, 2007 8:52 pm
by EddieB
Hello there,

Ive spent the last couple of hours tinkering and playing with my new programmer... Now, I was wondering if I could make a simple oscillator with my development board, There are some timer options in the chip setup, but I dont really know how to use them... I can make an oscillator with a few capacitors etc, but I was hoping there could be an easier way... Also, at the moment... Im using a while loop with flowcode and turning the data pin on and off with a 200 ms delay.

Cheers

Posted: Fri Feb 02, 2007 10:41 am
by Mark
Hi Eddie,

You already have made an oscillator, flasing an LED is just that, the knight rider effect programme is effectively a port full of oscillators. Just vary the delays to make any oscillator speed you want up until (about) clock speed/4/4 which is probably around 1MHz.

That is the beauty of PIC's over conventional analogue electronics, all the varying of resistors and capacitors goes out of the window. :D

Could I suggest looking at the Flowcode tutorials in the learning centre. Working through these will take you a long way to understanding the benefits of E-blocks/Flowcode. :)

Mark

Posted: Fri Feb 02, 2007 11:40 am
by Benj
For a shorter delay you can use a C code block with the following command

Code: Select all

delay_10us(FCV_VAR1);
then set up a variable in flowcode called var1 and give it a value. The C code block will then delay the value in the variable x 10 micro seconds.

Posted: Fri Feb 02, 2007 6:48 pm
by EddieB
Hello,

I was playing with my new programmer all last night and was making simple flowcharts for things like this:

Start
|
While 1
Output Port B 1
delay 1 sec
Output Port B 0
EndWhile
|
End

Although it doesn't have the desired affect....

Cheers

Posted: Mon Feb 05, 2007 11:05 am
by Steve
More than likely this is a configuration word setting problem. Make sure the config settings are appropriate for your hardware (especially the oscillator settings) and that the clock speed setting is correct.

Posted: Tue Feb 06, 2007 7:34 pm
by Mark
Eddie,

You need two delays.

In your loop you have the LED out for about 10us or 0.00001 seconds, and on for 1 second.

Start
|
While 1
Output Port B 1
delay 1 sec
Output Port B 0
delay 1 sec <--------------- :D
EndWhile
|
End

Posted: Tue Feb 06, 2007 7:37 pm
by EddieB
Ah Thankyou!

Cheers