'{$STAMP BS2} '{$PBASIC 2.5} ' Jack Walton, Martin Hebel '********** Tube Curve Tracer using StampDAQ ********** 'Using the StampDAQ Excel Macro, the data 'is Dumped into an Excel spreadsheet where it can be stored, charted and analyzed. 'Data Is sent out to the PC via Pin16 - the Programming Port of the Basic Stamp 'The Baud rate and transmission mode IS 9600,n,8,1 -- using the constant"84" 'The Bipolar Mode is used to read the negative grid voltages 'In the Bipolar Mode the resulting data must be "two-s complemented" '********** Variable Assignments *************** DIRL = %11011111 'Set Pins I/O ADCV VAR Word 'Voltage read by ADC I VAR Byte 'Counter MUX VAR Byte ADCS VAR Word(6) 'ARRAY to hold the 6 measured values SPIN CON 16 'SERIAL PIN - P16, Programming port Baud CON 84 'Baud mode for a rate of 9600, 8-N-1 CLK CON 0 'Clock CS CON 1 'Chip Select DIN CON 2 'Data Out from ADC DOUT CON 3 'Data In MUX Address and Mode '********** Initial Variable Values **************** I = 0 HIGH CS PAUSE 1000 'Allow data communications to stabilize SEROUT SPIN,Baud,[CR] 'Send Carriage Return to purge StampDAQ buffer CONFIGURE: '****************LABEL COLUMNS A to D with TRACER Outputs SEROUT SPIN,Baud,[CR, "LABEL,TIME,PT_1V, PT_2V,PT_1I,PT_I2,GR_1V,GR_2V",CR] SEROUT SPIN,Baud,["CLEARDATA",CR] PAUSE 1000 MAIN: FOR I = 0 TO 5 LOOKUP I,[99,119,115,103,105,123],MUX 'This selects the address of the LT1093 LOW CS:TOGGLE CLK 'Select the LT1093 and toggle the clock line once SHIFTOUT DOUT,CLK,1,[MUX\7]:PAUSE 1 'Shift the Address into the MUX of the LT1093 SHIFTIN DIN,CLK,2,[ADCV\10] 'Pause 1 millisecond to access the data TOGGLE CLK 'Toggle the clock line PAUSE 1 'Pause to settle the LT1093 HIGH CS:PAUSE 50 'Unselect the LT1093 ADCS(I)=ADCV NEXT ADCS(4)=~ADCS(4)+1 & 1023 'Two-s complement the negative grid voltage ADCS(5)=~ADCS(5)+1 & 1023 SEROUT SPin,Baud,[CR,"DATA,TIME,",DEC ADCS(0),",",DEC ADCS(1),",",DEC ADCS(2),",",DEC ADCS(3),",", DEC ADCS(4),",",DEC ADCS(5),",",CR] PAUSE 50 GOTO MAIN