<p><a name="_Toc169166210"><span style="COLOR: windowtext; mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman; mso-bidi-font-weight: normal;">三、</span></a><span style="COLOR: windowtext; mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman; mso-bookmark: _Toc169166210;">不同模式下的参数配置方法和通讯示例</span><span lang="EN-US" style="COLOR: windowtext;"><p>
</p></span></p><p style="TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt;"><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">本节介绍</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">设备与</span><span lang="EN-US">PC</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">之间或</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">设备之间都在同一个以太网络环境下的参数配置和通讯示例。在不同的网络内或者需要通过</span><span lang="EN-US">Internet</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">访问,在后面的章节介绍。</span></p><p style="TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt;"><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">在各种组网方案中,首先都需要</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块能够在网络内正常工作:如物理网络连接正确、</span><span lang="EN-US">MAC</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址、本机</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址、子网掩码配置正确。下面首先介绍与几种组网方式无关的和让</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块在网络内自身能正常工作的基本参数配置。</span></p><p align="center" style="TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt;"><span lang="EN-US" style="mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA;"><shapetype id="_x0000_t75" coordsize="21600,21600" ospt="75" opreferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path oextrusionok="f" gradientshapeok="t" oconnecttype="rect"></path><lock vext="edit" aspectratio="t"></lock></shapetype><shape id="_x0000_i1025" oole="" type="#_x0000_t75" style="WIDTH: 185.25pt; HEIGHT: 41.25pt;"><imagedata otitle="" src="file:///C:/DOCUME~1/李强/LOCALS~1/Temp/msoclip1/13/clip_image001.png"></imagedata></shape><img height="55" src="file:///D:/work/我的编程/网络信息发布助手/ProductPages/CNS210/CNS2101.jpg" width="247" align="left" vshapes="_x0000_i1025" alt=""/><br/></span></p><p style="MARGIN-LEFT: 21pt;"> </p><p style="MARGIN-LEFT: 21pt;"><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">配置密码:通过网络配置</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块的操作密码,用户可以设置成自己希望的值。</span></p><p style="MARGIN-LEFT: 21pt;"><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">设备名称和设备地址:这</span><span lang="EN-US">2</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">个参数完全不参与</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块的工作,用户可以把名称参数设成不同的字符来区别不同的</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">设备。</span></p><p align="center" style="MARGIN-LEFT: 21pt;"><span lang="EN-US"><span style="mso-tab-count: 1;"> </span><shapetype id="_x0000_t75" coordsize="21600,21600" ospt="75" opreferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path oextrusionok="f" gradientshapeok="t" oconnecttype="rect"></path><lock vext="edit" aspectratio="t"></lock></shapetype><shape id="_x0000_i1025" oole="" type="#_x0000_t75" style="WIDTH: 198pt; HEIGHT: 44.25pt;"><imagedata otitle="" src="file:///C:/DOCUME~1/李强/LOCALS~1/Temp/msoclip1/13/clip_image001.png"></imagedata></shape><img height="59" src="file:///D:/work/我的编程/网络信息发布助手/ProductPages/CNS210/CNS2102.jpg" width="264" align="left" vshapes="_x0000_i1025" alt=""/>
</span></p><p style="MARGIN-LEFT: 21pt;"><span lang="EN-US" style="mso-tab-count: 1;"> </span></p><p style="MARGIN-LEFT: 21pt;"> </p><p style="MARGIN-LEFT: 21pt;"><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">这几个参数是保证</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块能够在网络内正常工作的基本参数,</span><span lang="EN-US">MAC</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址要保证唯一,即不同的</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块必须设置为不同的值;本机</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址为</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块在以太网内的唯一</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址,在同一个以太网内,所有</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">设备与所有</span><span lang="EN-US">PC</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">的</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址不能相同;子网掩码确定</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块所在的网络</span><span lang="EN-US">ID</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">,所以在同一网络内,所有模块的网络</span><span lang="EN-US">ID</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">必须相同,主机</span><span lang="EN-US">ID</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">必须不同。简单的说就是子网掩码字节为</span><span lang="EN-US">255</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">对应的</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">字节在同一个网络内必须一样,子网掩码字节为</span><span lang="EN-US">0</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">对应的</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">字节在同一个网络内必须不一样。如果用户的网络内有</span><span lang="EN-US">DHCP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">服务器</span><span lang="EN-US">(</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">大部分</span><span lang="EN-US">ADSL MODEM</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">、路由器都可以设置成为允许</span><span lang="EN-US">DHCP)</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">,那么用户可以设置本机</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址为</span><span lang="EN-US">0.0.0.0</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">,自动获得</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址参数设为“开”,这样</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">设备就能够自动从网络内分配到</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址,但是</span><span lang="EN-US">DHCP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">分配的</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址有可能经常改变,所以此方法只适用于</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块工作于</span><span lang="EN-US">TCP Client</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">、</span><span lang="EN-US">UDP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">广播或组播等对方不需要知道此模块的</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址的场合,如果模块需要被动接受对方的连接,而</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址又经常变化,那可是一件很麻烦的事情。</span></p><p align="left" style="MARGIN-LEFT: 21pt;"><span lang="EN-US" style="mso-tab-count: 1;"><br/><span lang="EN-US" style="mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA;"><shapetype id="_x0000_t75" coordsize="21600,21600" ospt="75" opreferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path oextrusionok="f" gradientshapeok="t" oconnecttype="rect"></path><lock vext="edit" aspectratio="t"></lock></shapetype><shape id="_x0000_i1025" oole="" type="#_x0000_t75" style="WIDTH: 199.5pt; HEIGHT: 108pt;"><imagedata otitle="" src="file:///C:/DOCUME~1/李强/LOCALS~1/Temp/msoclip1/13/clip_image001.png"></imagedata></shape> <img height="144" src="file:///D:/work/我的编程/网络信息发布助手/ProductPages/CNS210/CNS2103.jpg" width="266" vshapes="_x0000_i1025" alt=""/>
</span><br/><br/></span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">上面几个参数中,</span><span lang="EN-US">I/O</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">口参数配置根据用户需要自行设置,如果没用到</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块的</span><span lang="EN-US">IO</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">口可以不予理睬此参数;维护端口号可以采用默认,也可以修改为用户自定义的端口;网关</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址在跨网访问时才会用到;</span><span lang="EN-US">DNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">服务器</span><span lang="EN-US">IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址、自动获得</span><span lang="EN-US">DNS IP</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">地址参数为需要访问</span><span lang="EN-US">Internet</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">上的动态域名时才会用到;</span><span lang="EN-US">PPPoE</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">的</span><span lang="EN-US">3</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">个参数需要</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块自己拨号接入</span><span lang="EN-US">Internet</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">时才需<br/>要,后面的章节介绍。</span></p><p align="left" style="MARGIN-LEFT: 21pt;"><span lang="EN-US" style="mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA;"><shapetype id="_x0000_t75" coordsize="21600,21600" ospt="75" opreferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path oextrusionok="f" gradientshapeok="t" oconnecttype="rect"></path><lock vext="edit" aspectratio="t"></lock></shapetype><shape id="_x0000_i1025" oole="" type="#_x0000_t75" style="WIDTH: 180pt; HEIGHT: 68.25pt;"><imagedata otitle="" src="file:///C:/DOCUME~1/李强/LOCALS~1/Temp/msoclip1/13/clip_image001.png"></imagedata></shape><img height="91" src="file:///D:/work/我的编程/网络信息发布助手/ProductPages/CNS210/CNS2104.jpg" width="240" vshapes="_x0000_i1025" alt=""/>
</span></p><p><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;"> 上面的几个参数为串口配置参数,用户需要根据自己设备的串口配置决定。</span></p><p><span lang="EN-US" style="mso-tab-count: 1;"> </span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">以上参数配置好后,</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">设备就已经能够在网络内正常工作了,但是如果需要</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">设备能够与</span><span lang="EN-US">PC</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">或者其他的</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">设备通讯传输数据,还需要配置网络模式、目标参数等,下面就介绍在不同的组网方案中如何配置和使用</span><span lang="EN-US">CNS</span><span style="mso-hansi-font-family: Times New Roman; mso-ascii-font-family: Times New Roman;">模块。</span></p> |