代码搜索结果
找到约 1,320 项符合
Modbus 的代码
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];
cha
modbus.c.txt
/*CRC校验码计算参考程序
CRC码的计算方法如下 CRC码的计算方法如下:
1.预置1个16位的寄存器(下称CRC寄存器),初试化其内容为十六进制数0xFFFF;
2.把第一个待计算的数据即通讯信息帧的首字节与CRC寄存器的低8位相异或,把结果放回CRC寄存器;
3.把CRC寄存器的内容右移一位用0填补最高位即进行逻辑移位处理并检查右移后的移出位;
4.如果移出位为0重复第3步即再次 ...
modbus.c
#include"pic18.h"
#define crl RB1
unsigned char checkerror,recetimeout,localaddr=0x01;
unsigned char rececount=0,rececount_temp=0, flag_time0=0;
unsigned char send_buf[64];
unsigned char rec
vb-modbus.txt
Option Explicit
Private Text1text As String
Private RTUCRC As String
'串口选择
Private Sub Combo1_Click()
MSComm1.CommPort = Combo1.ListIndex + 1
End Sub
'数据位改变
Private Sub Combo2_Cl
新建 文本文档.txt
通过S7-200西门子PLC做串口通讯 实现Modbus RTU协议通讯
自己写的 。。
Function crcresult(ByVal data As Long, ByVal genpoly As Long, ByVal crcdata As Long) As Long
Dim tmpi As Integer
data = data * 2
For tmpi = 8