main.c

来自「build a modbus client/server for use on 」· C语言 代码 · 共 72 行

C
72
字号
/*******************************************************************************

                                   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 + =
减小字号Ctrl + -
显示快捷键?