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

📄 hartapi.h

📁 HART协议编程例程
💻 H
字号:
/**********************************************************************
 * Copyright (c) 1998 - 2000 by Borst Automation, Fachingen
 * All rights reserved
 *
 * Filename:  HartApi.c
 * Project:   HART Slave
 * Date:      jul-25-00
 * Author(s): W. Borst
 *
 * Revision:
 * Date:      Name:       Version:  Description:
 * Jul-25-00  W. Borst    -----     Initial Draft
 *
 * Description: Hart Hardware Abstraction Layer
 *              This module contains the necessary makro definitions
 *
 **********************************************************************/
#ifndef __hartapi_h__
#define __hartapi_h__

/**********************************************************************
 * Includes                                                           *
 **********************************************************************/
#ifdef __HARTAPI_H__
  #include <string.h>
  #include "..\Common\Types.h"
  #include "..\Common\Hart.h"
  #include "..\Protocol\HartLoL.h"
  #include "..\Api\UserApi.h"
  #include "..\FbHart\FbHart.h"
#endif

#ifdef VC_STUDIO
  //Definitions as in winbase.h
  #define CBR_1200    1200
  #define ODDPARITY      1
  #define ONESTOPBIT     0
  
  //User definitions
  #define MYCOMPORT      1  //Use COM 1
  
  /* Makros for PC simulation goes here */
  #define M_HRT_START_SEND(pBuf,ucLen) WriteToCom( MYCOMPORT, \
                                                   pBuf, \
                                                   ucLen \
                                                 )
  #define M_HRT_PUSH_REGS
  #define M_HRT_POP_REGS
  #define M_HRT_DISABLE_RCV
  #define M_HRT_ENABLE_RCV
  //Change 
  #define M_HRT_INIT_COM OpenComPort( MYCOMPORT, \
                                      CBR_1200, \
                                      8, \
                                      ODDPARITY, \
                                      ONESTOPBIT \
                                    )
  #define M_HRT_TERMINATE CloseComPort(MYCOMPORT)
  #define M_HRT_IS_CARRIER        0
  #define M_HRT_GET_RCV_ERROR     GetRcvErr()
  #define M_HRT_GET_RCV_CHAR      GetRcvChar()
  #define M_HRT_DISABLE_INTERRUPT
  #define M_HRT_ENABLE_INTERRUPT
#else
  /* Makros for the target system goes here */
  #define M_HRT_START_SEND(pBuf,ucLen)
  #define M_HRT_PUSH_REGS
  #define M_HRT_POP_REGS
  #define M_HRT_DISABLE_RCV
  #define M_HRT_ENABLE_RCV
  #define M_HRT_INIT_COM
  #define M_HRT_IS_CARRIER        0
  #define M_HRT_GET_RCV_ERROR     0
  #define M_HRT_GET_RCV_CHAR      0
  #define M_HRT_DISABLE_INTERRUPT
  #define M_HRT_ENABLE_INTERRUPT
#endif

#endif

⌨️ 快捷键说明

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