send_to_plix: 'Note; X-10 adds 3 seconds to light control GOSUB find_plix 'in case PLIX is removed while program running IF plix_on_flag=0 THEN RETURN 'prevent lockup on printer port input OUT dport, &hFF 'allow PLIX to steal power cportv=3 'initialize control port value OUT cport, 9 'insure PLIX reset & CS are toggled OUT cport, cportv repeat=2 'repeat code 'sync with powerline xrange=0 GOSUB write_data GOSUB write_data GOSUB write_data xrange=31 GOSUB write_data 'send data for module control xrange=hcode GOSUB write_data xrange=ucode GOSUB write_data xrange=repeat GOSUB write_data xrange=hcode GOSUB write_data xrange=fcode 'on or off operation GOSUB write_data xrange=repeat GOSUB write_data RETURN find_plix: RESTORE DATA &h278,&h378,&h3BC 'check all three lpt ports FOR p=1 TO 3 READ dport 'data output port sport=dport+1 'status input port cport=dport+2 'control ouptut port plix_on_flag=0 'assume port status unknown OUT dport,&hFF 'write data=255 status=INP(sport) 'and read it back OUT dport,&h0 'write data=0 x10$="x10" IF(status<>INP(sport)) THEN plix_on_flag=1 'flag when plix port found RETURN 'leave routine if the port was flagged END IF NEXT p 'if no flag check the next port x10$="x? " 'if plix not found at any port RETURN