' {$STAMP BS2pe} ' {$PBASIC 2.5} ' tests CT515, displays values on debug screen. ' -- microseconds FOR 8 bits at 9600 baud ' -- state of CT515 pins as binary ' -- 5 count values ' The microseconds value should be near 833 microseconds (823-843) ' The state should show the actual high low state as you connect pins to ground ' The count should advance on channels that are toggled. ' ' Hardware, as in CT515 manual ' Needs pullup on the comm line connected to Stamp pin p9 ' Needs pullup on pin 4 of the CT515, which is channel #4 ' Note that channels #0 to #4 have pullups enabled in the PIC, about 20kohms CTpin PIN 9 wt VAR Word wv VAR Word wv0 VAR wv.BYTE0 wv1 VAR wv.BYTE1 ww VAR Word ww0 VAR ww.BYTE0 wx VAR Word wy VAR Word wz VAR Word wj VAR Word main: DIRS=$fcff ' p9 is input for PIC on Topboard OUTS=$0000 ' PAUSE 100 DO LOW CTpin PAUSE 15 INPUT CTpin PULSIN CTpin,0,wt SERIN CTpin,$54,1000,nodata,[wv1,STR ww0\10] DEBUG DEC wt*2,TAB,BIN8 wv1,TAB DEBUG DEC ww,TAB,DEC wx,TAB,DEC wy,TAB,DEC wz,TAB,DEC wj,CR PAUSE 1000 LOOP nodata: DEBUG DEC wt," no data timeout",CR PAUSE 1000 GOTO main