一、

Similar documents
untitled

1

untitled

untitled

國立故宮博物院九十三年提升服務品質績效報告

untitled

untitled

untitled

untitled

地方公共服務績效比較評量之探討—標竿學習策略的觀點

第五章 鄉鎮圖書館閱讀推廣活動之分析

untitled

untitled

untitled

untitled

第三章 我國非營業特種基金制度及運作現況

了 立 連 立 量 領 來 例 蘭 便 不 數 不 論 更 更 更 力 更 參 例 來 例 見 量 度 量 量 參 論 量 行 量 量 瑩 理 來 錄 量 量 不 力 省 力 立 力 量 量 量 了 量 便 錄 錄 錄 料 說 省 6

九十四年度提升服務品質績效報告

untitled

臺灣地區的警察教育現況與展望

「UPENN牙醫學院見習及費城文藝之旅」成果報告書

大陸黨報集團化發展之研究

untitled

untitled

untitled

untitled

untitled

國家圖書館典藏電子全文

龍華科技大學

個人提供土地與建設公司合建分屋並出售合建分得之房屋,核屬營業稅法規定應課徵營業稅之範圍,自本函發布日起,經建築主管機關核發建造執照之合建分屋案件,附符合說明二之規定者外,均應辦理營業登記,課徵營業稅及營利事業所得稅

untitled

untitled

行政院國科會九十一年度專題研究

九十三年第三期檔案管理工作研習營學員建議事項答覆情形彙整表

untitled

STANDARD

國立中山大學學位論文典藏.PDF

公務出國報告

untitled

untitled

untitled


untitled

untitled

第四章、個案研究

台灣紡織產業發展史物件徵集計畫研究報告

「行政院及所屬各機關出國報告綜合處理要點」

untitled

個人教室 / 網路硬碟

untitled

untitled

廉 樂 不 廉 倫 理 廉 倫 理 領 不 參 領 不 若 不 不 不 不 利 聯 行 李 聯 例 律

專 題 論 述

untitled

untitled

untitled

untitled

龍 華 科 技 大 學

untitled

untitled

untitled

untitled

untitled

untitled

untitled

untitled

untitled

untitled

untitled

正確的姿勢 — 疾病疼痛不上身

2004/9/30

untitled

一考察行程

嘉義市都市計畫保護區農業區土地使用審查要點(草案)

untitled

國立政治大學新研所碩士在職專班

untitled

untitled

untitled

untitled

經濟部標準檢驗局台南分局

吃寒天真的能減肥嗎

untitled

移民資料

untitled

性別主流化簡介

untitled

untitled

中華人民共和國殘疾人保障法(2008年修訂)

年 奈 粒 率 立 老 數 率 數 來 流 來 了 了 力 來 更 力 更 1

untitled

歷 更 不 略 都 參 金 2006 年 年 理 參 李 金 劉

依據教育部八十九年 月 日臺(八九)技(二)字第 號函

untitled

廢證相關作業

untitled

「我國憲政史」的多元詮釋

台灣經濟新報資料庫

untitled

untitled

Transcription:

VB&RS232 車 老 年

理 路 來 行錄 理 錄 不易 路 例 路 連 路 來 論 都 連 錄 來 料量 便 路 不易 連 路 省 裡 路 來 量 I

錄 數 I 錄 II 錄 1 1.1 1 1.2 2 路 3 2.1 路 3 2.2 3 2.3 路 4 路說 5 3.1 89C51 路 5 3.2 RS232 路 7 3.3 5V 8 TG-11----------------------------------------------12 4.1 路說 13 4.1-1 路 13 4.1-2 路 14 4.2 15 16 5.1 RS232 & 89C51 & 流 16 5.2 VB 18 5.2-1VB&RS-232 18 5.2-2 ----------------------------------------------------------19 六 流 26 6.1 8051 26 6.2 VB 27 6.3 路 28 論 29 7.1 論 29 7.2 30 7.3 32 參 料 33 錄 34 II

錄 數 1.1 2 2.1 路 layout3 2.2 3 2.3 4 2.4 路 4 3.1 路 5 3.2 RESET 路 6 3.3 路 6 3.4 RS232 路 7 3.5 5V 流 路 8 3.6 9 3.7 1N5404 10 3.8 2200µF16V 11 3.9 IC 7805 11 4.1 說 12 4.2 說 13 4.3 路 13 4.4 路 14 6.1 路 28 錄 (A) 路 路 34 錄 (B) 路 路 34 錄 (C). 路 路 35 錄 (D).89C51 路 路 35 錄 E).89C51 路 路 35 錄 (F). 路 36 錄 (G). 路 36 錄 (H). 車 37 III

1. VB 連 2. 車 滑 路 行 3. 車 數 益精 數 數 量 來 (API) 領 易 不 力 路 便 率 路 便 行 數 數 GSM 行 數 率 連 來 率 路 ITS 數 類 路 車 路 度 連 利 路 (HTML) 來 行 1.1 車 車 利 VB 滑 路 行 車 離 聯 離 便 1

1.2 利 VB RS232 MAX232 (HT-12E)(TG-11A Transmitter) 利 (TG-11B Receiver) 89C5 Pin10 來 車 CCD VB 1.1 2

2.1 路 路 2.2 2.1 路 layout 2.2 3

2.3 路 2.3 2.4 路 4

路說 PC 車 2.1 RS232 ICMAX-232 ICMAX-32 行 RS-232 6 2 來 連 89C51 10 (RXD) 8051 VB 來 令 8051 若 P2.P2.3 P2.2 P2.4 率 Q1ON Q2 OFF)MOTOR1 (Q3 ON Q4OFF)MOTOR 車 說 兩 +12V +6V +12V +6V 7805 路 89C51 3.1 89C51 路 89C51 XTAL1(pin19)XTAL2(pin18) 3.1 pin1819 率 3.58MHz 6MHz11.0592MHz12MHz 20p~30p 3.1 路 5

路 RST(pin9) 89C51 3.2 行 SW RESET 5V 行 3.2 RESET 路 路 3.3 89C51 路 PORT2 連 LED 200 流 LED VCC PORT2 0 LED 亮 例 PORT2.0 = 0 LED 亮 89C51 數 路 3.3 路 6

讀 數 KEYBOARD DIP 度 度 理 都 類 類 數 (ADC) 類 數 便 89C51 理 料 理 3.2 RS232 路 RS232 串列 不 都 RS232 行 料 3.4 RS232 路 例 MAX-232 89C51 來 RS232 89C51 率 (Baud-Rate) 率 料 3.4 RS232 路 89C51 路 不 列 行量 7

Step1.VCC(pin40) GND(pin20)5V Step2.RESET(pin9) 0V Step3.EA/VPP(pin31)5V Step4.ALE/PROG(pin30) Step5.MAX-232 路 pin2 pin6 10V 10V 3.3 5V 5V 路 3.5 零 便 5V 路 理 T 1 110 降 12 流 流 D 1 D 4 流 濾 IC 7805 路 5V 3.5 5V 流 路 1 5V 零 數 零 便 零 說 便 7805 行 (pin1: pin2: pin3:) 3.9 8

數量 流 1. 5V 零 數 5V T1 110 流 降 12 流 3.6 連 110 綠 連 金 12V012V 12V 流 ab 連 3.6 & 9

流 1N5404 流 流 3.7 1N5404 路 3.7 1N5404 來 若 來 不 來 3.8 2200µF16V 路裡 濾 10

3.8 2200µF16V IC 7805 IC 路 理 5 3.9 Input 連 5V 路 1 Output 連 2 Gnd 連 3 3.9 IC 7805 IC 7805 來 理 路連 良 離 路 裡 11

TG-11 TG-11 (1) UHF 路 (2) IC 不易 (3) DIP 來 (4) 率 300MHz 434MHz 4.1 4.2 TG-11 說 說 參 料 4.1 說 12

4.1 路說 4.2 說 4.1-1 路 4.3 路 315MHz 率 HT-12E IC Pin1~Pin8 連 DIP JUMP 來 行 HT-12E IC Pin10~Pin13 ON/OFF 4.3 路 13

4.1-2 路 4.4 路 315MHz 率 HT-12D IC Pin1~Pin8 連 DIP JUMP 來 行 HT-12D IC Pin10~Pin13 不 4.4 路 14

4.2 金 不 C 金 B Normal Close 諸 B-C 都 狀 C 金 A Normal Open 諸 A-C 15

5.1 RS232 & 89C51 & 流 ORG 0H JMP START START: MOV SP,#5FH MOV TMOD,#20H MOV TH1,#0E8H SETB TR1 MOV SCON,#01010000B CPL P0.6 MOV R5,#25 CALL DELAY1 SETB P0.6 CALL DELAY1 CPL P0.6 CALL DELAY1 SETB P0.6 CALL DELAY1 CPL P0.6 WAIT: JNB RI,WAIT CPL P0.3 CLR RI ================================================= RF: CALL DELAY1 SETB P2.0 SETB P2.2 SETB P2.3 SETB P2.4 JNB P3.0,RIGHT JNB P3.1,FORWARD JNB P3.2,LEFT JNB P3.3,BACK RIGHT: CLR P2.0 16

SETB P2.2 CLR P2.3 SETB P2.4 JNB P3.0,RIGHT JMP RF FORWARD: CLR P2.0 CLR P2.2 CLR P2.3 JNB P3.1,FORWARD JMP RF LEFT: SETB P2.0 CLR P2.2 CLR P2.3 SETB P2.4 JNB P3.2,LEFT JMP RF BACK: SETB P2.0 SETB P2.2 SETB P2.3 CLR P2.4 JNB P3.3,BACK JMP RF ================================================= DELAY1: DEL11: MOV R7,#100 DJNZ R7,$ DJNZ R6,DEL11 DJNZ R5,DELAY1 RET END 17

5.2 VB 5.2-1 VB&RS-232 : Private Sub Form_Load() MSComm1.PortOpen = True End Sub Private Sub Command1_Click() buf = Trim(Text1.Text) MSComm1.Output = Chr(buf) End Sub Private Sub Command2_Click() MSComm1.Output = Chr(1) End Sub Private Sub Command3_Click() MSComm1.Output = Chr(2) End Sub Private Sub Command4_Click() MSComm1.Output = Chr(3) End Sub Private Sub Command5_Click() MSComm1.PortOpen = False End End Sub 18

5.2-2 : Option Explicit Declare Function capgetdriverdescription Lib "avicap32.dll" Alias "capgetdriverdescriptiona" (ByVal dwdriverindex As Long, ByVal lpszname As String, ByVal cbname As Long, ByVal lpszver As String, ByVal cbver As Long) As Long Declare Function capcreatecapturewindow Lib "avicap32.dll" Alias "capcreatecapturewindowa" (ByVal lpszwindowname As String, ByVal dwstyle As Long, ByVal x As Long, ByVal y As Long, ByVal nwidth As Long, ByVal nheight As Long, ByVal hwndparent As Long, ByVal nid As Long) As Long Declare Function SendMessage_Long Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wmsg As Long, ByVal wparam As Long, ByVal lparam As Long) As Long Declare Function SendMessage_Any Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wmsg As Long, ByVal wparam As Long, ByRef lparam As Any) As Long Declare Function SendMessage_String Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wmsg As Long, ByVal wparam As Long, ByVal lparam As String) As Long Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hwndinsertafter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wflags As Long) As Long Const WS_CHILD = &H40000000 Const WS_VISIBLE = &H10000000 Type POINTAPI x As Long y As Long End Type Type CAPTUREPARMS 19

dwrequestmicrosecperframe As Long fmakeuserhitoktocapture As Long wpercentdropforerror As Long fyield As Long dwindexsize As Long wchunkgranularity As Long fusingdosmemory As Long wnumvideorequested As Long fcaptureaudio As Long wnumaudiorequested As Long vkeyabort As Long fabortleftmouse As Long fabortrightmouse As Long flimitenabled As Long wtimelimit As Long fmcicontrol As Long fstepmcidevice As Long dwmcistarttime As Long dwmcistoptime As Long fstepcaptureat2x As Long wstepcaptureaverageframes As Long dwaudiobuffersize As Long fdisablewritecache As Long AVStreamMaster As Long End Type Type CAPDRIVERCAPS wdeviceindex As Long fhasoverlay As Long fhasdlgvideosource As Long fhasdlgvideoformat As Long fhasdlgvideodisplay As Long fcaptureinitialized As Long fdriversuppliespalettes As Long hvideoin As Long hvideoout As Long hvideoextin As Long hvideoextout As Long End Type Type CAPSTATUS uiimagewidth As Long 20

uiimageheight As Long flivewindow As Long foverlaywindow As Long fscale As Long ptscroll As POINTAPI fusingdefaultpalette As Long faudiohardware As Long fcapfileexists As Long dwcurrentvideoframe As Long dwcurrentvideoframesdropped As Long dwcurrentwavesamples As Long dwcurrenttimeelapsedms As Long hpalcurrent As Long fcapturingnow As Long dwreturn As Long wnumvideoallocated As Long wnumaudioallocated As Long End Type Const WM_USER = &H400 Const WM_CAP_START = WM_USER Const WM_CAP_SET_SEQUENCE_SETUP = WM_CAP_START + 64 Const WM_CAP_SEQUENCE = WM_CAP_START + 62 Const WM_CAP_DLG_VIDEOFORMAT = WM_CAP_START + 41 Const WM_CAP_DLG_VIDEOCOMPRESSION = WM_CAP_START + 46 Const WM_CAP_DLG_VIDEOSOURCE = WM_CAP_START + 42 Const WM_CAP_GRAB_FRAME = WM_CAP_START + 60 Const WM_CAP_FILE_SAVEDIB = WM_CAP_START + 25 Const WM_CAP_SET_PREVIEW = WM_CAP_START + 50 Const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10 Const WM_CAP_DRIVER_GET_CAPS = WM_CAP_START + 14 Const WM_CAP_GET_STATUS = WM_CAP_START + 54 Const WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52 Const SWP_NOMOVE = &H2& Const SWP_NOZORDER = &H4& Const SWP_NOSENDCHANGING = &H400& Dim CapHWnd As Long ' HWnd 21

Function Connect_CaptureDriver(Frm As Form, ByVal ndriverindex As Long) As Boolean ' 連 Dim retval As Boolean Dim Caps As CAPDRIVERCAPS Dim i As Long Debug.Assert (ndriverindex < 10) And (ndriverindex >= 0) ' 連 retval =SendMessage_Long(CapHWnd,WM_CAP_DRIVER_C ONNECT, ndriverindex, 0&) If retval = False Then Exit Function ' 力 retval = SendMessage_Any(CapHWnd, WM_CAP_DRIVER_GET_CAPS, Len(Caps), Caps) ' 率 Call Set_PreviewRate(CapHWnd, 66) '15 FPS ' Call Set_Preview ' Call ResizeCaptureWindow Connect_CaptureDriver = True End Function Function Get_AVIWindow() As Boolean ' 連 Dim p As CAPTUREPARMS With p.fmakeuserhitoktocapture = 1.wPercentDropForError = 10.fUsingDOSMemory = 0.wNumVideoRequested = 32.fAbortLeftMouse = 1.fAbortRightMouse = 1.wChunkGranularity = 0.dwAudioBufferSize = 0.fDisableWriteCache = 1.fMCIControl = 0.fStepCaptureAt2x = 0.fYield = 0.wNumAudioRequested = 4.AVStreamMaster = 0& 22

.dwindexsize = 9000& '15 60, 10.dwRequestMicroSecPerFrame = 1000000 \ 15 ' 率.fCaptureAudio = 1 '.flimitenabled = 0 '.wtimelimit = 30 ' 數 End With Get_AVIWindow = SendMessage_Any(CapHWnd, WM_CAP_SET_SEQUENCE_SETUP, Len(p), p) Get_AVIWindow = SendMessage_Long(CapHWnd, WM_CAP_SEQUENCE, 0&, 0&) End Function Sub Get_CaptureWindow(Optional nm As Long = 0) ' 立 'nm, 若不, Dim n As String n = "" CapHWnd = capcreatecapturewindow(n, WS_CHILD Or WS_VISIBLE, 0, 0, 160, 120, Screen.ActiveForm.hwnd, 0) Call Connect_CaptureDriver(Screen.ActiveForm, nm) End Sub Function Get_CaptureWindow_Status(ByVal hcapwnd As Long, ByRef capstat As CAPSTATUS) As Boolean ' 狀 Get_CaptureWindow_Status = SendMessage_Any(hCapWnd, WM_CAP_GET_STATUS, Len(capStat), capstat) End Function Function Get_SimpleWindow(n As String) As Boolean ' 'n Dim b As Boolean Call SendMessage_Long(CapHWnd, WM_CAP_GRAB_FRAME, 0&, 0&) b = SendMessage_String(CapHWnd, WM_CAP_FILE_SAVEDIB, 0&, n) Call Set_Preview ' 行, 不, 23

(Freeze) 狀 Get_SimpleWindow = b End Function Sub ResizeCaptureWindow() ' Dim b As Boolean Dim capstat As CAPSTATUS ' 狀 b = Get_CaptureWindow_Status(CapHWnd, capstat) If b = True Then ' CallSetWindowPos(CapHWnd,0&,0&,0&,capStat.uiImageWidth,capS tat.uiimageheight,swp_nomoveorswp_nozorderorswp_n OSENDCHANGING) Screen.ActiveForm.Width = capstat.uiimagewidth * Screen.TwipsPerPixelX + 120 Screen.ActiveForm.Height = capstat.uiimageheight * Screen.TwipsPerPixelY + 640 End If End Sub Function Set_CaptureSource() ' 來 Set_CaptureSource = SendMessage_Long(CapHWnd, WM_CAP_DLG_VIDEOSOURCE, 0&, 0&) End Function Function Set_CompressRate() As Boolean Set_CompressRate = SendMessage_Long(CapHWnd, WM_CAP_DLG_VIDEOCOMPRESSION, 0&, 0&) End Function Function Set_Preview() As Boolean ' Set_Preview = SendMessage_Long(CapHWnd, WM_CAP_SET_PREVIEW, True, 0&) End Function Function Set_PreviewRate(ByVal hcapwnd As Long, ByVal wms As Long) As Boolean ' 率 24

Set_PreviewRate = SendMessage_Long(hCapWnd, WM_CAP_SET_PREVIEWRATE, wms, 0&) End Function Function Set_VideoFormat() As Boolean ' 度 Set_VideoFormat = SendMessage_Long(CapHWnd, WM_CAP_DLG_VIDEOFORMAT, 0&, 0&) Call ResizeCaptureWindow End Function 25

六 流 6.1 8051 串列 LED 串列 料 N 料 Y 1~7 N Y 車 1 Y N 2 車 CCD Y N 3 Y 車 CCD N N Y 車 4 車 Y Y Y 7 6 5 N N N 26

6.2 VB 率 立 連 CCD 27

6.3 路 6.1 路 28

論 7.1 論 車 便 料 了 8051 不 了 都 度 了 IC 錄 錄 了 8051 落 VB VB 8051 率 不 了 料 8051 了 RS232 了 利 了 老 了 切都 力 不 不 更 29

7.2 利 VB 8051 都不 來 參 了 8051 路 來 年 都 不 來 料 說 料 利 說 立 老 立 不 老 VB 老 老 來 CCD(Charge Coupled Device) 不 CCD 見 力 了 了 參 DirectX 來 不 易 理 SendMessage API 數來 了 都 數來 SendMessage 數 若 CCD 車 都不 了 都 度 料 老 路 落 VB 8051 老 串列 RS232 了 利 了 老 了 切都 力 不 不 不 老 更 30

力 路 都 來 參 若 不 論不 來 老 來 路 不 老 力 量 不 立 不 來 列 1. 2. IC 來 3. 零 立 31

7.3 94.03 料 理 路 路 VB&RS-232 94.05 8051 路 料 VB 94.07 VB 老 路 94.09~94.09 8051 (RS-232) 路 95.01 路 路 95.02 路連 連 95.04~95.05 32

參 李 8051 8051 理 8051 益 逸 立 Visual Basic RS232 串列 逸 立 Visual Basic 串 列 33

錄 錄 (A) 路 RS-232 路 錄 (B) 路 RS-232 路 34

錄 (C). 路 路 RS-232 路 錄 (D).89C51 路 路 錄 (E).89C51 路 路 35

錄 (F). 路 89C51 路 路 路 RS-232 錄 (G). 路 36

錄 (H). 車 37