I have ground knowledge of pic's, I know that in my application I need to use the PWM output and i need it as low frequency as possible so need a low clock speed, but then I want the uC to carry out other tasks as well so need it to carry out as many instructions between each PWM pulse as possible
You will run into the same problems on any micro; it is your algorithm which needs the effort.
Why is it you think you need a slow clock speed to do low frequency PWM?
Still, the idea of multi processors is interesting, so please keep us informed of your progress.I am not creating any delays or anything but want to make sure that firstly the ADC runs as fast as possible because it has to take two measurements on two different channels for the calculations to be carried out, and then carry out the calculations that the duty cycle of the PWM is dependant on, idealy I would like to ajust each and every PWM cycle as the environment variable change.
well I had heard of software PWM but I'm no code geek and want to have it simple and powerful. This is a power controller for a vehicle so the essential functions are taking the readings and control the duty cycle of the PWM output, the secondry functions were to send the values read by the ADC to a display that is external to the project for diagnostic purposes,
I'm controlling the field coil of a dynamo, the original reg runs it at 75-150 Hz, after some simulation in electronics workbench I have discovered that the higher the frequency the higher the voltage of the kickback spike, I don't have a huge issue with that but I don't know what effects different frequencies will have on the operation of the dynamo so would rather start out being in the position to start with what is pretty much the original frequency and then maybe experimenting
I'm also using basic as I got absolutly no where with assembler and I'd rather run the risk of a bit of inneficient code here and there rather than not be using uC's at all. I can use snippets of assembler in the basic compiler though
so you are using the hardware PWM module ? I have already established that at 4 MHz the minimum is 245 Hz and therefore at 8 MHz the minimum is 490 Hz, the issue is a hardware limitation, the only way around it is to use a higher clock and software PWM but that may be a bit over my head at the moment.
So?, both those frequencies would be perfectly fine - you're making life difficult for yourself for absolutely no reason.
thos frequencies are fine at 4 and 8 MHz, if I decided to run at 20 MHz or use another pic running at 40 MHz the PWM frequency would have to increase proportionately, I was aiming to have low frequency PWM output but also enough cycles between pulses to carry out all the calculations
bear in mind that the "real world" is an engine running at 1000-7000 rpm, with a non loaded engine (ie someone reving it in their drive) acceleration rates can be high, and I'm running at 245 Hz so things can change in 4 ms (I am uncertain also of how quikly new values take effect in the PWM module - maybe a cyle late ?), although things seem to be coping ok, the PWM control operates in steps so if I need to lower it quikly due to suden acceleration it can only happen in steps by running through the cycle over and over, my previous prototype ran at 8 MHz and we found this to be better than 4 MHz but I was ajusting the PWM steps one at a time, I am now considering 8-10 steps at a time to increase effective responsiveness.
I know I'm possibly being over cautious by this will be managing the entire electrical generating system of the vehicle and will eventually (once road tested) be put into cars running rallies in hot weather on the continient far away from my assistance if things go wrong. I don't really need a person in a car worth 0.25-1 million pounds 2000 miles away with a fried electrical system due to my poor design.
are you saying that you PWM module is software ? I have tried lowering the PWM frequency with higher clocks and the compiler will just not accept it, something to do with the fact that the counters in the PWM module will only count down and therefore reduce the clock speed by a maximum amount
yes I'm using the hardware PWM channel, and yes the higher the PWM frequency the faster it responds. I am concerned with changing the frequency though as I don't know if the dynamo will "like it" I just know it is a hefty coil and probably prefers the 100ish Hz control signal, if 500-1000 is ok then that makes life simpler. I'm considering temperature compensation to help it manage in the winter by pumping a bit more current out as it's colder so should cope and thats where I start to neet to know that the ADC can take multiple measurements fast enough and do all the calculations that will produce the next duty cycle value (my friend takes his dynamo off in the winter and replaces it with an alternator - hence my many posts related to this project as I've had time to consider all angles and possibilities)
Try it and see - but I'm even more bemused why anyone would run an alternator in the winter, and them bother putting a crappy dynamo back on in the summer?.
I don't see how you can 'squeeze' a little more power out of a dynamo - controlling the field coil can only DECREASE the power, not increase it.
There also seems little point in PWM'ing it to try and give real time control, when 'burst fire' control (as used in the original) works perfectly fine.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?