Looking for an IR signal

Andrew Cowan

Senior Member
I have an application in which it is usually scrolling through a loop, checking various inputs. I want to add IR control, so using the rev-ed IR remote can take it out of this loop, and put it into other stages.

I'm using a 28X - I'll probably upgrade it to a 28X1 when I order some more chips.

I know the irfrain command hangs the program, so this would not be suitable in my loop. I previously decided I would need an 08M, which waits for an IR signal, then tells the 28X. More complex than I would like.

However, I just noticed hippy said (in another thread):

You may be able to scan for the presence of an IR signal ( goes low when signal present ) rather than INFRAIN'ing while stepping the motor but you could get tight on processing time ( 8MHz operation will help )...
That sounds interesting. Will a if pin0=0 then infrared tell me when there is an infrared signal?

Anyone tried this?

A
 

hippy

Technical Support
Staff member
Yes, that works fine. The only issue you have to deal with if you take that as an indication of IR transmission and then enter INFRAIN, it will stay there forever if it wasn't - Eg, any other IR remote ( TV, HiFi, light dimmer ) may trigger it.

The solution there is to not use INFRAIN which blocks, but a bit-banged INFRAIN substutute which will bale out if nothing is received.
 

eclectic

Moderator
Or switch to a 28X1 and use irin. Probably much simpler than bit banging the IR readings.

A
This is working fine at the moment.
Code:
#picaxe 28x1

setint %00000000,%00000001 ' low on pin0

main:
  for b0 = 0 to 255
 sertxd (#b0, "  ")
 pause 250
 next
goto main

interrupt:
  irin [500,leaving], 0,b1  
 
sertxd (cr,lf,"Interrupted at ",cr,lf)
sertxd(#b1,cr,lf)
outpins = b1
 
  pause 500 
  leaving:
  setint %00000000,%00000001 ' low on pin0
  return
e
 
Last edited:
Top