\hypertarget{bsp___mod_bus_8cpp_source}{}\doxysection{bsp\+\_\+\+Mod\+Bus.\+cpp} \label{bsp___mod_bus_8cpp_source}\index{D:/gitt/MicrochipFor32/bsp\_Device/bsp\_ModBus/bsp\_ModBus.cpp@{D:/gitt/MicrochipFor32/bsp\_Device/bsp\_ModBus/bsp\_ModBus.cpp}} \mbox{\hyperlink{bsp___mod_bus_8cpp}{浏览该文件的文档.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00001}00001 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00002}00002 \textcolor{comment}{ \#}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00003}00003 \textcolor{comment}{ \# Copyright (c) 2022 Yuankang Liang(XerolySkinner)}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00004}00004 \textcolor{comment}{ \#}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00005}00005 \textcolor{comment}{ \# 本软件按原样提供,无任何明示或暗示}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00006}00006 \textcolor{comment}{ \# 在任何情况下,作者都不承担任何损害赔偿责任}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00007}00007 \textcolor{comment}{ \#}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00008}00008 \textcolor{comment}{ \# 使用的许可声明:}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00009}00009 \textcolor{comment}{ \# 1. 不得歪曲本软件的来源,你不能声称你编写了原始软件.}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00010}00010 \textcolor{comment}{ \# 2. 免费授予以任何目的,前提是版权声明出现在所有副本中.}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00011}00011 \textcolor{comment}{ \# 并且版权声明和许可声明同时出现.}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00012}00012 \textcolor{comment}{ \# 3. 你有使用,复制,修改,分发,和销售本软件的许可.}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00013}00013 \textcolor{comment}{ \# 4. 如果你在产品中使用,产品文档中的声明是赞赏的但不是必须的.}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00014}00014 \textcolor{comment}{ \# 5. 本通知不得从任何来源删除或更改.}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00015}00015 \textcolor{comment}{ \#}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00016}00016 \textcolor{comment}{ \# Yuankang Liang(XerolySkinner)}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00017}00017 \textcolor{comment}{ \# E-\/mail:zabbcccbbaz@163.com}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00018}00018 \textcolor{comment}{ \# QQ:2715099320}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00019}00019 \textcolor{comment}{ \# Mobile Phone:13005636215}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00020}00020 \textcolor{comment}{ \#}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00021}00021 \textcolor{comment}{ \# All rights reserved.}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00022}00022 \textcolor{comment}{ */}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00023}00023 } \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00033}00033 \textcolor{preprocessor}{\#pragma once}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00035}00035 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00036}00036 \textcolor{comment}{// 头文件}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00037}00037 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{bsp___mod_bus_8h}{bsp\_ModBus.h}}"{}}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00038}00038 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{bsp___c_r_c_8h}{bsp\_CRC.h}}"{}}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00039}00039 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00040}00040 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00042}00042 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00043}00043 \textcolor{comment}{// 类函数}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00050}\mbox{\hyperlink{classbsp___mod_bus___tx_ada605c0e9195aefd43968cfe5b347565}{00050}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___mod_bus___tx_ada605c0e9195aefd43968cfe5b347565}{bsp\_ModBus\_Tx::ReadKeepReg}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} address, \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} mem) \{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00051}00051 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} dat[8];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00052}00052 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} crc;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00053}00053 dat[0] = \mbox{\hyperlink{classbsp___mod_bus___tx_a4ee454ddd116e2b608d9b35b02eee0e4}{ID}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00054}00054 dat[1] = \mbox{\hyperlink{bsp___mod_bus_8h_ac6d9f6c262df700be9045045502e7643a9ec5f1febebcade07d80148f67d51594}{Fun\_R\_KeepReg}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00055}00055 dat[2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00056}00056 dat[3] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00057}00057 dat[4] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00058}00058 dat[5] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00059}00059 crc = \mbox{\hyperlink{bsp___c_r_c_8cpp_abb1fda5ed561362d12fe987758986919}{CRC16\_MODBUS}}(dat, 6);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00060}00060 dat[6] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00061}00061 dat[7] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00062}00062 \mbox{\hyperlink{classbsp___mod_bus___tx_ac017f6145ba6f87c69a16510f868dcc2}{Transmit}}(dat,8);\}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00063}00063 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00070}\mbox{\hyperlink{classbsp___mod_bus___tx_af055e2569107b8ece7abdce3301e9444}{00070}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___mod_bus___tx_af055e2569107b8ece7abdce3301e9444}{bsp\_ModBus\_Tx::ReadInReg}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} address, \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} mem) \{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00071}00071 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} dat[8];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00072}00072 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} crc;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00073}00073 dat[0] = \mbox{\hyperlink{classbsp___mod_bus___tx_a4ee454ddd116e2b608d9b35b02eee0e4}{ID}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00074}00074 dat[1] = \mbox{\hyperlink{bsp___mod_bus_8h_ac6d9f6c262df700be9045045502e7643ab285b7d7c40fa9a85adba60a3a769fca}{Fun\_R\_InReg}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00075}00075 dat[2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00076}00076 dat[3] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00077}00077 dat[4] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00078}00078 dat[5] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00079}00079 crc = \mbox{\hyperlink{bsp___c_r_c_8cpp_abb1fda5ed561362d12fe987758986919}{CRC16\_MODBUS}}(dat,6);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00080}00080 dat[6] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00081}00081 dat[7] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00082}00082 \mbox{\hyperlink{classbsp___mod_bus___tx_ac017f6145ba6f87c69a16510f868dcc2}{Transmit}}(dat, 8);\}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00083}00083 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00090}\mbox{\hyperlink{classbsp___mod_bus___tx_a02ea1680f5c361f2cf4ebcb48b565281}{00090}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___mod_bus___tx_a02ea1680f5c361f2cf4ebcb48b565281}{bsp\_ModBus\_Tx::WriteOneReg}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} address, \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} var) \{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00091}00091 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} dat[8];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00092}00092 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} crc;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00093}00093 dat[0] = \mbox{\hyperlink{classbsp___mod_bus___tx_a4ee454ddd116e2b608d9b35b02eee0e4}{ID}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00094}00094 dat[1] = \mbox{\hyperlink{bsp___mod_bus_8h_ac6d9f6c262df700be9045045502e7643a2e8689560573f300af3a6c48fdd6ce86}{Fun\_W\_OneReg}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00095}00095 dat[2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00096}00096 dat[3] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00097}00097 dat[4] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&var))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00098}00098 dat[5] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&var))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00099}00099 crc = \mbox{\hyperlink{bsp___c_r_c_8cpp_abb1fda5ed561362d12fe987758986919}{CRC16\_MODBUS}}(dat, 6);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00100}00100 dat[6] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00101}00101 dat[7] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00102}00102 \mbox{\hyperlink{classbsp___mod_bus___tx_ac017f6145ba6f87c69a16510f868dcc2}{Transmit}}(dat, 8);\}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00103}00103 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00112}\mbox{\hyperlink{classbsp___mod_bus___tx_a268c136782f8146662f33878522c270c}{00112}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___mod_bus___tx_a268c136782f8146662f33878522c270c}{bsp\_ModBus\_Tx::WriteRegs}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} address,\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} mem,\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}}* var) \{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00113}00113 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} bytes = 9 + mem * 2;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00114}00114 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}* dat = (\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)malloc(bytes);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00115}00115 \textcolor{keywordflow}{if} (dat == NULL)\textcolor{keywordflow}{return};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00116}00116 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} crc;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00117}00117 dat[0] = \mbox{\hyperlink{classbsp___mod_bus___tx_a4ee454ddd116e2b608d9b35b02eee0e4}{ID}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00118}00118 dat[1] = \mbox{\hyperlink{bsp___mod_bus_8h_ac6d9f6c262df700be9045045502e7643a54562faaab8c1c932c46c6c4cb2552f9}{Fun\_W\_Regs}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00119}00119 dat[2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00120}00120 dat[3] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00121}00121 dat[4] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00122}00122 dat[5] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00123}00123 dat[6] = mem*2;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00124}00124 \textcolor{comment}{// 填入数据}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00125}00125 \textcolor{keywordflow}{for} (\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} i = 0; i < mem; i++)\{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00126}00126 dat[7 + i*2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)var)[1+i*2];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00127}00127 dat[8 + i*2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)var)[0+i*2];\}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00128}00128 crc = \mbox{\hyperlink{bsp___c_r_c_8cpp_abb1fda5ed561362d12fe987758986919}{CRC16\_MODBUS}}(dat, bytes -\/ 2);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00129}00129 dat[bytes -\/ 2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00130}00130 dat[bytes -\/ 1] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00131}00131 \mbox{\hyperlink{classbsp___mod_bus___tx_ac017f6145ba6f87c69a16510f868dcc2}{Transmit}}(dat, bytes);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00132}00132 free(dat);\}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00133}00133 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00142}\mbox{\hyperlink{classbsp___mod_bus___tx_acc267977d61716e25fd3e3ec57bc2960}{00142}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___mod_bus___tx_acc267977d61716e25fd3e3ec57bc2960}{bsp\_ModBus\_Tx::WriteRegsVar}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} address, \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} mem,...) \{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00143}00143 va\_list table;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00144}00144 va\_start(table,mem);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00145}00145 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} vars;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00146}00146 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} bytes = 9 + mem * 2;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00147}00147 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}* dat = (\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)malloc(bytes);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00148}00148 \textcolor{keywordflow}{if} (dat == NULL)\textcolor{keywordflow}{return};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00149}00149 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} crc;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00150}00150 dat[0] = \mbox{\hyperlink{classbsp___mod_bus___tx_a4ee454ddd116e2b608d9b35b02eee0e4}{ID}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00151}00151 dat[1] = \mbox{\hyperlink{bsp___mod_bus_8h_ac6d9f6c262df700be9045045502e7643a54562faaab8c1c932c46c6c4cb2552f9}{Fun\_W\_Regs}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00152}00152 dat[2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00153}00153 dat[3] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00154}00154 dat[4] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00155}00155 dat[5] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00156}00156 dat[6] = mem*2;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00157}00157 \textcolor{comment}{// 填入数据}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00158}00158 \textcolor{keywordflow}{for} (\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} i = 0; i < mem; i++)\{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00159}00159 vars=va\_arg(table, \mbox{\hyperlink{varint_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}});} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00160}00160 dat[7 + i*2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&vars))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00161}00161 dat[8 + i*2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&vars))[0];\}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00162}00162 crc = \mbox{\hyperlink{bsp___c_r_c_8cpp_abb1fda5ed561362d12fe987758986919}{CRC16\_MODBUS}}(dat, bytes -\/ 2);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00163}00163 dat[bytes -\/ 2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00164}00164 dat[bytes -\/ 1] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00165}00165 \mbox{\hyperlink{classbsp___mod_bus___tx_ac017f6145ba6f87c69a16510f868dcc2}{Transmit}}(dat, bytes);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00166}00166 free(dat);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00167}00167 va\_end(table);\}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00168}00168 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00175}\mbox{\hyperlink{classbsp___mod_bus___tx_abc721f5c61e236df505f3447818be921}{00175}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___mod_bus___tx_abc721f5c61e236df505f3447818be921}{bsp\_ModBus\_Tx::ReadOutCoil}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} address, \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} mem) \{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00176}00176 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} dat[8];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00177}00177 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} crc;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00178}00178 dat[0] = \mbox{\hyperlink{classbsp___mod_bus___tx_a4ee454ddd116e2b608d9b35b02eee0e4}{ID}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00179}00179 dat[1] = \mbox{\hyperlink{bsp___mod_bus_8h_ac6d9f6c262df700be9045045502e7643afa0834864982fdb57c9a954bdbd1599b}{Fun\_R\_OutCoil}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00180}00180 dat[2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00181}00181 dat[3] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00182}00182 dat[4] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00183}00183 dat[5] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00184}00184 crc = \mbox{\hyperlink{bsp___c_r_c_8cpp_abb1fda5ed561362d12fe987758986919}{CRC16\_MODBUS}}(dat, 6);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00185}00185 dat[6] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00186}00186 dat[7] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00187}00187 \mbox{\hyperlink{classbsp___mod_bus___tx_ac017f6145ba6f87c69a16510f868dcc2}{Transmit}}(dat, 8);\}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00188}00188 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00195}\mbox{\hyperlink{classbsp___mod_bus___tx_a76e712e8d638ecc7b453e1c8afbbad98}{00195}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___mod_bus___tx_a76e712e8d638ecc7b453e1c8afbbad98}{bsp\_ModBus\_Tx::ReadInCoil}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} address, \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} mem) \{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00196}00196 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} dat[8];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00197}00197 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} crc;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00198}00198 dat[0] = \mbox{\hyperlink{classbsp___mod_bus___tx_a4ee454ddd116e2b608d9b35b02eee0e4}{ID}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00199}00199 dat[1] = \mbox{\hyperlink{bsp___mod_bus_8h_ac6d9f6c262df700be9045045502e7643a8c70d4d5036c1a3f9c51a545d13fdd92}{Fun\_R\_InCoil}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00200}00200 dat[2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00201}00201 dat[3] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00202}00202 dat[4] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00203}00203 dat[5] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00204}00204 crc = \mbox{\hyperlink{bsp___c_r_c_8cpp_abb1fda5ed561362d12fe987758986919}{CRC16\_MODBUS}}(dat, 6);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00205}00205 dat[6] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00206}00206 dat[7] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00207}00207 \mbox{\hyperlink{classbsp___mod_bus___tx_ac017f6145ba6f87c69a16510f868dcc2}{Transmit}}(dat, 8);\}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00208}00208 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00217}\mbox{\hyperlink{classbsp___mod_bus___tx_aa8d37cc0cefaad8f41bc1d195a326d95}{00217}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___mod_bus___tx_aa8d37cc0cefaad8f41bc1d195a326d95}{bsp\_ModBus\_Tx::WriteOneCoil}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} address, \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} state)\{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00218}00218 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} dat[8];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00219}00219 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} var = state ? 0xFF00 : 0x0000;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00220}00220 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} crc;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00221}00221 dat[0] = \mbox{\hyperlink{classbsp___mod_bus___tx_a4ee454ddd116e2b608d9b35b02eee0e4}{ID}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00222}00222 dat[1] = \mbox{\hyperlink{bsp___mod_bus_8h_ac6d9f6c262df700be9045045502e7643a95bb48bd2de82de8a2f5684a6cccff0f}{Fun\_W\_OneCoil}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00223}00223 dat[2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00224}00224 dat[3] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00225}00225 dat[4] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&var))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00226}00226 dat[5] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&var))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00227}00227 crc = \mbox{\hyperlink{bsp___c_r_c_8cpp_abb1fda5ed561362d12fe987758986919}{CRC16\_MODBUS}}(dat, 6);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00228}00228 dat[6] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00229}00229 dat[7] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00230}00230 \mbox{\hyperlink{classbsp___mod_bus___tx_ac017f6145ba6f87c69a16510f868dcc2}{Transmit}}(dat, 8);\}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00231}00231 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00240}\mbox{\hyperlink{classbsp___mod_bus___tx_a630ac7566fe9d1773baa813802202d0f}{00240}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___mod_bus___tx_a630ac7566fe9d1773baa813802202d0f}{bsp\_ModBus\_Tx::WriteCoils}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} address, \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} mem, \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}* var) \{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00241}00241 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} bytes = (mem / 8) + (mem \% 8 != 0) + 9;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00242}00242 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}* dat = (\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)malloc(bytes);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00243}00243 \textcolor{keywordflow}{if} (dat == NULL)\textcolor{keywordflow}{return};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00244}00244 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} crc;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00245}00245 dat[0] = \mbox{\hyperlink{classbsp___mod_bus___tx_a4ee454ddd116e2b608d9b35b02eee0e4}{ID}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00246}00246 dat[1] = \mbox{\hyperlink{bsp___mod_bus_8h_ac6d9f6c262df700be9045045502e7643a0a40a9622af4e5cb7daecbdb303ee35e}{Fun\_W\_Coils}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00247}00247 dat[2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00248}00248 dat[3] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00249}00249 dat[4] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00250}00250 dat[5] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00251}00251 dat[6] = bytes -\/ 9;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00252}00252 \textcolor{comment}{// 填入数据}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00253}00253 \textcolor{keywordflow}{for} (\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} i = 0; i < bytes -\/ 9; i++)dat[7 + i] = var[i];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00254}00254 crc = \mbox{\hyperlink{bsp___c_r_c_8cpp_abb1fda5ed561362d12fe987758986919}{CRC16\_MODBUS}}(dat, bytes -\/ 2);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00255}00255 dat[bytes -\/ 2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00256}00256 dat[bytes -\/ 1] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&crc))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00257}00257 \mbox{\hyperlink{classbsp___mod_bus___tx_ac017f6145ba6f87c69a16510f868dcc2}{Transmit}}(dat, bytes);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00258}00258 free(dat);\}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00259}00259 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00268}\mbox{\hyperlink{classbsp___mod_bus___tx_a280c5d7c99196a11b5fee7b34421a8ff}{00268}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___mod_bus___tx_a280c5d7c99196a11b5fee7b34421a8ff}{bsp\_ModBus\_Tx::WriteCoilsVar}}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} address, \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} mem,...) \{} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00269}00269 va\_list table;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00270}00270 va\_start(table,mem);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00271}00271 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} var=0;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00272}00272 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} crc;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00273}00273 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} bytes = (mem / 8) + (mem \% 8 != 0) + 9;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00274}00274 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}* dat = (\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)malloc(bytes);} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00275}00275 \textcolor{keywordflow}{if} (dat == NULL)\textcolor{keywordflow}{return};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00276}00276 dat[0] = \mbox{\hyperlink{classbsp___mod_bus___tx_a4ee454ddd116e2b608d9b35b02eee0e4}{ID}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00277}00277 dat[1] = \mbox{\hyperlink{bsp___mod_bus_8h_ac6d9f6c262df700be9045045502e7643a0a40a9622af4e5cb7daecbdb303ee35e}{Fun\_W\_Coils}};} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00278}00278 dat[2] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00279}00279 dat[3] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&address))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00280}00280 dat[4] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[1];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00281}00281 dat[5] = ((\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}*)(\&mem))[0];} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00282}00282 dat[6] = bytes -\/ 9;} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00283}00283 \textcolor{comment}{// 填入管脚信息}} \DoxyCodeLine{\Hypertarget{bsp___mod_bus_8cpp_source_l00284}00284 \textcolor{keywordflow}{for}(\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} i=0;i