' GET_BYTE.BAS ' ' Illustrates how to fetch an 8-bit quantity on PIN7. Assumes clock ' on PIN1. Assumes most significant bit first. ' ' This might be used to fetch data from such a/d converters as ADC0831, ' ADC0832, ADC0834, ADC0838 ' Peter Anderson, MSU, 2 Dec, '96 symbol data=b2 symbol n=b3 dirs=%00001111 pins=%00000000 main: pin1=0 ' clock at zero gosub get_data debug data L1: goto L1 ' endless stop loop get_data: data = 0 for n = 0 to 7 data=data * 2 'shift data to left pulsout 1, 3 'clock pulse on PIN1 if pin7=0 then L2 'don't add 1 data=data+1 'else add the 1 as lsbit L2: next return