Newbie here and i seriously need some help with input's on the SX28
I just got my SX programmer today and have been messing with it, but I cannot get the inputs figured out!
I am attempting to make an up and down counter with a specific output, but for some reason, I just cannot get the inputs to read anything. I need to be able to send a positive signal to an input and it add "1" to variable my_counter, then gosub to process the new value.
I set the chip to delay before each new setting to test if the outputs even worked. They do, but if 2 outputs are on at the same time, one is LED is brighter than the other. Any way to fix that?
Any help would be greatly appreciated!
I am attempting to make an up and down counter with a specific output, but for some reason, I just cannot get the inputs to read anything. I need to be able to send a positive signal to an input and it add "1" to variable my_counter, then gosub to process the new value.
I set the chip to delay before each new setting to test if the outputs even worked. They do, but if 2 outputs are on at the same time, one is LED is brighter than the other. Any way to fix that?
Any help would be greatly appreciated!
Comments
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
·
I am using RB.0 and RB.1 as the positive output going to an LED then to ground for testing purposes for now.
RA.0 and RA.1 are the inputs that are supposed to add(RA.0) or subtract (RA.1)
Note, too, that you should have pull-downs on your input pins.
Post Edited (JonnyMac) : 1/15/2008 2:18:24 AM GMT
-Benoit
This is almost straight out of Jon's book, Practical SX/B (page 67)
-Benoit
Post Edited (JonnyMac) : 1/15/2008 3:16:33 AM GMT
You could fix this in hardware or software. Both are handy ways to know....Got down the software path first....at some point you may run out of timing to do the waits/whiles to get rid of the 'bounciness' and you would have to revert to hardware.
For interests sake, you could connect a pull-up resistor to your switch and then put a capacitor across the switch. What you are doing is making what's called an RC circuit (R for resistor; C for Capacitor), which is basically a delay type of circuit or filter. There are some calculations you could make to determine what either should be....personally, I'd just use an appropriate pullup resistor, like Jon suggest, then pick a capacitor that works for you (this is easily done if you have an oscilloscope!).
The other way to debounce a circuit (and really the better way IMHO - unless you DO have noise; then the RC could act as a filter as well) is to use a schmitt trigger.
You set up your switch the same way (pull-up resistor, cap in parallel with switch - ~10nF) then where the resistor and the switch/cap join, you connect the input of a schmitt
Actually, here's a webpage for future reference...
www.all-electric.com/schematic/debounce.htm
Cheers
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<FONT>Steve
What's the best thing to do in a lightning storm? "take a one iron out the bag and hold it straight up above your head, even God cant hit a one iron!"
Lee Travino after the second time being hit by lightning!
One more thing..... I need to be able to drive a 15vdc 10 amp motor with the sx-28 chip. What would be the best way to drop the power down to not burn up the chip, but still send as much voltage to the motor that i can from one power supply. I was thinking of putting a resistor before the chip and using an NPN transistor rated at 60v 15 amps to control the power. Is that a good way to do it, or should I do something else?
Control the motor with FETs and SSR's maybe to isolate the sx.
Not very helpful, but haven't tried it....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<FONT>Steve
What's the best thing to do in a lightning storm? "take a one iron out the bag and hold it straight up above your head, even God cant hit a one iron!"
Lee Travino after the second time being hit by lightning!