uint8与与或监测【c/c++课程】

复制代码
// uinttest.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
#ifndef GENERIC
#define GENERIC
#endif
using namespace std;
typedef unsigned char   uint8;    //!< Unsigned 8 bit integer
typedef unsigned short  uint16;   //!< Unsigned 16 bit integer
 
uint8 uartbuf[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
uint8 UartRxBuf[2];
void Start_UartSend(uint8 *buf, uint16 len)
{
    for (uint8 i = 0; i<len; i++)
        uartbuf[i] = buf[i];
}
 
uint16 IOTest_Result = 0;   //IO检测结果
uint16 IOTest_Result1 = 0;  //第1次检测
uint16 IOTest_Result2=0;  //第2次检测
int _tmain(int argc, _TCHAR* argv[])
{
#if 1
    uint8 IO_Test_CMDA[6] = { 'A', 'T', '+', 'I', 'O', 'A' };
    uint8 IO_Test_CMDB[6] = { 'A', 'T', '+', 'I', 'O', 'B' };
 
    Start_UartSend(IO_Test_CMDA, 6);
    //uartbuf[6] = '\0';
#endif

    IOTest_Result2 |= (1 << 2);
    IOTest_Result1 |= (1 << 2);

    IOTest_Result = IOTest_Result1&IOTest_Result2;

    std::cout << sizeof(uint8) << std::endl;

    std::cout << uartbuf << std::endl;

    std::cout << IOTest_Result1 << endl;

    system("PAUSE");

    return 0;
}
复制代码

 

posted on   lydstory  阅读(24)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2023-06-04 tr069 cwmp协议二
2023-06-04 网络协议篇之CWMP协议(三)—— RPC方法
2023-06-04 vscode关闭全文查找
2021-06-04 freeglut-2.0.1
2021-06-04 fpga
2021-06-04 LoRa
2021-06-04 北京睿骊通电子技术有限公司

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示