i think it's more a matter how this PWM function is made...i'll do some test here first. How many different channel you need?
Which other PIC you have on hand?
i think it's more a matter how this PWM function is made...i'll do some test here first. How many different channel you need?
Which other PIC you have on hand?
Last edited by mister_e; - 11th February 2007 at 16:41.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
LOL - Steve, I sence you see I'm strugling and a bit out of my depth![]()
I would like to use 4 channels in total so I can control 4 trains all independantly, but I'm not bothered if I need to use two chips.
I have at my disposal the following PICs:
16F84A
16F873A
16F628A
16F676
16F688
16F877A
16F684
18F2550
12F675
18F4550
Thanks
Hi, Malc
Your scoping confirms what I thought and read ...
The pot function charges the capacitor, and then drags little amounts of current ( in coulombs ...), verifies if the pin low thresold is reached, takes another quantity of current, verifies, and so on ...
That's why you get such garbage !!!
Now, the result is a count of the little quantities ... and that explains why you must use the indicated values and not others, even the RC value remains constant.
Alain
PS: and what about a scale value of ... 64 ???
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Alain,
The traces were from the 12f675 that used A/D to read the voltage from a 10K pot (as detailed in post #22).
I was expecting a traditional square wave type signal, with varying width of pulse, not the noisy signal the PIC is outputing.... The manual shows additional components for analogue output (resistor / capacitor), maybe I should try using that to get a decent signal out ?Code:ADCIN 0, D Pwm GPIO.2,D,1 goto main
Huh !!!
The manual clearly tells Pwm outputs garbage ... and needs a RC or more sophisticated filter.
Now just keep in mind PWM is only good to get some "analogic" output from the PIC.
Another STAMP " Not so good a function " survivor.
Now, if you want to keep the PWM function ... just compare a sawtooth to this "analogic" voltage ( once filtered ) and you'll get a neat "real PWM" at the output of the comparators.
a quad LM 339 sould do that job very honestly ...
But we remember DARREL's slow PWM is the shiny solution to what you want to do.
Ah, last point ... and not least ! you'll discover the motors have a low PWM ratio thresold not to make some noise and unwanted heating while not turning. one more thing to add !!!
Alain
Last edited by Acetronics2; - 12th February 2007 at 10:13.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Yeah, I re-read the manual and noted that it stated the PWM signal is not tidy. Tried the 10K / 1uF as suggested in the manual
But that simply smoothed the output to a constant voltage level, regardless of what setting the pot was turned to.
I spent a lot of time browsing the web last night and most brushed motor control using PICs involved using H-Bridges, which may be impractical for this purpose...
I'll have a more indepth look of that PBgroup website and see if there is anything I can use - Thanks
Alain,
I'm getting way out of my depth here. I downloaded the three files from Darrel's web site (http://www.darreltaylor.com/DT_INTS-14/SPWM.html) and copied the sample code for the LEDs. Darrel stated on the PBgroup that the code Works on just about any chip. 12F, 16F, 18F, but if I try compiling with MCS I get errors, regardless of the target pic selected.
ERROR: variable wsave3 position request 416 beyond RAM_END 335
I've never used other include files etc before, but if I understand his site correctly it should be a simple matter of downloading and saving the three files to the PBP folder, copy and pasting the sample code into MCS and then compiling ?
Any ideas ?
Bookmarks