DAU Transmitter Battery Box Picaxe Basic Program

Declarations and Data

#rem

Battery Box.bas. Program to monotor the Transmissionsand control the bi-color LED

The LED flashes red Whentransmitting.

The LED flashes red if there are errors

John Saunders 4/8/2021

#endrem

#picaxe08M2

'Inputs

symbol TxPort    = pinC.3            'Transmitter Data C.6 on X2

symbol ErrorPort = pinC.4            'C.7 on X2


'Outputs

symbol RedLEDPort   = C.1

symbol GreenLEDPort = C.2


'variables

symbol state           = b1

symbol RedLEDCount     = w1

symbol GreenLEDCount  = w2


'constants

symbol RedPreset       = 5000

symbol GreenPreset     = 4000#rem

Battery Box.bas. Program to monotor the Transmissionsand control the bi-color LED

The LED flashes red Whentransmitting.

The LED flashes red if there are errors

John Saunders 4/8/2021

#endrem

#picaxe08M2

'Inputs

symbol TxPort    = pinC.3            'Transmitter Data C.6 on X2

symbol ErrorPort = pinC.4            'C.7 on X2


'Outputs

symbol RedLEDPort   = C.1

symbol GreenLEDPort = C.2


'variables

symbol state           = b1

symbol RedLEDCount     = w1

symbol GreenLEDCount  = w2


'constants

symbol RedPreset       = 5000

symbol GreenPreset     = 4000

Init and Main

init:


LOW RedLEDPort

LOW GreenLEDPort

LET RedLEDCount = 0

LET GreenLEDCount = 0

SETFREQ m4


main:

IF RedLEDCount > 0 THEN

    DEC RedLEDCount

ELSE

    LOW RedLEDPort    

ENDIF

IF ErrorPort > 0 THEN

    LET RedLEDCount = RedPreset

    HIGH RedLEDPort

ENDIF

IF GreenLEDCount > 0 THEN

    DEC GreenLEDCount

ELSE

    LOW GreenLEDPort    

ENDIF

IF TxPort > 0 THEN

    LET GreenLEDCount = GreenPreset

    HIGH GreenLEDPort

ENDIF

GOTO maininit:


LOW RedLEDPort

LOW GreenLEDPort

LET RedLEDCount = 0

LET GreenLEDCount = 0

SETFREQ m4


main:

IF RedLEDCount > 0 THEN

    DEC RedLEDCount

ELSE

    LOW RedLEDPort    

ENDIF

IF ErrorPort > 0 THEN

    LET RedLEDCount = RedPreset

    HIGH RedLEDPort

ENDIF

IF GreenLEDCount > 0 THEN

    DEC GreenLEDCount

ELSE

    LOW GreenLEDPort    

ENDIF

IF TxPort > 0 THEN

    LET GreenLEDCount = GreenPreset

    HIGH GreenLEDPort

ENDIF

GOTO main