⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defppi.h

📁 西门子PPI协议源码
💻 H
字号:
////////////////////////////////////////////////////////////////////////////
/////////**  defPPI.h                                //////////////////////
//** 这个头文件定义了PPI通用的程序,和效验
#ifndef DEFPPI_H
#define DEFPPI_H
#include "std_def.h"

#define PPI_READ_BYTE_REG     0   //** read hold register 
#define PPI_WRITE_BYTE_REG    1   //** read hold register

#ifndef MCU_UART_NUM
 #define MCU_UART_NUM 1
#endif

// only for ppi,是此文件的全局变量
uchar uc_ppi_is_connect[2] = {0,0};
uchar uc_ppi_comm_count[2] = {2,2};	   	  //=2是为主考虑的,当从时无所谓
uchar uc_ppi_acq_cmd_5c[2] = {0,0};
uchar uc_ppi_EnterCount[2] = {0,0};
uchar uc_ppi_master_step[2]= {0,0};
#define PPI_F_MASTER_REQUIRED 0
#define PPI_F_MASTER_ENTERED  1
#define PPI_F_MASTER_SEND_DC  2
#define PPI_F_MASTER_ANSW_DC  3 //这是接收函数发的DC ME ME 指令,发完后定时,再有主程序引发主发函数工作
#define PPI_F_MASTER_E5AGAIN  4
#define PPI_F_MASTER_SUCCESS  5
//************************************************************************************************
//**Purpose: PPI校验,
//**         丢弃进位.返回一个8位的数
uchar uc_ppi_addtest(UCHAR_PDATA * puc_buf,UCHAR uc_bytes)
{   
    UCHAR uc_sum;
	uc_sum  = 0;
	
    while(uc_bytes--)
	{ 
		uc_sum += *puc_buf++;
	}
	return (uc_sum);
}

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -