This PicBasic Pro code by Rich Miller reads the channels of a Quantum QT140 and reports the results using a series of LEDs.

Back to QT140 Report.

'Test using the Qprox QT140 and PIC 18F252

'Qprox 2...  test sinking inputs of qprox and outputs to leds.

Define OSC 20    '20MHz oscillator
trisB = %00001111   'PORTB.0 - B.3 = input,  B.4 - B.7 = output

loop:  
        IF PORTB.0 = 0 Then   'if the Q has sunk the pin
            portB.4 = 0        'sink the led to light it
        else 
            portB.4 = 1        'else take the pin high to turn the led off 
        endif  

        IF PortB.1 = 0 Then 
            portB.5 = 0
        else 
            portB.5 = 1   
        endif

        IF PortB.2 = 0 Then 
            portB.6 = 0
        else 
            portB.6 = 1   
        endif

        IF PortB.3 = 0 Then 
            portB.7 = 0
        else 
            portB.7 = 1   
        endif
        goto loop
end