'################################################### '-----------------BS1_BOBIII.bas----------------- 'This code was created by Lee von Kraus, Summer 2003 'For SMARTSEA, a Semi-autonomous, Modular, 'and Affordable Research Tool for Submersed Ecosystem Analysis 'This code should be run on a Basic Stamp1, 'connected to a BS2sx Basic Stamp (which is running SMARTSEA_2003.bsx) 'via two serial lines and a common ground. The bs1/bob-III module should 'also be connected to a video monitor. 'This code will get a pressure value from a pressure sensor 'send this value to a basic stamp connected to it, and then 'overwrite the pressure value onto a video screen connected to 'a video out wire. '################################################### Symbol CS = 2 Symbol CLK = 3 Symbol DIO_n = 4 Symbol DIO_p = pin4 Symbol ADbits = b1 Symbol AD = b2 Symbol sglDif = 1 Symbol msbf = 1 Symbol oddSign = bit0 symbol bs2inP = 5 '<-comes from io pin 9 on a bs2p-40 to the bs1 symbol bs2outP = 6 '<-goes to bs2sx io pin 8 on a bs2p-40 from the bs1 high CS again: 'debug "waiting",cr serin bs2inP, N2400,("rdy") 'debug "got it!",cr oddsign = 0 gosub convert pause 10 serout bs2outP, N2400,("x",#AD,0) 'debug "ch",#oddsign,":",#AD,cr gosub VidOverwrite goto again convert: low clk high dio_n low cs pulsout clk,5 let dio_p=sgldif pulsout clk,5 let dio_p = oddsign pulsout clk,5 let dio_p = msbf pulsout clk,5 input dio_n let ad = 0 for adbits = 1 to 13 let ad = ad*2+dio_p pulsout clk,5 next high cs return '#======================================================== '#======================================================== '#======================================================== 'bob-III video overwrite code: 'bob powered from seperate power source, power regulated by 5v regulator. 'grounds are connected between the bs2sx and the bob power supply 'serial connection is 'true', not inverted. (baud=240) 'this value will be different for the bs1, and will have to change the bob 'wiring to reflect the baud rate change from the default 'did not need video in, just prints the words to the blue screen 'the pin to bob's input is iopin #4 on the bs2sx, which is on the right side 'pin to bob's output is iopin $3 on the bs2sx, which is on the left side 'logic probe can be connected to the green wire (next to 5v regulator) 'and gnd on the bob circuit. symbol bobInput = 1 symbol boboutput = 0 symbol bobbaud = 0 '<-tru, 2400. should work with the bs21 '(changed bob's pins with resistors to set it to 2400). symbol xcoord = 5 symbol ycoord = 5 VidOverwrite: serout bobinput, bobbaud, ("{T0",$1B, "{A17") serout bobinput, bobbaud, ("{C0505","{U1","{D0") debug "printing now",cr serout bobinput, bobbaud, ("hi1:",#ad) pause 1000 return