293 lines
59 KiB
XML
293 lines
59 KiB
XML
|
|
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
||
|
|
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="_bsp___mod_bus_8cpp_source" xml:lang="zh">
|
||
|
|
<title>bsp_ModBus.cpp</title>
|
||
|
|
<indexterm><primary>D:/gitt/MicrochipFor32/bsp_Device/bsp_ModBus.cpp</primary></indexterm>
|
||
|
|
浏览该文件的文档.<programlisting linenumbering="unnumbered"><anchor xml:id="_bsp___mod_bus_8cpp_source_1l00001"/>00001 <emphasis role="comment">/*----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00002"/>00002 <emphasis role="comment"> #</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00003"/>00003 <emphasis role="comment"> #  Copyright (c) 2022 Yuankang Liang(XerolySkinner)</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00004"/>00004 <emphasis role="comment"> #</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00005"/>00005 <emphasis role="comment"> #  本软件按原样提供,无任何明示或暗示</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00006"/>00006 <emphasis role="comment"> #  在任何情况下,作者都不承担任何损害赔偿责任</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00007"/>00007 <emphasis role="comment"> #</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00008"/>00008 <emphasis role="comment"> #  使用的许可声明:</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00009"/>00009 <emphasis role="comment"> #  1.  不得歪曲本软件的来源,你不能声称你编写了原始软件.</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00010"/>00010 <emphasis role="comment"> #  2.  免费授予以任何目的,前提是版权声明出现在所有副本中.</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00011"/>00011 <emphasis role="comment"> #      并且版权声明和许可声明同时出现.</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00012"/>00012 <emphasis role="comment"> #  3.  你有使用,复制,修改,分发,和销售本软件的许可.</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00013"/>00013 <emphasis role="comment"> #  4.  如果你在产品中使用,产品文档中的声明是赞赏的但不是必须的.</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00014"/>00014 <emphasis role="comment"> #  5.  本通知不得从任何来源删除或更改.</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00015"/>00015 <emphasis role="comment"> #</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00016"/>00016 <emphasis role="comment"> #  Yuankang Liang(XerolySkinner)</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00017"/>00017 <emphasis role="comment"> #      E-mail:zabbcccbbaz@163.com</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00018"/>00018 <emphasis role="comment"> #      QQ:2715099320</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00019"/>00019 <emphasis role="comment"> #      Mobile Phone:13005636215</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00020"/>00020 <emphasis role="comment"> #</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00021"/>00021 <emphasis role="comment"> #  All rights reserved.</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00022"/>00022 <emphasis role="comment"> */</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00023"/>00023
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00033"/>00033 <emphasis role="preprocessor">#pragma once</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00035"/>00035 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00036"/>00036 <emphasis role="comment">//  头文件</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00037"/>00037 <emphasis role="preprocessor">#include "<link linkend="_bsp___mod_bus_8h">bsp_ModBus.h</link>"</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00038"/>00038 <emphasis role="preprocessor">#include "<link linkend="_bsp___c_r_c_8h">bsp_CRC.h</link>"</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00039"/>00039 <emphasis role="preprocessor">#include <stdio.h></emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00040"/>00040 <emphasis role="preprocessor">#include <stdlib.h></emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00042"/>00042 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00043"/>00043 <emphasis role="comment">//  类函数</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00050"/><link linkend="_classbsp___mod_bus___tx_1ada605c0e9195aefd43968cfe5b347565">00050</link> <emphasis role="comment"></emphasis><emphasis role="keywordtype">void</emphasis> <link linkend="_classbsp___mod_bus___tx_1ada605c0e9195aefd43968cfe5b347565">bsp_ModBus_Tx::ReadKeepReg</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> address, <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> mem) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00051"/>00051     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> dat[8];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00052"/>00052     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> crc;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00053"/>00053     dat[0] = <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">ID</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00054"/>00054     dat[1] = <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a9ec5f1febebcade07d80148f67d51594">Fun_R_KeepReg</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00055"/>00055     dat[2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00056"/>00056     dat[3] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00057"/>00057     dat[4] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00058"/>00058     dat[5] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00059"/>00059     crc = <link linkend="_bsp___c_r_c_8cpp_1abb1fda5ed561362d12fe987758986919">CRC16_MODBUS</link>(dat, 6);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00060"/>00060     dat[6] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00061"/>00061     dat[7] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00062"/>00062     <link linkend="_classbsp___mod_bus___tx_1ac017f6145ba6f87c69a16510f868dcc2">Transmit</link>(dat,8);}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00063"/>00063 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00070"/><link linkend="_classbsp___mod_bus___tx_1af055e2569107b8ece7abdce3301e9444">00070</link> <emphasis role="comment"></emphasis><emphasis role="keywordtype">void</emphasis> <link linkend="_classbsp___mod_bus___tx_1af055e2569107b8ece7abdce3301e9444">bsp_ModBus_Tx::ReadInReg</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> address, <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> mem) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00071"/>00071     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> dat[8];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00072"/>00072     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> crc;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00073"/>00073     dat[0] = <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">ID</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00074"/>00074     dat[1] = <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643ab285b7d7c40fa9a85adba60a3a769fca">Fun_R_InReg</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00075"/>00075     dat[2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00076"/>00076     dat[3] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00077"/>00077     dat[4] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00078"/>00078     dat[5] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00079"/>00079     crc = <link linkend="_bsp___c_r_c_8cpp_1abb1fda5ed561362d12fe987758986919">CRC16_MODBUS</link>(dat,6);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00080"/>00080     dat[6] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00081"/>00081     dat[7] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00082"/>00082     <link linkend="_classbsp___mod_bus___tx_1ac017f6145ba6f87c69a16510f868dcc2">Transmit</link>(dat, 8);}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00083"/>00083 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00090"/><link linkend="_classbsp___mod_bus___tx_1a02ea1680f5c361f2cf4ebcb48b565281">00090</link> <emphasis role="comment"></emphasis><emphasis role="keywordtype">void</emphasis> <link linkend="_classbsp___mod_bus___tx_1a02ea1680f5c361f2cf4ebcb48b565281">bsp_ModBus_Tx::WriteOneReg</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> address, <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> var) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00091"/>00091     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> dat[8];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00092"/>00092     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> crc;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00093"/>00093     dat[0] = <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">ID</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00094"/>00094     dat[1] = <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a2e8689560573f300af3a6c48fdd6ce86">Fun_W_OneReg</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00095"/>00095     dat[2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00096"/>00096     dat[3] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00097"/>00097     dat[4] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&var))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00098"/>00098     dat[5] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&var))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00099"/>00099     crc = <link linkend="_bsp___c_r_c_8cpp_1abb1fda5ed561362d12fe987758986919">CRC16_MODBUS</link>(dat, 6);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00100"/>00100     dat[6] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00101"/>00101     dat[7] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00102"/>00102     <link linkend="_classbsp___mod_bus___tx_1ac017f6145ba6f87c69a16510f868dcc2">Transmit</link>(dat, 8);}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00103"/>00103 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00112"/><link linkend="_classbsp___mod_bus___tx_1a268c136782f8146662f33878522c270c">00112</link> <emphasis role="comment"></emphasis><emphasis role="keywordtype">void</emphasis> <link linkend="_classbsp___mod_bus___tx_1a268c136782f8146662f33878522c270c">bsp_ModBus_Tx::WriteRegs</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> address,<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> mem,<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link>* var) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00113"/>00113     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> bytes = 9 + mem * 2;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00114"/>00114     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>* dat = (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)malloc(bytes);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00115"/>00115     <emphasis role="keywordflow">if</emphasis> (dat == NULL)<emphasis role="keywordflow">return</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00116"/>00116     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> crc;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00117"/>00117     dat[0] = <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">ID</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00118"/>00118     dat[1] = <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a54562faaab8c1c932c46c6c4cb2552f9">Fun_W_Regs</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00119"/>00119     dat[2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00120"/>00120     dat[3] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00121"/>00121     dat[4] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00122"/>00122     dat[5] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00123"/>00123     dat[6] = mem*2;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00124"/>00124     <emphasis role="comment">//  填入数据</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00125"/>00125     <emphasis role="keywordflow">for</emphasis> (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> i = 0; i < mem; i++){
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00126"/>00126         dat[7 + i*2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)var)[1+i*2];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00127"/>00127         dat[8 + i*2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)var)[0+i*2];}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00128"/>00128     crc = <link linkend="_bsp___c_r_c_8cpp_1abb1fda5ed561362d12fe987758986919">CRC16_MODBUS</link>(dat, bytes - 2);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00129"/>00129     dat[bytes - 2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00130"/>00130     dat[bytes - 1] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00131"/>00131     <link linkend="_classbsp___mod_bus___tx_1ac017f6145ba6f87c69a16510f868dcc2">Transmit</link>(dat, bytes);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00132"/>00132     free(dat);}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00133"/>00133 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00142"/><link linkend="_classbsp___mod_bus___tx_1acc267977d61716e25fd3e3ec57bc2960">00142</link> <emphasis role="comment"></emphasis><emphasis role="keywordtype">void</emphasis> <link linkend="_classbsp___mod_bus___tx_1acc267977d61716e25fd3e3ec57bc2960">bsp_ModBus_Tx::WriteRegsVar</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> address, <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> mem,...) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00143"/>00143     va_list table;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00144"/>00144     va_start(table,mem);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00145"/>00145     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> vars;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00146"/>00146     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> bytes = 9 + mem * 2;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00147"/>00147     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>* dat = (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)malloc(bytes);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00148"/>00148     <emphasis role="keywordflow">if</emphasis> (dat == NULL)<emphasis role="keywordflow">return</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00149"/>00149     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> crc;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00150"/>00150     dat[0] = <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">ID</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00151"/>00151     dat[1] = <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a54562faaab8c1c932c46c6c4cb2552f9">Fun_W_Regs</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00152"/>00152     dat[2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00153"/>00153     dat[3] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00154"/>00154     dat[4] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00155"/>00155     dat[5] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00156"/>00156     dat[6] = mem*2;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00157"/>00157     <emphasis role="comment">//  填入数据</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00158"/>00158     <emphasis role="keywordflow">for</emphasis> (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> i = 0; i < mem; i++){
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00159"/>00159         vars=va_arg(table, <link linkend="_varint_8h_1afaa62991928fb9fb18ff0db62a040aba">u32</link>);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00160"/>00160         dat[7 + i*2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&vars))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00161"/>00161         dat[8 + i*2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&vars))[0];}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00162"/>00162     crc = <link linkend="_bsp___c_r_c_8cpp_1abb1fda5ed561362d12fe987758986919">CRC16_MODBUS</link>(dat, bytes - 2);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00163"/>00163     dat[bytes - 2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00164"/>00164     dat[bytes - 1] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00165"/>00165     <link linkend="_classbsp___mod_bus___tx_1ac017f6145ba6f87c69a16510f868dcc2">Transmit</link>(dat, bytes);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00166"/>00166     free(dat);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00167"/>00167     va_end(table);}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00168"/>00168 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00175"/><link linkend="_classbsp___mod_bus___tx_1abc721f5c61e236df505f3447818be921">00175</link> <emphasis role="comment"></emphasis><emphasis role="keywordtype">void</emphasis> <link linkend="_classbsp___mod_bus___tx_1abc721f5c61e236df505f3447818be921">bsp_ModBus_Tx::ReadOutCoil</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> address, <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> mem) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00176"/>00176     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> dat[8];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00177"/>00177     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> crc;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00178"/>00178     dat[0] = <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">ID</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00179"/>00179     dat[1] = <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643afa0834864982fdb57c9a954bdbd1599b">Fun_R_OutCoil</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00180"/>00180     dat[2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00181"/>00181     dat[3] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00182"/>00182     dat[4] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00183"/>00183     dat[5] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00184"/>00184     crc = <link linkend="_bsp___c_r_c_8cpp_1abb1fda5ed561362d12fe987758986919">CRC16_MODBUS</link>(dat, 6);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00185"/>00185     dat[6] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00186"/>00186     dat[7] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00187"/>00187     <link linkend="_classbsp___mod_bus___tx_1ac017f6145ba6f87c69a16510f868dcc2">Transmit</link>(dat, 8);}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00188"/>00188 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00195"/><link linkend="_classbsp___mod_bus___tx_1a76e712e8d638ecc7b453e1c8afbbad98">00195</link> <emphasis role="comment"></emphasis><emphasis role="keywordtype">void</emphasis> <link linkend="_classbsp___mod_bus___tx_1a76e712e8d638ecc7b453e1c8afbbad98">bsp_ModBus_Tx::ReadInCoil</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> address, <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> mem) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00196"/>00196     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> dat[8];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00197"/>00197     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> crc;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00198"/>00198     dat[0] = <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">ID</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00199"/>00199     dat[1] = <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a8c70d4d5036c1a3f9c51a545d13fdd92">Fun_R_InCoil</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00200"/>00200     dat[2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00201"/>00201     dat[3] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00202"/>00202     dat[4] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00203"/>00203     dat[5] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00204"/>00204     crc = <link linkend="_bsp___c_r_c_8cpp_1abb1fda5ed561362d12fe987758986919">CRC16_MODBUS</link>(dat, 6);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00205"/>00205     dat[6] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00206"/>00206     dat[7] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00207"/>00207     <link linkend="_classbsp___mod_bus___tx_1ac017f6145ba6f87c69a16510f868dcc2">Transmit</link>(dat, 8);}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00208"/>00208 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00217"/><link linkend="_classbsp___mod_bus___tx_1aa8d37cc0cefaad8f41bc1d195a326d95">00217</link> <emphasis role="comment"></emphasis><emphasis role="keywordtype">void</emphasis> <link linkend="_classbsp___mod_bus___tx_1aa8d37cc0cefaad8f41bc1d195a326d95">bsp_ModBus_Tx::WriteOneCoil</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> address, <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> state){
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00218"/>00218     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> dat[8];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00219"/>00219     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> var = state ? 0xFF00 : 0x0000;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00220"/>00220     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> crc;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00221"/>00221     dat[0] = <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">ID</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00222"/>00222     dat[1] = <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a95bb48bd2de82de8a2f5684a6cccff0f">Fun_W_OneCoil</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00223"/>00223     dat[2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00224"/>00224     dat[3] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00225"/>00225     dat[4] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&var))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00226"/>00226     dat[5] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&var))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00227"/>00227     crc = <link linkend="_bsp___c_r_c_8cpp_1abb1fda5ed561362d12fe987758986919">CRC16_MODBUS</link>(dat, 6);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00228"/>00228     dat[6] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00229"/>00229     dat[7] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00230"/>00230     <link linkend="_classbsp___mod_bus___tx_1ac017f6145ba6f87c69a16510f868dcc2">Transmit</link>(dat, 8);}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00231"/>00231 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00240"/><link linkend="_classbsp___mod_bus___tx_1a630ac7566fe9d1773baa813802202d0f">00240</link> <emphasis role="comment"></emphasis><emphasis role="keywordtype">void</emphasis> <link linkend="_classbsp___mod_bus___tx_1a630ac7566fe9d1773baa813802202d0f">bsp_ModBus_Tx::WriteCoils</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> address, <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> mem, <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>* var) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00241"/>00241     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> bytes = (mem / 8) + (mem % 8 != 0) + 9;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00242"/>00242     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>* dat = (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)malloc(bytes);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00243"/>00243     <emphasis role="keywordflow">if</emphasis> (dat == NULL)<emphasis role="keywordflow">return</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00244"/>00244     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> crc;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00245"/>00245     dat[0] = <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">ID</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00246"/>00246     dat[1] = <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a0a40a9622af4e5cb7daecbdb303ee35e">Fun_W_Coils</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00247"/>00247     dat[2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00248"/>00248     dat[3] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00249"/>00249     dat[4] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00250"/>00250     dat[5] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00251"/>00251     dat[6] = bytes - 9;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00252"/>00252     <emphasis role="comment">//  填入数据</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00253"/>00253     <emphasis role="keywordflow">for</emphasis> (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> i = 0; i < bytes - 9; i++)dat[7 + i] = var[i];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00254"/>00254     crc = <link linkend="_bsp___c_r_c_8cpp_1abb1fda5ed561362d12fe987758986919">CRC16_MODBUS</link>(dat, bytes - 2);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00255"/>00255     dat[bytes - 2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00256"/>00256     dat[bytes - 1] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00257"/>00257     <link linkend="_classbsp___mod_bus___tx_1ac017f6145ba6f87c69a16510f868dcc2">Transmit</link>(dat, bytes);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00258"/>00258     free(dat);}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00259"/>00259 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00268"/><link linkend="_classbsp___mod_bus___tx_1a280c5d7c99196a11b5fee7b34421a8ff">00268</link> <emphasis role="comment"></emphasis><emphasis role="keywordtype">void</emphasis> <link linkend="_classbsp___mod_bus___tx_1a280c5d7c99196a11b5fee7b34421a8ff">bsp_ModBus_Tx::WriteCoilsVar</link>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> address, <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> mem,...) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00269"/>00269     va_list table;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00270"/>00270     va_start(table,mem);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00271"/>00271     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> var=0;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00272"/>00272     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> crc;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00273"/>00273     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> bytes = (mem / 8) + (mem % 8 != 0) + 9;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00274"/>00274     <link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>* dat = (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)malloc(bytes);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00275"/>00275     <emphasis role="keywordflow">if</emphasis> (dat == NULL)<emphasis role="keywordflow">return</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00276"/>00276     dat[0] = <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">ID</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00277"/>00277     dat[1] = <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a0a40a9622af4e5cb7daecbdb303ee35e">Fun_W_Coils</link>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00278"/>00278     dat[2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00279"/>00279     dat[3] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&address))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00280"/>00280     dat[4] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00281"/>00281     dat[5] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&mem))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00282"/>00282     dat[6] = bytes - 9;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00283"/>00283     <emphasis role="comment">//  填入管脚信息</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00284"/>00284     <emphasis role="keywordflow">for</emphasis>(<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> i=0;i<mem;i++){
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00285"/>00285         var=va_arg(table,<link linkend="_varint_8h_1afaa62991928fb9fb18ff0db62a040aba">u32</link>);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00286"/>00286         <emphasis role="keywordflow">if</emphasis>(var)
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00287"/>00287             dat[7 + (i/8)]|=1<<(i%8);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00288"/>00288         <emphasis role="keywordflow">else</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00289"/>00289             dat[7 + (i/8)]&=~(1<<(i%8));}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00290"/>00290     crc = <link linkend="_bsp___c_r_c_8cpp_1abb1fda5ed561362d12fe987758986919">CRC16_MODBUS</link>(dat, bytes - 2);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00291"/>00291     dat[bytes - 2] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00292"/>00292     dat[bytes - 1] = ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00293"/>00293     <link linkend="_classbsp___mod_bus___tx_1ac017f6145ba6f87c69a16510f868dcc2">Transmit</link>(dat, bytes);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00294"/>00294     free(dat);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00295"/>00295     va_end(table);}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00297"/>00297 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00298"/>00298 <emphasis role="comment">//  类函数</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00304"/><link linkend="_classbsp___mod_bus___rx_1a39330845d4ced51850b9edaaab052e0f">00304</link> <emphasis role="comment"></emphasis><emphasis role="keywordtype">void</emphasis> <link linkend="_classbsp___mod_bus___rx_1a39330845d4ced51850b9edaaab052e0f">bsp_ModBus_Rx::analysis</link>(<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>* dat) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00305"/>00305     <link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link> crc = 0;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00306"/>00306     <link linkend="_classbsp___mod_bus___rx_1a045cc9c5f9d26ad5be1da2d2cfdcbefc">ID</link> = dat[0];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00307"/>00307     <link linkend="_classbsp___mod_bus___rx_1a0a5cdc492b09b33ae665706c9968e5d5">Func</link> = dat[1];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00308"/>00308     <emphasis role="comment">//  释放缓存内存</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00309"/>00309     free(<link linkend="_classbsp___mod_bus___rx_1a6612d15d148b4944662851bd8fabae04">OutCoilDat</link>);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00310"/>00310     free(<link linkend="_classbsp___mod_bus___rx_1a8ca97f2e7b033faddbb1772f15d91d4d">InCoilDat</link>);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00311"/>00311     free(<link linkend="_classbsp___mod_bus___rx_1a091cc0733eb4aa6b06c10afdbfd46b7f">KeepRegDat</link>);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00312"/>00312     free(<link linkend="_classbsp___mod_bus___rx_1ab275dbfa83dd90eff0cbf0411dfe8e4a">InRegDat</link>);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00313"/>00313     <emphasis role="comment">//  CRC检验</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00314"/>00314     <emphasis role="keywordflow">if</emphasis> (<link linkend="_classbsp___mod_bus___rx_1a0a5cdc492b09b33ae665706c9968e5d5">Func</link> == <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643afa0834864982fdb57c9a954bdbd1599b">Fun_R_OutCoil</link> ||
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00315"/>00315         <link linkend="_classbsp___mod_bus___rx_1a0a5cdc492b09b33ae665706c9968e5d5">Func</link> == <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a8c70d4d5036c1a3f9c51a545d13fdd92">Fun_R_InCoil</link> ||
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00316"/>00316         <link linkend="_classbsp___mod_bus___rx_1a0a5cdc492b09b33ae665706c9968e5d5">Func</link> == <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a9ec5f1febebcade07d80148f67d51594">Fun_R_KeepReg</link> ||
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00317"/>00317         <link linkend="_classbsp___mod_bus___rx_1a0a5cdc492b09b33ae665706c9968e5d5">Func</link> == <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643ab285b7d7c40fa9a85adba60a3a769fca">Fun_R_InReg</link>) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00318"/>00318         crc = <link linkend="_bsp___c_r_c_8cpp_1abb1fda5ed561362d12fe987758986919">CRC16_MODBUS</link>(dat, dat[2] + 3);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00319"/>00319         <link linkend="_classbsp___mod_bus___rx_1ac1a35ae91223298913373de0d3e7c02d">crcts</link> = (   ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[1] == dat[dat[2] + 3] &&
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00320"/>00320                     ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)(&crc))[0] == dat[dat[2] + 4]);}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00321"/>00321     <emphasis role="keywordflow">switch</emphasis> (<link linkend="_classbsp___mod_bus___rx_1a0a5cdc492b09b33ae665706c9968e5d5">Func</link>) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00322"/>00322         <emphasis role="keywordflow">case</emphasis> <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643afa0834864982fdb57c9a954bdbd1599b">Fun_R_OutCoil</link>:
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00323"/>00323             <emphasis role="comment">//  输出线圈</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00324"/>00324             <link linkend="_classbsp___mod_bus___rx_1a062f82edfe722d8cb783b67a5a085bee">OutCoilMem</link> = dat[2];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00325"/>00325             <link linkend="_classbsp___mod_bus___rx_1a6612d15d148b4944662851bd8fabae04">OutCoilDat</link> = (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)malloc(<link linkend="_classbsp___mod_bus___rx_1a062f82edfe722d8cb783b67a5a085bee">OutCoilMem</link>);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00326"/>00326             <emphasis role="keywordflow">if</emphasis> (<link linkend="_classbsp___mod_bus___rx_1a6612d15d148b4944662851bd8fabae04">OutCoilDat</link> == NULL)<emphasis role="keywordflow">break</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00327"/>00327             <emphasis role="keywordflow">for</emphasis> (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> i = 0; i < <link linkend="_classbsp___mod_bus___rx_1a062f82edfe722d8cb783b67a5a085bee">OutCoilMem</link>; i++)
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00328"/>00328                 <link linkend="_classbsp___mod_bus___rx_1a6612d15d148b4944662851bd8fabae04">OutCoilDat</link>[i] = dat[3 + i];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00329"/>00329             <emphasis role="keywordflow">break</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00330"/>00330         <emphasis role="keywordflow">case</emphasis> <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a8c70d4d5036c1a3f9c51a545d13fdd92">Fun_R_InCoil</link>:
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00331"/>00331             <emphasis role="comment">//  输入线圈</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00332"/>00332             <link linkend="_classbsp___mod_bus___rx_1a22f49f0782c4580b0f582c27fbd758a3">InCoilMem</link> = dat[2];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00333"/>00333             <link linkend="_classbsp___mod_bus___rx_1a8ca97f2e7b033faddbb1772f15d91d4d">InCoilDat</link> = (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)malloc(<link linkend="_classbsp___mod_bus___rx_1a22f49f0782c4580b0f582c27fbd758a3">InCoilMem</link>);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00334"/>00334             <emphasis role="keywordflow">if</emphasis> (<link linkend="_classbsp___mod_bus___rx_1a8ca97f2e7b033faddbb1772f15d91d4d">InCoilDat</link> == NULL)<emphasis role="keywordflow">break</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00335"/>00335             <emphasis role="keywordflow">for</emphasis> (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> i = 0; i < <link linkend="_classbsp___mod_bus___rx_1a22f49f0782c4580b0f582c27fbd758a3">InCoilMem</link>; i++)
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00336"/>00336                 <link linkend="_classbsp___mod_bus___rx_1a8ca97f2e7b033faddbb1772f15d91d4d">InCoilDat</link>[i] = dat[3 + i];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00337"/>00337             <emphasis role="keywordflow">break</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00338"/>00338         <emphasis role="keywordflow">case</emphasis> <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643a9ec5f1febebcade07d80148f67d51594">Fun_R_KeepReg</link>:
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00339"/>00339             <emphasis role="comment">//  保持寄存器</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00340"/>00340             <link linkend="_classbsp___mod_bus___rx_1a7622d0c8c56feb97d263f57115ef3f6a">KeepRegMem</link> = dat[2] / 2;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00341"/>00341             <link linkend="_classbsp___mod_bus___rx_1a091cc0733eb4aa6b06c10afdbfd46b7f">KeepRegDat</link> = (<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link>*)malloc(<link linkend="_classbsp___mod_bus___rx_1a7622d0c8c56feb97d263f57115ef3f6a">KeepRegMem</link> * 2);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00342"/>00342             <emphasis role="keywordflow">if</emphasis> (<link linkend="_classbsp___mod_bus___rx_1a091cc0733eb4aa6b06c10afdbfd46b7f">KeepRegDat</link> == NULL)<emphasis role="keywordflow">break</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00343"/>00343             <emphasis role="keywordflow">for</emphasis> (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> i = 0; i < <link linkend="_classbsp___mod_bus___rx_1a7622d0c8c56feb97d263f57115ef3f6a">KeepRegMem</link>; i++) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00344"/>00344                 ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)<link linkend="_classbsp___mod_bus___rx_1a091cc0733eb4aa6b06c10afdbfd46b7f">KeepRegDat</link>)[1 + i * 2] = dat[3 + i * 2];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00345"/>00345                 ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)<link linkend="_classbsp___mod_bus___rx_1a091cc0733eb4aa6b06c10afdbfd46b7f">KeepRegDat</link>)[0 + i * 2] = dat[4 + i * 2];}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00346"/>00346                 <emphasis role="keywordflow">break</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00347"/>00347         <emphasis role="keywordflow">case</emphasis> <link linkend="_bsp___mod_bus_8h_1ac6d9f6c262df700be9045045502e7643ab285b7d7c40fa9a85adba60a3a769fca">Fun_R_InReg</link>:
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00348"/>00348             <emphasis role="comment">//  输入寄存器</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00349"/>00349             <link linkend="_classbsp___mod_bus___rx_1a37508047d184916eb7133a4ad8f10a6c">InRegMem</link> = dat[2] / 2;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00350"/>00350             <link linkend="_classbsp___mod_bus___rx_1ab275dbfa83dd90eff0cbf0411dfe8e4a">InRegDat</link> = (<link linkend="_varint_8h_1ace9d960e74685e2cd84b36132dbbf8aa">u16</link>*)malloc(<link linkend="_classbsp___mod_bus___rx_1a37508047d184916eb7133a4ad8f10a6c">InRegMem</link> * 2);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00351"/>00351             <emphasis role="keywordflow">if</emphasis> (<link linkend="_classbsp___mod_bus___rx_1ab275dbfa83dd90eff0cbf0411dfe8e4a">InRegDat</link> == NULL)<emphasis role="keywordflow">break</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00352"/>00352             <emphasis role="keywordflow">for</emphasis> (<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> i = 0; i < <link linkend="_classbsp___mod_bus___rx_1a37508047d184916eb7133a4ad8f10a6c">InRegMem</link>; i++) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00353"/>00353                 ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)<link linkend="_classbsp___mod_bus___rx_1ab275dbfa83dd90eff0cbf0411dfe8e4a">InRegDat</link>)[1 + i * 2] = dat[3 + i * 2];
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00354"/>00354                 ((<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link>*)<link linkend="_classbsp___mod_bus___rx_1ab275dbfa83dd90eff0cbf0411dfe8e4a">InRegDat</link>)[0 + i * 2] = dat[4 + i * 2];}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00355"/>00355             <emphasis role="keywordflow">break</emphasis>;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00356"/>00356         <emphasis role="keywordflow">default</emphasis>:
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00357"/>00357             <emphasis role="comment">//  写回显与其他</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00358"/>00358             <emphasis role="keywordflow">break</emphasis>;}}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00360"/>00360 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00361"/>00361 <emphasis role="comment">//  构造函数</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00362"/><link linkend="_classbsp___mod_bus___tx_1ac277122ddb733aa37a0000086d5ae239">00362</link> <link linkend="_classbsp___mod_bus___tx_1ac277122ddb733aa37a0000086d5ae239">bsp_ModBus_Tx::bsp_ModBus_Tx</link>(<link linkend="_varint_8h_1a92c50087ca0e64fa93fc59402c55f8ca">u8</link> ID) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00363"/>00363     <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">bsp_ModBus_Tx::ID</link> = <link linkend="_classbsp___mod_bus___tx_1a4ee454ddd116e2b608d9b35b02eee0e4">ID</link>;}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00364"/>00364 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00365"/><link linkend="_classbsp___mod_bus___rx_1a87e68578770301c3d78c9b7f551bb627">00365</link> <link linkend="_classbsp___mod_bus___rx_1a87e68578770301c3d78c9b7f551bb627">bsp_ModBus_Rx::bsp_ModBus_Rx</link>(<emphasis role="keywordtype">void</emphasis>) {
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00366"/>00366     <link linkend="_classbsp___mod_bus___rx_1a091cc0733eb4aa6b06c10afdbfd46b7f">KeepRegDat</link> = NULL;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00367"/>00367     <link linkend="_classbsp___mod_bus___rx_1ab275dbfa83dd90eff0cbf0411dfe8e4a">InRegDat</link> = NULL;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00368"/>00368     <link linkend="_classbsp___mod_bus___rx_1a6612d15d148b4944662851bd8fabae04">OutCoilDat</link> = NULL;
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00369"/>00369     <link linkend="_classbsp___mod_bus___rx_1a8ca97f2e7b033faddbb1772f15d91d4d">InCoilDat</link> = NULL;}
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00370"/>00370 <emphasis role="comment">//----------------------------------------------------------------------------------------------------</emphasis>
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00371"/><link linkend="_classbsp___mod_bus___rx_1afa1dac97034b51725349ab5b1a2aa909">00371</link> <link linkend="_classbsp___mod_bus___rx_1afa1dac97034b51725349ab5b1a2aa909">bsp_ModBus_Rx::~bsp_ModBus_Rx</link>(<emphasis role="keywordtype">void</emphasis>){
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00372"/>00372     free(<link linkend="_classbsp___mod_bus___rx_1a6612d15d148b4944662851bd8fabae04">OutCoilDat</link>);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00373"/>00373     free(<link linkend="_classbsp___mod_bus___rx_1a8ca97f2e7b033faddbb1772f15d91d4d">InCoilDat</link>);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00374"/>00374     free(<link linkend="_classbsp___mod_bus___rx_1a091cc0733eb4aa6b06c10afdbfd46b7f">KeepRegDat</link>);
|
||
|
|
<anchor xml:id="_bsp___mod_bus_8cpp_source_1l00375"/>00375     free(<link linkend="_classbsp___mod_bus___rx_1ab275dbfa83dd90eff0cbf0411dfe8e4a">InRegDat</link>);}
|
||
|
|
</programlisting></section>
|