PICAXE 28X1 IRIN problem

Duane S

New Member
I have an AXE090 experinmentor's board with a PICAXE 28X1 chip installed.

So far, I've not been able to get the IRIN command to operate at all. Whenever I call it, the chip seems to just hang up.

I've tried a simple little program, trying to see where or why it hangs, but I'm at a loss at what I'm doing wrong.

Here's my test program:

low 7
low 6
low 5

main:

irin [1000,oops],3,b0 'wait for new signal

toggle 6

if b0 = 1 then swon7 'switch on 7
if b0 = 4 then swoff7 'switch off 7

debug

swon7:
high 7

goto main

swoff7:
low 7

goto main

oops:

toggle 5

goto main



Output 7, 6, and 5 are connected to LEDs so that I can follow what's going on. If I REM the IRIN line, LED 7 will turn on, and stay on. I understand that. LED 6 will toggle on and off repeatedly. I understand that.

But, if I try to run it without the IRIN line REM'd out, it never makes it past that line. None of the LEDs ever turn on.

I'm confused here. It passes the syntax check O.K. I thought that when the IRIN timed out, it would go to oops. But it never does.

Does anyone understand what I don't see here?

Thanks,

Duane S
Wilson, NC USA
 

BCJKiwi

Senior Member
If the system is switched on but nothing is sent at all, the program should behave as it does with the irin line remmed out but with a 1 sec delay at the irin line. Does it do this?

Suggest that;
b0 be replaced with w0
debug be replaced with sertxd ("irin ",#w0,cr,lf)
for testing. Debug does interact with some instructions so tend not to use it. You may need a #terminal 9600 or whatever at the beginning of the program so the terminal window speed can be matched to the program.

Depending on the sender being used, you may not be receiving what you expect.
Have a new univerasl remote that does not use the 'old' Sony codes but instead uses much higher number strings when set to sony mode.
Beginning of IR receive subroutine looks like this to return the numbers expected by IRIN;
Code:
GetIR:
IRIN [10000,cfg_loop],cfg_in, w1 'wait 2.5 secs for input @ 16MHz clock
pause 1000
b1 =w1-11263
if b1 =10 then let b1=0 :EndIf
 
Last edited:

Duane S

New Member
BCJ,

Thank you for the reply. Hmmm....

I'm about brain dead now. I'll look into your suggestions tomorrow. I've got to be at work in 6 hours.

Thank you.

Duane S
Wilson, NC USA
 
Last edited:

Mycroft2152

Senior Member
Duane,

Welcome to the wonderful world of PICAXE, the cause of many sleepless nights and a lot of fun!

Myc

western MA
 

Technical

Technical Support
Staff member
If the irin line is not timing out it implies a hardware issue, where the input (3) is getting some kind of background signal, but not a valid Sony code. This could be due to a wiring mistake, incorrect sensor type etc.
 

Duane S

New Member
Thank you for that info, Technical.

It made sense to me.

So, I disconnected my IR receiver, and tied IN3 to common to make sure it was not floating, and I still see the same results.

Hmmm.... any other ideas?

By the way, is there a simple way to monitor the input status using debug?

Duane S
Wilson, NC USA
 
Last edited:

inglewoodpete

Senior Member
The IR receiver is an open collector device. For an idle condition, the input line should be held high by connecting it to a 4.7kohm resistor to +5v. In other words, and just for your test as outlined in post #6, remove the IR receiver from the circuit, leaving all other components in place.

I'm clutching at straws but it's possible that holding PICAXE's IR input low could lock the receiver firmware in a receive loop. It is expecting the IR pulses to be low for periods of about 500uS/pulse.
 

Duane S

New Member
Yay !!!

I now have it working. :)

It turned out to be a wiring mistake that I kept overlooking, no matter how many times I checked.

In my troubleshooting efforts, at different times I had the background signal or "noise" that Technical suggested, and then latter, the problem that inglewoodpete suggested.

In my stupidity, I was interpreting the results to be the same.

With your suggestions, and by adding " let b1 = pins " ( and moving my debug line ) I was able to figure the problem out.

Many thanks to you guys for your advice, and patience.

Duane S
Wilson, NC USA
 

Duane S

New Member
I’ve mapped out the b0 values / codes received from my Radio Shack universal TV remote.

I’ve got 27 buttons / signals that I can use for control, 14 that give no response at all, and 3 that switch the remote's mode and make it unusable until I press "TV" again.

For a cost of $3.99 for the IR receiver, and $9.99 for the universal remote control, I am VERY happy. I had some difficulty making it work, but with you guy's help, it's worked out fine. :)

I can live with 27 buttons / signals. The good thing is that most of the working buttons / signals are the logical ones that I'd want anyway. :) :)

So, I'm a happy camper. :)

Thanks again. Now I can get back to writing code.

Duane S
Wilson, NC USA
 
Last edited:
Top