Presentation is loading. Please wait.

Presentation is loading. Please wait.

組員 : 甘志安 曾家昱 陳盈任 吳俊輝 指導教授 : 黃慶祥教授 行李機器車. 程式結合紅外線發收 {$STAMP BS2p,test1,test2} ' {$PBASIC 2.5} ' 此程式只供切換 IF IN13 = 0 THEN DEBUG "run remote",CR RUN 1 ENDIF.

Similar presentations


Presentation on theme: "組員 : 甘志安 曾家昱 陳盈任 吳俊輝 指導教授 : 黃慶祥教授 行李機器車. 程式結合紅外線發收 {$STAMP BS2p,test1,test2} ' {$PBASIC 2.5} ' 此程式只供切換 IF IN13 = 0 THEN DEBUG "run remote",CR RUN 1 ENDIF."— Presentation transcript:

1 組員 : 甘志安 曾家昱 陳盈任 吳俊輝 指導教授 : 黃慶祥教授 行李機器車

2 程式結合紅外線發收 {$STAMP BS2p,test1,test2} ' {$PBASIC 2.5} ' 此程式只供切換 IF IN13 = 0 THEN DEBUG "run remote",CR RUN 1 ENDIF

3 紅外線無接收到直走 ' {$STAMP BS2p} ' {$PBASIC 2.5} ' auto-two car go only Sdat PIN 12 'PSC data ra CON 0 'Disable PSC Speed Ramping Function Baud CON 1021 'BaudRate 2400, BS2P use this speed to communicate with PSC pw1 VAR Word 'left wheel pw2 VAR Word 'right wheel pw3 VAR Word 'left arm shoulder pw4 VAR Word 'left arm elbow pw5 VAR Word 'right arm shoulder pw6 VAR Word 'right arm elbow pw7 VAR Word 'head set_up: POLLIN 11,1 POLLRUN 5 POLLMODE 4

4 pw1 = 750 ' car go pw2 = 750 ' car go pw3 = 750 pw4 = 750 pw5 = 750 pw6 = 750 pw7 = 750 SEROUT Sdat, Baud+$8000,["!SC", 1, ra, pw1.LOWBYTE, pw1.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 2, ra, pw2.LOWBYTE, pw2.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 3, ra, pw3.LOWBYTE, pw3.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 4, ra, pw4.LOWBYTE, pw4.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 5, ra, pw5.LOWBYTE, pw5.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 6, ra, pw6.LOWBYTE, pw6.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 7, ra, pw7.LOWBYTE, pw7.HIGHBYTE, CR] DEBUG"car go begin",CR DO car_go: DEBUG "car go",CR pw1 = 710 pw2 = 790 SEROUT Sdat, Baud+$8000,["!SC", 1, ra, pw1.LOWBYTE, pw1.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 2, ra, pw2.LOWBYTE, pw2.HIGHBYTE, CR] DEBUG "car move",CR LOOP

5 接收到紅外線開始追蹤程式碼 ' {$STAMP BS2p} ' {$PBASIC 2.5} ' stop auto-two and Sdat PIN 12 'PSC data ra CON 0 'Disable PSC Speed Ramping Function Baud CON 1021 'BaudRate 2400, BS2P use this speed to communicate with PSC Sio PIN 15 'AP8 T2400 CON 1021 T38K4 CON 45 Open CON $8000 ABaud CON Open + T38k4 ' baud jumper out Addr CON %11 ' both address jumpers out a VAR Nib ' -----[ I/O Definitions ] for Infrared Enable PIN 7 ' low = reader on RX PIN 8 ' serial from reader LastTag CON 3 ' -----[ Variables ] for Infrared buf VAR Byte(10) ' Infrared bytes buffer tagNum VAR Nib ' from EEPROM table idx VAR Byte ' tag byte index segment VAR Byte 'AP8 holle VAR Byte 'AP8 pw1 VAR Word 'left wheel pw2 VAR Word 'right wheel pw3 VAR Word 'left arm shoulder pw4 VAR Word 'left arm elbow pw5 VAR Word 'right arm shoulder pw6 VAR Word 'right arm elbow 'pw7 VAR Word 'head Setup: POLLIN 11,0 ' 當 pin 10 為 0 時 跳回 aotu-two POLLRUN 3 'auto-two 程式為 slot 3 POLLMODE 4 ' 初始值 initial: DEBUG "run R2 car stopand and execute Infrared",CR pw1 = 750 pw2 = 750 pw3 = 750 pw4 = 750 pw5 = 750 pw6 = 750 'pw7 = 750

6 ' -----[ Initialization ] for Infrared IF IN13 = 0 AND IN14 = 0 THEN RUN 0 ENDIF 'DEBUG"Apw3=",DEC pw3," ","Apw4=",DEC pw4," ","Apw5=",DEC pw5," ","Apw6=",DEC pw6," ","Apw7=",DEC pw7," ","Apw=",DEC pw8,CR SEROUT Sdat, Baud+$8000,["!SC", 1, ra, pw1.LOWBYTE, pw1.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 2, ra, pw2.LOWBYTE, pw2.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 3, ra, pw3.LOWBYTE, pw3.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 4, ra, pw4.LOWBYTE, pw4.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 5, ra, pw5.LOWBYTE, pw5.HIGHBYTE, CR] SEROUT Sdat, Baud+$8000,["!SC", 6, ra, pw6.LOWBYTE, pw6.HIGHBYTE, CR] 'SEROUT Sdat, Baud+$8000,["!SC", 7, ra, pw7.LOWBYTE, pw7.HIGHBYTE, CR] 'SEROUT Sdat, Baud+$8000,["!SC", 8, ra, pw8.LOWBYTE, pw8.HIGHBYTE, CR] DEBUG"STOP done",CR Reset: HIGH Enable ' turn of Infrared reader main: DEBUG"looping",CR DEBUG ? IN11 ' RFID LOW Enable ' activate the reader SERIN RX, 1021,1000,test, [WAIT($0A), STR buf\10] ' wait for hdr + ID HIGH Enable 'Display_Tag: segment=2 holle = 1 DEBUG "Tag Identification number is: ", CR DEBUG buf(9),CR a=buf(9) IF a=5 THEN SEROUT Sio, ABaud, ["!AP8", Addr, "L", segment,1] DEBUG "AP8",buf(9),CR GOTO Setup ENDIF IF a=8 THEN SEROUT Sio, ABaud, ["!AP8", Addr, "L", holle,1] DEBUG "AP8",buf(9),CR GOTO Setup ENDIF IF a 5 THEN SEROUT Sio, ABaud, ["!AP8", Addr, "X", segment] DEBUG "E", buf(9),CR ENDIF IF a 8 THEN SEROUT Sio, ABaud, ["!AP8", Addr, "X", holle] DEBUG "E", buf(9),CR ENDIF test: DEBUG"test" GOTO main ' repeats code

7 END


Download ppt "組員 : 甘志安 曾家昱 陳盈任 吳俊輝 指導教授 : 黃慶祥教授 行李機器車. 程式結合紅外線發收 {$STAMP BS2p,test1,test2} ' {$PBASIC 2.5} ' 此程式只供切換 IF IN13 = 0 THEN DEBUG "run remote",CR RUN 1 ENDIF."

Similar presentations


Ads by Google