advanced stamp code.bsx

M:\Mike (4-19)\Stub Programs\Stamp Board Code - printer\advanced stamp code.bsx
File saved: 4/19/2006 8:16:34 PM
Generated: 4/24/2006 6:53:48 PM

Table of Contents
Declarations


'Author: Michael Konicki Table of Contents 'Date: 3/30/2005 ' ' {$STAMP BS2sx} ' {$PBASIC 2.5} ' 'even servos = wheels 'odd servos = directionary servos 'Variables position VAR Word ra VAR Byte ch VAR Byte 'buff VAR Byte(3) header VAR Word command VAR Word tail VAR Word ch0 VAR Word ch1 VAR Word ch2 VAR Word ch3 VAR Word ch4 VAR Word ch5 VAR Word ch6 VAR Word ch7 VAR Word 'Serial Communication settings for Servo Controller Sdat CON 15 ' TPIN is pin to transmit through baud CON 1021 'BAUD RATE 1021 'NOTE: 250 to 1250 is servo range start: GOSUB stop_machine DO 'Get the command GOSUB get_input_from_com LOOP END get_input_from_com: '********************************************* 'Get the input from COM Port via PC and send it to the servo '********************************************* DEBUGIN DEC header, DEC ch0, DEC ch1, DEC ch2, DEC ch3, DEC ch4, DEC ch5, DEC ch6, DEC ch7, DEC tail IF header = 55 THEN DEBUGIN DEC ch0, DEC ch1, DEC ch2, DEC ch3, DEC ch4, DEC ch5, DEC ch6, DEC ch7, DEC tail IF tail = 55 THEN ra = 1 IF ch0 > 0 THEN SEROUT Sdat, baud,["!SC", 0, ra, ch0.LOWBYTE, ch0.HIGHBYTE, CR] ENDIF IF ch1 > 0 THEN SEROUT Sdat, baud,["!SC", 0, ra, ch1.LOWBYTE, ch1.HIGHBYTE, CR] ENDIF IF ch2 > 0 THEN SEROUT Sdat, baud,["!SC", 0, ra, ch2.LOWBYTE, ch2.HIGHBYTE, CR] ENDIF IF ch3 > 0 THEN SEROUT Sdat, baud,["!SC", 0, ra, ch3.LOWBYTE, ch3.HIGHBYTE, CR] ENDIF IF ch4 > 0 THEN SEROUT Sdat, baud,["!SC", 0, ra, ch4.LOWBYTE, ch4.HIGHBYTE, CR] ENDIF IF ch5 > 0 THEN SEROUT Sdat, baud,["!SC", 0, ra, ch5.LOWBYTE, ch5.HIGHBYTE, CR] ENDIF IF ch6 > 0 THEN SEROUT Sdat, baud,["!SC", 0, ra, ch6.LOWBYTE, ch6.HIGHBYTE, CR] ENDIF IF ch7 > 0 THEN SEROUT Sdat, baud,["!SC", 0, ra, ch7.LOWBYTE, ch7.HIGHBYTE, CR] ENDIF ELSE DEBUG "NCK:",CR ENDIF RETURN