📄 command.cpp
字号:
// Command.cpp: the implementation of the CCommand class
//
// This software can be offered for free and used as necessary to aid
// in your program developments.
//
// RENESAS TECHNOLOGY CORPORATION, RENESAS SOLUTIONS CORPORATION,
// and related original software developers assume no responsibility
// for any damage or infringement of any third-party's rights, originating
// in the use of the following software.
// Please use this software under the agreement and acceptance of these conditions.
//
// Copyright(C)1998(2003) RENESAS TECHNOLOGY CORPORATION AND RENESAS SOLUTIONS CORPORATION
// ALL RIGHTS RESERVED
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "M16Cflsh.h"
#include "Command.h"
#include "SettingCmd.h"
#include "SaveIni.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/disappearance
//////////////////////////////////////////////////////////////////////
CCommand::CCommand()
{
}
CCommand::~CCommand()
{
}
//////////// This is the minute when I added later. //////////////////////////////////////////////
// It makes the letter line that shows the hexadecimal number the int style .
int CCommand::AToHex(TCHAR* chHex)
{
int nRet = 0; // the transformation result
// A hexadecimal number at the time of.
if(isxdigit(*chHex))
{
if(isdigit(*chHex))
{
nRet = (*chHex - '0');
}
else
{
if(islower(*chHex))
{
nRet = (*chHex - 'a' + 0x0a);
}
else
{
nRet = (*chHex - 'A' + 0x0a);
}
}
}
// It transforms it into 0 at the time of except for hexadecimal several.
else
{
nRet = 0;
*chHex = '0';
}
return nRet;
}
// I check whether the communication is passing.
BOOL CCommand::CheckComm(CSerialComm* pComObj)
{
// Transmission the lead status command.
BYTE newsend = 0x70;
pComObj->Write(&newsend, 1);
BYTE receive[2];
if(!pComObj->Read(receive, 2))
{
CommError();
return FALSE;
}
return TRUE;
}
// I check status.
BOOL CCommand::CheckState(CSerialComm* pComObj, CString strMode)
{
// Transmission the lead status command.
BYTE newsend = 0x70;
pComObj->Write(&newsend, 1);
// I check status.
int nFlag = 0;
if(strMode == "erase")
{
nFlag = 5;
}
else if(strMode == "program")
{
nFlag = 4;
}
BYTE receive[2];
if(!pComObj->Read(receive, 2))
{
CommError();
return TRUE;
}
BOOL bState = 1 & (receive[0] >> nFlag);
return bState;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -