28X pwmout and portC

Fowkc

Senior Member
If I issue a pwmout command on the 28X, does any pinsc command (or any output command that would affect the pin being used for PWM) stop the PWM execution?

For instance if I had:

'Start PWM output on portC, pin 0 (3.9kHz, 50% duty)
pwmout portC 1, 255, 512

...more code here

'Change portC outputs
pinsc = bportCDisp

where "bportCDisp" is any byte variable (0-255), would this set the PWM output pin to the value required for the byte, or would the PWM continue until another PWMOUT command?

I can't test it as my last 28X just died...
 

BeanieBots

Moderator
Your best bet is to try it and see.
Does "pwmout portC 1, 255, 512" work? I have never seen or used the portC command within the command. I always simply use "1" or "2" and the pwmout command itself makes the assignment to portC.
 

Fowkc

Senior Member
I don't honestly know, I haven't had the chance to try it out, I'm waiting for an order to arrive, but it's stuck at the post depot. I can find out easily enough anyway.

The project is a SLA-battery capacity meter. I'm using the 28X to switch on a relay, which discharges the battery through a 100W, 12ohm resistor, and periodically switches off the relay to measure the no-load voltage (assuming here that the PICAXE + displays don't count for much load). I'm working on the principle that the battery is considering "flat" when the voltage is 70% of its fully charged value. Does that sound right?
 

BeanieBots

Moderator
Oh boy!! that wonderful world of batteries.
Depends on type of SLA. Cyclic or standby type.
"Common practice" is to measure terminal voltage when on load and is often quoted as 10.5v for a flat 6 cell Pb battery.
Whether you use on load or off load measurements really depends on which deffinition of "flat" you wish to use. By "flat" do you mean can't supply any more useful power or do you mean the terminal voltage below which serious damage starts to happen to the battery. For example, hybrid cars never never allow more than 25% of the actual AHr capacity to be used in order to maintain an expected 5 year battery life. This is done by measuring the capacity used rather than taking simple voltage measurements. On the other hand, a "Robot Wars" type robot does not care about destroying the battery and will want to drain every last drop out of it for maybe 3 or 4 cycles before it destroyed.
Do a google and read all the contradictions for yourself. There is a lot of diss-information out there but the good articles are usually fairly obvious because they back their statements with good explanations rather than just make a claim.
 

Fowkc

Senior Member
They're cyclic, used in gliders, typical current draw is roughly 300 to 500mA for about 7 to 8 hours a day (more in modern glider with GPS, flight computers etc.). All the batteries are 7Ah capacity, so theoretically they'll be about half-discharged at the end of a typical gliding day. The purpose of the unit is to tell if they're actually anywhere near the capacity they should be.

The current system is to discharge the battery through a resistor network equivalent to 12ohm. Testing is done by feeling how warm the resistors are!
 

BeanieBots

Moderator
Fair enough. 50% drain for a cyclic SLA sounds about right. The occaisional drain to 70% to check that down to 50% is still possible should also be fine but don't do it too often. It will cost you a few % capacity each time. Your test should be voltage ON LOAD. Also, make sure it is charged imediately after the test. More than 24hrs in a deep discharged state causes rapid sulphation which results in very high internal resistance.
 
Top