Duty - Diff Question
Tapperman
Posts: 319
I'm new to the propeller (got it for XMAS) and I'm going through the PE labs.
I'm a little confussed about the operation of the DUTY mode (page 133 of PE).
According to the docs, the BPIN should be opposite the APIN at all times in the DUTY-DIFF mode.· But when I modified the LedDutySweep.spin and ran it.· The led on P4 went from off to on, gradually.· Then switched off and the P5 LED switch on full bright and gradually went dim.
Shouldln't they both operate at the same time ... but opposite in brightness?· (I attached my spin file I'm using)
I'm a little confussed about the operation of the DUTY mode (page 133 of PE).
According to the docs, the BPIN should be opposite the APIN at all times in the DUTY-DIFF mode.· But when I modified the LedDutySweep.spin and ran it.· The led on P4 went from off to on, gradually.· Then switched off and the P5 LED switch on full bright and gradually went dim.
Shouldln't they both operate at the same time ... but opposite in brightness?· (I attached my spin file I'm using)
Comments
-Phil
-Phil
There is no sound .. but I show my laptop, and press F10 to load the program into my PROFESSIONAL PROPELLER BOARD - REV A. and as you can see ... the 1st LED goes from dim to birght .. then off, and second LED goes from full ON to off ... not at the same time ... why?
Post Edited (Tapperman) : 1/16/2010 3:21:59 AM GMT
The PPDB uses blue LEDs and these have a 2.5V drop.....that means that the LEDs will only light up after
the DAC is outputting 2.5V and higher.
So since the DAC on the First pin is going from full high to low the LED will be lit and will start dimming until the voltage drops to below 2.5V
The other pin is going low to high so the LED won't light up until the DAC is outputting 2.5V and then will start to brighten.
So the end result is that the LEDs will not be in synch as they should be. Since the high pin will be operating with 0.8V range
while the low one will have to go to 2.5V before it starts....so they end up not being in synch.
What you need is to limit the DAC to go from full on to 2.5 and from 2.5 to full on....then you will see them in synch again.
You cannot do this since you are using Diffrential Duty mode....so the pins cannot be controlled separately.....just do the below.
Another thing you can do is wire up some normal red LEDs instead of using the blue ones.
But that is the beauty of the PPDB is that you do not have to do that.....but....just be aware of the limitations.
I was caught by that at some stage and it drove me mad until some good people on this forum pointed out the errors of my ways....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Samuel
www.RobotBASIC.com
Post Edited (SamMishal) : 1/16/2010 6:17:42 PM GMT
I think Sam is right. That's why I asked about the color. The LEDs I ran your program with were yellow, with a much lower forward voltage. The only fly in the ointment is the fact that the LEDs are being pulsed at full voltage; they're not running from a variable voltage. But I suspect that the LED junction capacitance is high enough to act as a low-pass filter in concert with the current limiting resistor, effectively limiting the peak voltage that the LEDs see at low duty cycles.
I'm dead certain that there's nothing wrong with either your hardware or program.
-Phil
·
In the PDB the LED are wired very close to the Propeller pins and thus very little capacitance. In the PPDB the breadboard and the wires etc cause enough of a capacitance to cause filtering.
·
The effect is also more marked since the DAC operates at full 80MHz pulses....which exasperates the effect.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Samuel
www.RobotBASIC.com
·
I then ran it on the PDB (changing pins to the LED pins 16 and 18) and it ran as it is supposed.
I ran it on the PPDB again with pins 16 and 18 and again it was out of synch....
So it is CERTAIN that it has to do with the capacitance and the 2.5V drop on the blue LEDs.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Samuel
www.RobotBASIC.com
·
Thankyou SamMishal for wiring it up on your board, and confirming my result ... Being a newbee, your confidence gets shakin by these tiny little glitches. But this forum is a fantastic asset to all like myself who, on occasion, find themselves groping around in the dark.
Now forgive me for asking a stupid question, but how would I get it to do the same thing ... but at a lower freq?
It's PHSA that gets adjusted by FREQA correct?· And my output is comes from the Carry bit, correct?· Why would the resulting signal be so high?
Post Edited (Tapperman) : 1/16/2010 9:38:37 PM GMT
·
What makes the pin appear to have a certain voltage is the how OFTEN·the Overflow bit of the PHSA register goes high and that depends on the number in the FrqA register so that when it is added it makes the PhsA register overflow less or more often so as to make an average voltage level.
·
So there is no way to control the FREQUENCY of the duty mode. It will always work at the CLOCK speed. However, this is a very advantageous method in that it is Set-And-Forget operation. And to change the DAC output you just change the FrqA register and IMMEDIATELY (almost) the DAC output is changed. It is SIMPLE and EFFECTIVE.
·
If you need another way to produce a DAC you can use the PWM method....read about this in the PEK manual.
·
With the PWM you are setting the Pin high for a certain TIME and then LOW for a certain other time. You can control the frequency by controlling the Total On+Off time (period) and you control the DAC voltage by controlling the RATIO of the On to the Off time (DUTY).
·
However, the disadvantage of this method is that it is NOT a Set-And-Forget action. Also you need to do more work in figuring out the On and Off times. Additionally, when you want to change the DAC level it is not an immediate change since you have to wait for the PERIOD to finish before you can then change the Duty.
·
But with the PWM you can control the frequency of the on/off and thus can lower the speed of the whole thing and operate at lower frequencies. Sometimes this is needed with things like Servos for instance.
·
Which method you use depends on the situation. Duty mode can be very effective. PWM is effective too and might be necessary in certain situations
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Samuel
www.RobotBASIC.com
Post Edited (SamMishal) : 1/17/2010 2:09:29 AM GMT