08M Simultaneous ir input & pwmout?

pma32904

New Member
From what I've read, IR inout with infrain2 only returns when a valid IR symbol is read. I'd like to drive an LED heartbeat with the pwm while waiting for IR input.
Might it be possible to poll an input pin for any level change on the IR decoder, then (perhaps interrupt) go to infrain2 once some IR change is detected AND keep modulating the pwm at the same time. (I'm wary of getting stuck waiting on IR and therefor not being able to wiggle the LED). Any suggestions? (Perhaps bit-banging IR in?)

Paul
 

pma32904

New Member
Hi Hippy,
I had read your page on IR in, but didn't entirely understand it. I'll dig a bit deeper.

Is the b0=b0/bit_time just normalizing the pulsin/count value to be 1 or 0?

Do you think it would be possible to update the pwm values between pulsin's without losing the IR signal values?

Paul
 

hippy

Ex-Staff (retired)
Yes, that's what the 'b0=b0/bit_time' does, so the bit stream can be determined from the pulse lengths, and turned back in to a received byte.

It might be possible to issue PWM/PWMOUT commands between the PULSIN's but I wouldn't recommend it. I'm not entirely sure what you mean with this 'pwm' as PWMOUT is far too fast to be any use in LED flashing.

You can poll the IR input until it's first detected as active, and while not flash a LED as a heartbeat, but there's always the danger that the delays caused by handling that corrupt the data being received.
 

pma32904

New Member
I'm new to picaxe, so have more reading to do. For pwm, I was planning to output a heartbeat, sort of a breathing LED pattern - ramps up, delay, ramps down, delay, repeat. Might be better done with output to a digital pin.

Yes, pwmout did seem to be quite a high rate. I might just change the duty cycle periodically so the resulting analog voltage through a resistor and capacitor to LED ramps about. The pwmout rate would be wasted, but the analog voltage would slowly ebb & flow.

Paul
 

pma32904

New Member
Is there any way to update the pwmout parameters more quickly than calling pwmout again? Such as a poke to internal register?

I suppose I can look at the PIC datasheet, but not sure if Picaxe programming editor/interpreter will allow this direct manipulation of Pic.

Does anyone know?

Paul
 

BeanieBots

Moderator
I don't know of a poke address that will change the PWM value, but even if there is, I doubt it would be any quicker than using the PWMout command. POKE is itself an interpreted command that will around 250uS much the same as PWMout does.
 
Top