1) Are you really using a 20 Mhz crystal?
Not very many people use crystals on an 8-pin PIC.
2) 40 Hz is really slow for LED's
Increase the SPWM_FREQ.
1) Are you really using a 20 Mhz crystal?
Not very many people use crystals on an 8-pin PIC.
2) 40 Hz is really slow for LED's
Increase the SPWM_FREQ.
DT
I use in config : @_INTRC_OSC_NOCLKOUT . its necessary to use external crystal ?
I increased the SPWM_FREQ at 219 and leds are relativelly well
Last edited by midali; - 8th January 2014 at 19:35.
No, it is not necessary to use a crystal.
But your DEFINE OSC must match your actual oscillator frequency.
If you have specified the internal oscillator in your configs, then the default is 4Mhz, not 20Mhz.
And your program is running at 1/5th the speed it is supposed to.
DT
Thank you for your help and patience !
Can somebody help me with this code for 12F683: ?
I want to blink very quikly a led in background ,independent of my code, random, pause between 1-20 ms. I think that this interval is ok, the best if its possible to set pause limits.
I want learn about intrerupts but i think that I'm too old ...
thx in advance !!
...or , how I can make SPWM without intrerupts...?
Darrel came up with a terrific piece of code for my project - have a look at this thread:
http://www.picbasic.co.uk/forum/showthread.php?t=17299
Try this as an intro to Darrel Interrupts and blinking LED:
http://darreltaylor.com/DT_INTS-14/blinky.html
It's worth the time to practice. His routines make things so much easier and flexible later on as you add more complexity to your code.
Robert
Bookmarks