Girl Fountain Receiver Basic Program

Declarations and Data

#rem GirlFountainReceiver.bas This is the receiver in the white box for the pump.

This box contains a duplex receptacle containing, a solid-state relay, 3A capacity

One receptacle labelled "L" is not switched

The other receptacle labelled "C" is controlled by a RF command.

The receiver inside the white box is in its own box. It is powered by a nominal 9V, 30NA plug-in transformer.

The receiver draws 7,7MA, the SSR 16 MA.

The box contains a switch which provides manual overrride.

The receiver has a 434 MHz module which receives 2400 Hz messages. 

The applicable messages start with an unlock code "14L1776", then a key code character.

They originate from manual transitters.

This program accepts messages with the following key codes:

j(on),T(off)    These control the Outlet. 

John Saunders  5/5/2020 

#endrem


#picaxe 08M2


'Output Ports        

symbol Relay_Port        = C.2        


'Input ports

symbol Rcvr_In          =  C.4        'Data from messages


'Variables:

symbol Rcvr_Val     = b1

symbol temp         = b2

Init and Main

init:

SETFREQ m8

LOW Relay_Port

SETINT  %00001000,%00001000    'Interrupt when C.3 high


main:

PAUSE 400

GOTO main

Interrupt

interrupt:

LET Temp = 0

LET Rcvr_Val = "~"

DO WHILE PinC.3 = 1    AND Temp < 20        'Noise interrupts are nearly always shorter

    LET Temp = Temp + 1    'Twice as fast as INC Usual count is 15

LOOP

IF Temp < 10 THEN End_Interrupt    'Minimises the time to recover from a noise interrupt

SERIN [80],Rcvr_In,N2400_8,("14L1776"),Rcvr_Val

IF Rcvr_Val = "~" THEN End_Interrupt

IF Rcvr_Val = "O" THEN End_Interrupt

SELECT Rcvr_Val

    CASE "j" 

        HIGH Relay_Port

    CASE "T"

        LOW Relay_Port

ENDSELECT

DO

    PAUSE 1

LOOP WHILE PinC.3 = 1

End_Interrupt:

SETINT  %00001000,%00001000    'Interrupt when C.3 high

RETURN