stm32烧写源码dos
stm32烧写源码(dos)stm32烧写源码(dos)stm32烧写源码(dos)
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1045 2017-12-28 11:45 stm32_flash_2Debuginfo.txt
文件 1928 2017-12-27 20:50 stm32_flash_2DebugLED.bin
文件 69632 2009-11-03 20:51 stm32_flash_2DebugSTBLLIB.dll
文件 7617024 2017-12-28 11:27 stm32_flash_2Debugstm32_flash.exe
文件 73728 2009-11-03 20:51 stm32_flash_2DebugSTUARTBLLIB.dll
文件 1654 2010-01-23 13:12 stm32_flash_2ReadMe.txt
文件 454 2010-01-23 13:12 stm32_flash_2Resource.h
文件 9431 2010-01-23 12:28 stm32_flash_2
s232.cpp
文件 3422 2009-11-01 18:48 stm32_flash_2
s232.h
文件 34365 2009-10-31 22:02 stm32_flash_2STBLLIB.cpp
文件 69632 2009-11-03 20:51 stm32_flash_2STBLLIB.dll
文件 22783 2010-01-23 13:45 stm32_flash_2STBLLIB.h
文件 11290 2009-11-03 20:51 stm32_flash_2STBLLIB.lib
文件 300 2010-01-23 13:12 stm32_flash_2StdAfx.cpp
文件 1106 2010-01-23 13:12 stm32_flash_2StdAfx.h
文件 1053 2010-01-23 13:07 stm32_flash_2stm32_flash.cpp
文件 341 2010-01-23 12:24 stm32_flash_2stm32_flash.h
文件 19444 2017-12-27 19:59 stm32_flash_2stm32_flash_2.aps
文件 250 2010-01-23 13:12 stm32_flash_2stm32_flash_2.clw
文件 4359 2017-12-28 11:03 stm32_flash_2stm32_flash_2.cpp
文件 4199 2010-01-24 18:05 stm32_flash_2stm32_flash_2.dsp
文件 549 2010-01-23 13:16 stm32_flash_2stm32_flash_2.dsw
文件 347 2010-01-23 13:12 stm32_flash_2stm32_flash_2.h
文件 58368 2010-01-24 18:05 stm32_flash_2stm32_flash_2.ncb
文件 54784 2010-01-24 18:05 stm32_flash_2stm32_flash_2.opt
文件 1682 2010-01-24 18:04 stm32_flash_2stm32_flash_2.plg
文件 1457 2010-01-23 13:12 stm32_flash_2stm32_flash_2.rc
文件 74448896 2017-12-28 11:55 stm32_flash_2stm32_flash_2.sdf
文件 892 2017-12-27 19:59 stm32_flash_2stm32_flash_2.sln
..A..H. 18944 2017-12-28 11:55 stm32_flash_2stm32_flash_2.v11.suo
............此处省略11个文件信息
/******************** (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_2Debuginfo.txt
文件 1928 2017-12-27 20:50 stm32_flash_2DebugLED.bin
文件 69632 2009-11-03 20:51 stm32_flash_2DebugSTBLLIB.dll
文件 7617024 2017-12-28 11:27 stm32_flash_2Debugstm32_flash.exe
文件 73728 2009-11-03 20:51 stm32_flash_2DebugSTUARTBLLIB.dll
文件 1654 2010-01-23 13:12 stm32_flash_2ReadMe.txt
文件 454 2010-01-23 13:12 stm32_flash_2Resource.h
文件 9431 2010-01-23 12:28 stm32_flash_2
s232.cpp
文件 3422 2009-11-01 18:48 stm32_flash_2
s232.h
文件 34365 2009-10-31 22:02 stm32_flash_2STBLLIB.cpp
文件 69632 2009-11-03 20:51 stm32_flash_2STBLLIB.dll
文件 22783 2010-01-23 13:45 stm32_flash_2STBLLIB.h
文件 11290 2009-11-03 20:51 stm32_flash_2STBLLIB.lib
文件 300 2010-01-23 13:12 stm32_flash_2StdAfx.cpp
文件 1106 2010-01-23 13:12 stm32_flash_2StdAfx.h
文件 1053 2010-01-23 13:07 stm32_flash_2stm32_flash.cpp
文件 341 2010-01-23 12:24 stm32_flash_2stm32_flash.h
文件 19444 2017-12-27 19:59 stm32_flash_2stm32_flash_2.aps
文件 250 2010-01-23 13:12 stm32_flash_2stm32_flash_2.clw
文件 4359 2017-12-28 11:03 stm32_flash_2stm32_flash_2.cpp
文件 4199 2010-01-24 18:05 stm32_flash_2stm32_flash_2.dsp
文件 549 2010-01-23 13:16 stm32_flash_2stm32_flash_2.dsw
文件 347 2010-01-23 13:12 stm32_flash_2stm32_flash_2.h
文件 58368 2010-01-24 18:05 stm32_flash_2stm32_flash_2.ncb
文件 54784 2010-01-24 18:05 stm32_flash_2stm32_flash_2.opt
文件 1682 2010-01-24 18:04 stm32_flash_2stm32_flash_2.plg
文件 1457 2010-01-23 13:12 stm32_flash_2stm32_flash_2.rc
文件 74448896 2017-12-28 11:55 stm32_flash_2stm32_flash_2.sdf
文件 892 2017-12-27 19:59 stm32_flash_2stm32_flash_2.sln
..A..H. 18944 2017-12-28 11:55 stm32_flash_2stm32_flash_2.v11.suo
............此处省略11个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)