⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 modbus 源代码,RS485 通信,实现PC与RTU通信
💻 C
字号:
/*******************************************************************************

                                   Main.c

********************************************************************************

   Written by:   Bennie de Wet

   nSoft Developement.

********************************************************************************

 Version

  0.00aA  12 Aug 04 BDW  Cleaning up
  0.00aB  12 Aug 04 BDW  Adding support for PCP serial port
  0.00aB  14 Aug 04 BDW  Pathcing in data handeling
  0.00aD  15 Sep 04 BDW  Making build compatible with new Protocessors
  0.00aE  08 Oct 04 PKD  Changed comment for serial 1 and serial 2

*******************************************************************************/

#if defined ( P18F6720 )
   #include <p18f6720.h>
#elif defined (P18F6520)
   #include <p18f6520.h>
#else
   #error must defined P18F6X20 compiler option
#endif


#include <string.h>
#include <fst.h>
#include <sioapi.h>
#include <led.h>
#include <timer.h>
#include <daapi.h>

#include "ProtoMod.h"

VOID main ()
{
   led_init ( ) ;
   init_timer ( ) ;

   //-----------------------------------
   // Serial 1 is for the PCP on ProtoCessor socket
   sioapi_init   ( P6720SER1 ) ;
   sioapi_enable ( P6720SER1 ) ;

   //-----------------------------------
   // Serial 2 is for the MSTP on RS485
   sioapi_init   ( P6720SER2 ) ;
   sioapi_enable ( P6720SER2 ) ;

   //-----------------------------------
   // Default baudrates
   sioapi_setport ( P6720SER1, 9600, 0, 8 ,1 ) ;
   sioapi_setport ( P6720SER2, 9600, 0, 8 ,1 ) ;


   while ( 1 )
      {

      led_run ( ) ;

      // Idle the different drivers here
      idle_modbus( );

      }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -