话说偶本来想注个册下个资料就走的。。。
1.发送部份程序有问题,如下注释部分是原来的程序,再下两句是我改的。而且“else”语句缩进少了个TAB,很可能是用正确的程序故意改错的。。。
/* if(length < limit)
length = limit;
else
limit = length;//use limit to save retval*/
if(length > limit)
length = limit;
2.插上电脑后,无法装驱程,WIN7和XP都一样。附件的驱程不知道装到哪去了。。在网上查了半天,终于搞定:
复制以下内容,另存为.inf文件——
;------------------------------------------------------------------------------
; STMicroelectronics Comunication Device Class driver (CDC) INF FILE
; (C)2009 Copyright STMicroelectronics
;------------------------------------------------------------------------------
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MANUFACTURER%
LayoutFile=XXXXXXXXXf
;CatalogFile=%FILENAME%.cat
DriverVer= 9/20/2009,1.2.0
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
[DestinationDirs]
DefaultDestDir=12
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
[DriverInstall.nt]
include=XXXXXXXXXf
CopyFiles=DriverCopyFiles.nt
AddReg=XXXXXXXXXXXXXXXXXXXdReg
[DriverCopyFiles.nt]
XXXXXXXXXs,,,0x20
[XXXXXXXXXXXXXXXXXXXdReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[XXXXXXXXXXXXXXXXXXXrvices]
AddService=usbser, 0x00000002, DriverService.nt
[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; Windows Vista x64 / Windows7 x64 Support
;------------------------------------------------------------------------------
[DriverInstall.NTamd64]
include=XXXXXXXXXf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=XXXXXXXXXXXXXXXXXXXXXXXXdReg
[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20
[XXXXXXXXXXXXXXXXXXXXXXXXdReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[XXXXXXXXXXXXXXXXXXXXXXXXrvices]
AddService=usbser, 0x00000002, DriverService.NTamd64
[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; VID/PID Settings
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall,USB\\VID_0483&[s:9]ID_5740
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall,USB\\VID_0483&[s:9]ID_5740
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
[Strings]
FILENAME="ST_Virtual"
DRIVERFILENAME ="usbser"
MANUFACTURER="STMicroelectronics"
INSTDISK="CDC_DISK"
DESCRIPTION="STM Virtual COM Port"
SERVICE="Virtual Com Driver"