Simulating a serial-port Interrupt on an 18X

LFLekx

Member
I want to use a PicAxe 18X (because I have one handy) in a wireless remote-triggering camera system. Basically, all I need to do is send a 'begin recording' and 'stop recording' command.

However - I also want to run other tasks as well, so I'd like to have a system that doesn't sit on the serin command.

Thus my question - can I use the pin where my wireless link is connected as a regular input? My idea is to have setint examine the pin for a high signal, and the interrupt-processing routine then do the serial-port processing via serin to read the command and store it in a variable. On return from interrupt, the command would be read and acted on.

Since I'm using a 'simple' RF link, rather than an RF modem - I believe that I can transmit an active-high signal to trigger the interrupt, and then use serout/serin to do the send/receive portion.

Is this possible...?
 

hippy

Ex-Staff (retired)
A simple 433MHz-style wireless link probably won't be reliable as the receiver will likely be getting no end of 'random garbage' from the ether which will cause the interrupt to be entered and, with no serial to be received, it will likely hang inside the interrupt routine. You could use serial timeouts ( but not available on the 18X ) but, as soon as you've finished that, some more garbage will appear and you're back in the interrupt again.

You could do it with another PICAXE handling the RF so that filters the noise, or you could use XBee which shouldn't be passing on randam garbage.
 

eclectic

Moderator
I've just tried an 08M Tx and an Rx.
I was monitoring the output using a Scanner.

It worked perfectly for a while,
but then the local keyfob-chorus started!
My nice neat data was no more. :-(

Code:
#picaxe 08M
setint %00000010, %00000010
main:
sertxd ("Waiting... ")

goto main

interrupt:
serin 1, n2400 ,("AXE"),b1
sertxd (cr,lf, "RX",#b1,cr,lf)
setint %00000010, %00000010

return

#rem
#picaxe 08M
;TX
main:
for b1 = 0 to 255
serout 4,n2400,("UUUUU")
pause 3
serout 4,n2400,("AXE",b1)
pause 2000
next b1
goto main
Do you live in the middle of a remote island?
No. Takes Hippy's advice above.

e
 

Attachments

eclectic

Moderator
@LFLekx
Further to the post above,
I switched off my transmitter and
put one extra line in the interrupt routine.
sertxd ("In interrupt")

Ran the program for a couple of seconds:-
Locked in the interrupt.

e
 

Attachments

Dippy

Moderator
Yes, standard 433/434 MHz modules usually have a lot of noise/garbage from the Data-Out pin.

Depending on local conditions it may be possible to use interrupt in conjunction with an Rx module which has RSSI.
You may also need a comparator to set a threshold.
Or regular ReadADC in code to make a home-made 'squelch' control.
Much of this depends on how 'busy' your Rx-end-PICAXE is and also prevailing RF 'weather'.
 

LFLekx

Member
Couple of clarifications...

I'm not using a 433MHz transmitter/receiver pair - but a 900MHz pair. (If that makes a difference... :) )

I'm setting this up as part of a rocket-based camera system - wirelessly activating the cameras before the motor is ignited. There won't be a lot of local interference.

I was considering putting a 4-bit encoder/decoder chip pair to do the job... but was hoping to save the board space by using the chip itself. (I've already got a board assembled, which is why I didn't want to have to change to a 20X... :) ) But if it's unreliable, I guess that's the way I'll have to go.
 

hippy

Ex-Staff (retired)
"Pass" on 900MHz links, but if you've got the kit and a board assembled, the best thing may be to try it. As you've probably found with rocketeering; no end of theorising will ever beat practical testing.
 

Dippy

Moderator
Well all the same points apply to any non-smart Tx/Rx.
And some makes will be better than others.

And I've used the 'old faithful' Holtek 12D and 12E chips in the past with 434 MHz (Radiometrix /RF Solutions / LPRS modules) just for a remote switch and it was very, very reliable.

Like the man says; if you've already made it then try it. If it doesn't work then try breadboarding after absorbing the advice and before making a PCB :)

Or maybe you are using something smart? You haven't told us. Our C.Balls assumed something cheap ;)
What RF modules are you using?
 

LFLekx

Member
I'm using the Linx HP-III series 900MHz transmitter and receiver module pair. They're supposed to be pretty noise-and-interference-free.
 

Dippy

Moderator
I've never tried them so can't say for sure.

Informative Data Sheet:
http://www.linxtechnologies.com/Documents/RXM-900-HP3-xxx_Data_Guide.pdf

However, they are basic non-smart modules so noise/garbage is likey on Data Out pin.
As the Data Sheet itself says about interference:-
"Low-level interference will produce noise and hashing on the output and reduce the link’s
overall range."

So, it looks like potentially noisy output, therefore your interrupt routine could get a little 'busy'.

If you have the Rx module then a couple of minutes in conjunction with an oscilloscope will sort out your question.

However, you may be able to make use of the RSSI to trigger your routine, but personally I would never use something that is limited to a blocking command on a noisy line.

For reliability I would use:
1. A smart module.
2. A PICAXE which has a Serial timeout (non-blocking i.e. doesn't get stuck) in conjunction with RSSI.
3. For simple switching or slow data (with 18X and non-smart module) consider tone encode-decode or the Holtek HT12E and HT12D (I used the Holtek on some simple pedestrian counting equipment and they were very reliable over several years).

But, opinions differ and discussions/arguments could go on for weeks... and probably will...
I think it's time to start playing....... :)
 

LFLekx

Member
Oh, I know about the need to test. (I don't have access to a scope, so that option is out...) The Linx module is supposed to have *some* degree of filtering, since some of their example designs show unfiltered connections to decoding chips. I also intend to have the interrupt-servicing routine 'debounce' the signal by checking for a sustained high signal (I'm thinking 100ms or thereabouts...) before actually doing anything - I use a similar routine for the launch-detect interrupt on my existing camera timer... so I know it's a workable solution.

One of my main concerns, which I probably didn't articulate very well, is that I currently have the data-out pin of the RF module connected to the PicAXE input pin via the 10k/22k resistor pair that is recommended for use in serin links... and am not sure if I can still use the pin as a general-purpose input while connected that way.
 

hippy

Ex-Staff (retired)
Yes, the pin can still be used as a general purpose pin ( if pinX=, b0=pinX ) etc. The 10K/22K just conditions the voltage / current to be suitable for the hardware.
 
Top