代码搜索结果
找到约 1,320 项符合
Modbus 的代码
crc.c
<mark>modbus</mark> 的 crc 计算
CRC是先调入一值是全“1”的16位寄存器,然后调用一过程将消息中连续的8位字节各当前寄存器中的值进行处理。仅每个字符中的8Bit数据对CRC有效,起始位和停止位以及奇偶校验位均无效。 CRC产生过程中,每个8位字符都单独和寄存器内容相或(OR),结果向最低有效位方向移动,最高有效位以0填充。 ...
mbs.c
#include
unsigned char Mbs_slave; /* slave number */
pthread_t Mbs_thread; /* slave thread */
int Mbs_device; /* slave device */
/********************************************
commun.c
#include
#include
/************************************************************************************
Mb_test_crc : check the crc of a packet
********************************
modbus.h
/*
#ifndef __modbus__
#define __modbus__ 1
*/
#include
#include
#include
#include
#include
#include
#include
#include
mbm.c
#include
#include
int Mb_device; /* device tu use */
int Mbm_Pid_Child; /* PID child used to read the slave answer */
int Mbm_Pid_Sleep; /* PID use to wait the end of the t
master-example.c
#include
/* compiling : gcc master-example.c -o master-example -lmodbus */
int main()
{
int device;
Mbm_trame trame;
int result;
int data_in[256];
int data_out[256];
/*
myprotocol.c
/* myProtocol.c - Example custom protocol for vxWorks (Modbus over Ethernet) */
/* Copyright 1992-2002 Wind River Systems, Inc.
THIS CODE IS FOR EXAMPLE PURPOSES ONLY, USE AT YOUR OWN RISK
modbus.c
#include
#define uint unsigned int
//字地址 0 - 255 (只取低8位)
//位地址 0 - 255 (只取低8位)
/* CRC 高位字节值表 */
const uint8 code auchCRCHi[]={
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0x