📄 abstract.txt
字号:
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'
***********************************************************************************************
该程序在计算机上实现了USB虚拟串口功能,程序运行时在计算机上增加了一个USB虚拟串口,程序首次运行时提示要装串口驱动,注意驱动程序文件是该程序文件夹即USBCDC2文件夹中的mcb2300-vcom.inf文件,安装时请指定该文件为驱动程序。驱动安装完成后单击我的电脑选择属性,在硬件中单击设备管理器,展开端口目录就可以看到名字为MCB2300 USB VCOM Port (COMx)的USB虚拟串口已经安装好了,其中在设备管理器上显示的x是一个不确定的数字,不同配置的电脑x可能会不同,它是根据电脑上已经存在的串口数再动态配置x值的。
有两种方法可以测试USB虚拟串口,一种是测试时用串口线;另一种是测试时不用串口线,用串口线测试的情况见USBCDC1程序文件夹中的程序,本文件夹中的程序采用的是不用串口线进行测试,测试前先为虚拟串口建一个超级终端(建立方法请见"创建超级终端"),波特率设为9600,然后打开程序文件夹中的vcomdemomain.c文件,将其中的宏定义修改为#define NO_UART_CABL 1 ,修改好后将程序编译下载到ARM芯片中后按S1键(RESET)后就可以测试USB虚拟串口了,这时请将虚拟串口的超级终端打开,在键盘上输入数字或字母,输入后就会在开发板上的八个LED上显示相应键值的ASCII码值,以二进制的形式输出,LED亮为1,不亮为0,同时按一下开发板上的S2键(INT0),虚拟串口的超级终端就会显示字符串“INT0 Pressed"。另外,程序运行时LCD上显示程序的名称,是一个辅助程序,可以作为程序下载成功后正确运行的标志。
实验步骤:
1.不要先给开发板加电源,实验前应将LCD液晶屏插在开发板的lcd接口上,将仿真器(ULINK2)的数据接口排线插在开发板的JTAG接口上。
2.将两根USB线分别插在电脑的两个USB接口上,插好后一根接开发板的电源及数据接口端,另一根接仿真器(ULINK2)的电源及数据接口端,插好后相应的电源指示灯会亮,否则请检查线路连接是否正确。
3.打开USBCDC2文件夹下的VirtualCOM.Uv2工程文件,单击双箭头向下的全编译图标,完成程序的全编译并且生成可以下载烧写到ARM芯片的AXF文件,如果编译通不过或提示程序有错误,请修改程序错误,调试程序直到编译通过。
4.全编译通过后,单击标有load的双箭头向下的图标,完成AXF文件通过仿真器下载和烧写到ARM芯片中,下载完成后按S1键(即RESET复位键)就可以在开发板上运行程序了。
5.在KEIL界面下左端的Project Workspace窗口中,双击Source Code文件夹下的vcomdemomain.c程序文件,右端窗口中就会显示相应的程序内容,因为main函数就在其中,程序就是从main函数开始执行的,找到其中的main函数,可以查看程序的执行流程。
6.在KEIL状态栏的Debug下,选择Start/Stop Debug Session, 开始调试程序。
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -