资源简介
stm32烧写源码(dos)stm32烧写源码(dos)stm32烧写源码(dos)
代码片段和文件信息
/******************** (C) COPYRIGHT 2009 STMicroelectronics ********************
* File Name : rs232.cpp
* Author : MCD Application Team
* Version : v2.1.0
* Date : 11/02/2009
* Description : Implements the RS232 class for COM communication
********************************************************************************
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/
#include
#include
#include
#include “rs232.h“
/// set serial communication over COM1 with 115200 Bauds 8 bitand no parity.
CRS232::CRS232()
{
hcom = NULL;
bufferSize = 2048;
numPort = 1;
speedInBaud = 115200;
nbBit = 8;
parity = 2;
nbStopBit = 1;
isConnected = FALSE;
bEcho =FALSE;
}
CRS232::~CRS232()
{
if(hcom != NULL)
closeCom();
}
void CRS232::SetComSettings(int _numPort long _speedInBaud int _nbBit int _parity float _nbStopBit)
{
numPort = _numPort;
speedInBaud = _speedInBaud;
nbBit = _nbBit;
parity = _parity;
nbStopBit = _nbStopBit;
}
bool CRS232::open()
{
char buf[] = “\\\\.\\COM1“;
if(numPort<1 || numPort>999)
return false;
if(speedInBaud<1)
return false;
if(nbBit<5 || nbBit > 9)
return false;
if(parity<0 || parity > 2)
return false;
if(nbStopBit<1 || nbStopBit > 2)
return false;
itoa(numPort &buf[7] 10);
hcom=CreateFile(buf GENERIC_READ | GENERIC_WRITE 0 NULL OPEN_EXISTING 0 NULL);
if (hcom==0 || hcom==INVALID_HANDLE_VALUE)
return false;
isConnected = TRUE;
setTimeOut(5000);
if ( !SetupComm(hcom bufferSize bufferSize) )
return false;
if ( !GetCommState(hcom &dcb))
return false;
dcb.BaudRate = speedInBaud;
dcb.ByteSize = nbBit;
if(nbStopBit == 1)
dcb.StopBits = ONESTOPBIT;
if(nbStopBit == 1.5)
dcb.StopBits = ONE5STOPBITS;
if(nbStopBit == 2)
dcb.StopBits = TWOSTOPBITS;
if(parity == 0)
dcb.Parity = NOPARITY;
if(parity == 1)
dcb.Parity = ODDPARITY;
if(parity == 2)
dcb.Parity = EVENPARITY;
//if EnableDTROnOpen then
dcb.fDtrControl = /*DTR_CONTROL_ENABLE;*/ DTR_CONTROL_DISABLE;
dcb.fRtsControl = /*RTS_CONTROL_ENABLE;*/ RTS_CONTROL_DISABLE;
if (!SetCommState(hcom &dcb))
return false;
else
return true;
}
void CRS232::closeCom()
{
CloseHandle(hcom);
hc
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1045 2017-12-28 11:45 stm32_flash_2\Debug\info.txt
文件 1928 2017-12-27 20:50 stm32_flash_2\Debug\LED.bin
文件 69632 2009-11-03 20:51 stm32_flash_2\Debug\STBLLIB.dll
文件 7617024 2017-12-28 11:27 stm32_flash_2\Debug\stm32_flash.exe
文件 73728 2009-11-03 20:51 stm32_flash_2\Debug\STUARTBLLIB.dll
文件 1654 2010-01-23 13:12 stm32_flash_2\ReadMe.txt
文件 454 2010-01-23 13:12 stm32_flash_2\Resource.h
文件 9431 2010-01-23 12:28 stm32_flash_2\rs232.cpp
文件 3422 2009-11-01 18:48 stm32_flash_2\rs232.h
文件 34365 2009-10-31 22:02 stm32_flash_2\STBLLIB.cpp
文件 69632 2009-11-03 20:51 stm32_flash_2\STBLLIB.dll
文件 22783 2010-01-23 13:45 stm32_flash_2\STBLLIB.h
文件 11290 2009-11-03 20:51 stm32_flash_2\STBLLIB.lib
文件 300 2010-01-23 13:12 stm32_flash_2\StdAfx.cpp
文件 1106 2010-01-23 13:12 stm32_flash_2\StdAfx.h
文件 1053 2010-01-23 13:07 stm32_flash_2\stm32_flash.cpp
文件 341 2010-01-23 12:24 stm32_flash_2\stm32_flash.h
文件 19444 2017-12-27 19:59 stm32_flash_2\stm32_flash_2.aps
文件 250 2010-01-23 13:12 stm32_flash_2\stm32_flash_2.clw
文件 4359 2017-12-28 11:03 stm32_flash_2\stm32_flash_2.cpp
文件 4199 2010-01-24 18:05 stm32_flash_2\stm32_flash_2.dsp
文件 549 2010-01-23 13:16 stm32_flash_2\stm32_flash_2.dsw
文件 347 2010-01-23 13:12 stm32_flash_2\stm32_flash_2.h
文件 58368 2010-01-24 18:05 stm32_flash_2\stm32_flash_2.ncb
文件 54784 2010-01-24 18:05 stm32_flash_2\stm32_flash_2.opt
文件 1682 2010-01-24 18:04 stm32_flash_2\stm32_flash_2.plg
文件 1457 2010-01-23 13:12 stm32_flash_2\stm32_flash_2.rc
文件 74448896 2017-12-28 11:55 stm32_flash_2\stm32_flash_2.sdf
文件 892 2017-12-27 19:59 stm32_flash_2\stm32_flash_2.sln
..A..H. 18944 2017-12-28 11:55 stm32_flash_2\stm32_flash_2.v11.suo
............此处省略11个文件信息
相关资源
- SW6124.rar
- 124 Sn中的侏儒四极共振和中子皮模式
- (Z)-2-(5-氨基-124-噻二唑-3-基)-2
- NVP6124-Nextchip.pdf
- 思科1240 AP ios
- Cisco 1242 胖AP IOS
- RH124官网教材
- lpc2124中文手册
- nxlog-ce-2.8.1248
- 2387377a89124256b945dd13e7b5c2f3.zip
- zw_u012453634-8168535-计算机网络实验.zi
- 研华运动控制卡说明使用手册 PCI-12
- yelp数据集124037
- 外卖点餐系统112443
- qq_29683655_11247966.zip
- 5124386zofui_taskself.zip
- PlatEMO20171124
- 1242222GBT28181.rar
- cisco 1142n 124-25d-JA2
- c1130-rcvk9w8-tar.124-10b.JA3.tar
- linaro-precise-ubuntu-desktop-20121124-560.tar
- AD7124中文手册
- ap1240IOS文件
- JT/T 1242-2019《营运车辆自动紧急制动系
- unzip-c3725-adventerprisek9-mz.124-15.T5
- c2800nm-adventerprisek9-mz.124-25.bin
- 国行建伍TK-8302_TK-7302)中文写频软件
- NEXTCHIP芯片NVP6158c NVP6134 NVP6124B NVP613
- Moxa ioLogik E1200 E1242 Active OPC Server 配置
-
Remob
jects Remoting SDK for Delphi - 9.0.97
评论
共有 条评论