?? abstract.txt
字號(hào):
The Virtual COM port project is a demo program for Keil MCB2300 Board
using the Philips LPC2368 Microcontroller.
It demonstrates an USB Virtual COM port based on a Windows USB host
driver (usbser.sys).
The PC will install a virtual COM port on the PC (see Driver Installation).
After installation an additional port "MCB2300 USB VCom Port(COMx)"
can be found under System/Hardware/Device Manager/Ports(COM&LPT).
Number "x" is not fixed as different PC configuration may have different
"x" displayed on the device manager. The USB host driver assigns "x"
dynamically based on the existing COM port configuration of the system.
There are two ways to test the USB Virtual COM port:
(1) With serial cable:
Open two Hyperterminal windows.
One with "MCB2300 USB VCom Port(COMx)"
One with "Communications Port (COM1)".
Connect PC port COM1 to MCB2300 COM1 and open "COM1" and "COMx".
Data from COM1 will be echoed on "COMx" and visa versa.
So, this is bi-directional communication between the physical COM
port 1 on MCB2300 and the virtual COM port COMx on host PC.
(2) Without serial cable:
In vcomdemo.c, change #define NO_UART_CABLE from 0 to 1.
Recompile the project and update the flash.
Once the flash has been updated reset the MCB2300 board.
Open a Hyperterminal window.
One with "MCB2300 USB VCom Port(COMx)"
Data typed in will be displayed using LEDs from P2.0 to P2.7.
If the INT0 (S2) button is pressed, the message "INT0 pressed"
will be shown on "COMx".
The Virtual COM Port program is available for the following targets:
MCB2300: configured for on-chip Flash ROM
(used for production or target debugging)
Note: set jumper J5 to 1[2 3] (jumper towards JTAG connector)
for USB soft connect
Driver Installation:
--------------------
"Welcome to the Found New Hardware Wizard" appears
- select 'No, not this time'
- press 'Next'
- select 'Install from a list or specific location (Advanced)'
- press 'Next'
- select 'Search for the best driver in these locations'
- check 'include this location in the serach'
- set to <project folder>
- press 'Next'
"Hardware Installation" appears
"has not passed Windows Logo testing..."
- press 'Continue Anyway'
"Completing the Found New Hardware Wizard" appears
- press 'Finish'
***********************************************************************************************
該程序在計(jì)算機(jī)上實(shí)現(xiàn)了USB虛擬串口功能,程序運(yùn)行時(shí)在計(jì)算機(jī)上增加了一個(gè)USB虛擬串口,程序首次運(yùn)行時(shí)提示要裝串口驅(qū)動(dòng),注意驅(qū)動(dòng)程序文件是該程序文件夾即USBCDC1文件夾中的mcb2300-vcom.inf文件,安裝時(shí)請(qǐng)指定該文件為驅(qū)動(dòng)程序。驅(qū)動(dòng)安裝完成后單擊我的電腦選擇屬性,在硬件中單擊設(shè)備管理器,展開端口目錄就可以看到名字為MCB2300 USB VCOM Port (COMx)的USB虛擬串口已經(jīng)安裝好了,其中在設(shè)備管理器上顯示的x是一個(gè)不確定的數(shù)字,不同配置的電腦x可能會(huì)不同,它是根據(jù)電腦上已經(jīng)存在的串口數(shù)再動(dòng)態(tài)配置x值的。
有兩種方法可以測(cè)試USB虛擬串口,一種是測(cè)試時(shí)用串口線;另一種是測(cè)試時(shí)不用串口線,不用串口線測(cè)試的情況見USBCDC2程序文件夾中的程序,本文件夾中的程序采用串口線進(jìn)行測(cè)試,測(cè)試前請(qǐng)將串口線的一端接開發(fā)板的COM1口,另一端接在電腦的串口上,連接好后分別為串口線連接的電腦串口和虛擬串口建一個(gè)超級(jí)終端(建立方法請(qǐng)見"創(chuàng)建超級(jí)終端"),波特率都設(shè)為9600。將程序編譯下載到ARM芯片中后按S1鍵(RESET)就可以測(cè)試USB虛擬串口了,這時(shí)請(qǐng)將兩個(gè)超級(jí)終端打開,將虛擬串口的超級(jí)終端作為當(dāng)前活動(dòng)和輸入窗口,但不要重疊在另一個(gè)超級(jí)終端上,因?yàn)闇y(cè)試USB虛擬串口時(shí)就是通過虛擬串口的超級(jí)終端接收鍵盤上輸入的字符,然后輸出映射到另一個(gè)超級(jí)終端上,顯示鍵盤輸入的字符,如果擋住該窗口就看不見輸入的字符了。另外,程序運(yùn)行時(shí)LCD上顯示程序的名稱,是一個(gè)輔助程序,可以作為程序下載成功后正確運(yùn)行的標(biāo)志。
實(shí)驗(yàn)步驟:
1.不要先給開發(fā)板加電源,實(shí)驗(yàn)前應(yīng)將LCD液晶屏插在開發(fā)板的lcd接口上,將串口線的一端接在開發(fā)板的COM1口,另一端接在電腦的串口上,將仿真器(ULINK2)的數(shù)據(jù)接口排線插在開發(fā)板的JTAG接口上。
2.將兩根USB線分別插在電腦的兩個(gè)USB接口上,插好后一根接開發(fā)板的電源及數(shù)據(jù)接口端,另一根接仿真器(ULINK2)的電源及數(shù)據(jù)接口端,插好后相應(yīng)的電源指示燈會(huì)亮,否則請(qǐng)檢查線路連接是否正確。
3.打開USBCDC1文件夾下的VirtualCOM.Uv2工程文件,單擊雙箭頭向下的全編譯圖標(biāo),完成程序的全編譯并且生成可以下載燒寫到ARM芯片的AXF文件,如果編譯通不過或提示程序有錯(cuò)誤,請(qǐng)修改程序錯(cuò)誤,調(diào)試程序直到編譯通過。
4.全編譯通過后,單擊標(biāo)有l(wèi)oad的雙箭頭向下的圖標(biāo),完成AXF文件通過仿真器下載和燒寫到ARM芯片中,下載完成后按S1鍵(即RESET復(fù)位鍵)就可以在開發(fā)板上運(yùn)行程序了。
5.在KEIL界面下左端的Project Workspace窗口中,雙擊Source Code文件夾下的vcomdemomain.c程序文件,右端窗口中就會(huì)顯示相應(yīng)的程序內(nèi)容,因?yàn)閙ain函數(shù)就在其中,程序就是從main函數(shù)開始執(zhí)行的,找到其中的main函數(shù),可以查看程序的執(zhí)行流程。
6.在KEIL狀態(tài)欄的Debug下,選擇Start/Stop Debug Session, 開始調(diào)試程序。
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -