Doubling up the IR command?

radiogareth

Senior Member
In an attempt to increase the range by upping the pulse current to the IR LED (whilst keeping the hardware to a minimum) is there any way of simultaneously sending IROUT to TWO pins on a PICAXE 08M2? Basically I'm intending to read ADC from a controller mounted potentiometer (C.4), then when a send button (C.3) is pressed, send IRout from C.1 & C.2 with them BOTH joined - theoretically 60 mA may then be available. That leaves C.0 to runs a low current sending LED for user feedback.

Thoughts anyone?

TIA
 

radiogareth

Senior Member
Might it not be possible with 'bit - bang' ?? - not that I know exactly what that is....

Why? well 'Tis in vain to do with more, that which can be done with less' :)

Or if I accept the single LED drive (which actually works fine, it was just I had a pin spare and got to think....'what if') I could drive the two LEDs off a different set of Sony codes, so doubling up the number of channels possible. Its an ill wind ....etc.
 

hippy

Ex-Staff (retired)
Using the DSM ( Data Signal Modulator ) it appears possible to replicate C.2 output onto C.0. Whether that replication is good enough to source the current you want in parallel I don't know, and I don't know what effect shorting C.2 to C.0 would have. You could perhaps diode mix the two outputs together.

It would be recommended to use an external driver to switch higher current than the outputs can provide.

Code:
#Picaxe 08M2

Symbol  MDCON  = $FC ; SFR $39C
Symbol  MDSRC  = $FD ; SFR $39D
Symbol  MDCARL = $FE ; SFR $39E
Symbol  MDCARH = $FF ; SFR $39F

PokeSfr MDCON,  %11000000
PokeSfr MDSRC,  %00000000
PokeSfr MDCARL, %00000001
PokeSfr MDCARH, %00000001

Do
  IrOut C.2, 15, 31
  Pause 1000
Loop
 
Last edited:

radiogareth

Senior Member
I'll try that next time I'm in the workshop and can put a scope on it (THEM). The code is 'beyond me' but if it works, THANKS!!
 

hippy

Ex-Staff (retired)
There was a typo / bug in the code in post #5, now corrected. A version which replicates C.1 onto C.0 ...

Code:
#Picaxe 08M2

Symbol  MDCON  = $FC ; SFR $39C
Symbol  MDSRC  = $FD ; SFR $39D
Symbol  MDCARL = $FE ; SFR $39E
Symbol  MDCARH = $FF ; SFR $39F

PokeSfr MDCON,  %11000000
PokeSfr MDSRC,  %00000001
PokeSfr MDCARL, %00000000
PokeSfr MDCARH, %01000000

Do
  IrOut C.1, 15, 31
  Pause 1000
Loop
There might be some way to use the internal comparator to replicate C.1 onto C.2 but that would also involve fiddling with SFR settings.
 

radiogareth

Senior Member
OK, I have finally put a scope on it and yes, it does work - each channel is identical in timing. The 08M2 does not like having its outputs tied together though, but ORing them via a couple of 1N4001 diodes solved that problem. Curious though, unless its something to do with C.0 being a download pin??

If yes, Hippy - would it be possible to duplicate C.1 to C.2 instead?

Removing the pause, (so code is continuous) gave a digital 'average' current of 12.6 mA (two outputs) and 7.3mA on just 1 output. 6 volts MAX power supply, NO series resistor into a standard RED led. (OUCH!!)
The Duty cycle is about 33% Mark:Space 1:2 so if the DMM is averaging as expected, maybe top whack 40 mA.

So to be honest, its probably not worth the effort, ie use a MOSFET or transistor (e.g. BC337 at 2p each) instead.

But, would it be possible to copy the single PWM channel (c.2) to 1 or more other pins using whatever has been programmed to C.2??

Now that WOULD be useful :)
 
Last edited:

hippy

Ex-Staff (retired)
The DSM is basically a two-input selector implemented in hardware. So two inputs and a selection input from a pin or from internal functions (PWMOUT/HSEROUT) and an output pin. The output pin is unfortunately fixed by the hardware so on an 08M2 the output must be to C.0 pin.

Its primary function is not to replicate outputs but can be used that way in a limited set of circumstances.
 
Top