📄 dpswtch4.h
字号:
/* File: DPSWTCH4.H */
/****************************************************************************
*
* STK16X.DPSWTCH4
* ===============
*
* Low level routines for reading DIP switch state (digital input)
*
* TQ-Systems GmbH
* ----------------
* Customer: TQ-Components
* Project : STK16XSW
* Tools : uVision 2.05
*
* Rev: Date: Name: Modification:
* ----+---------+----------------+------------------------------------------
* 100 19.01.01 A. Lichte 躡ernommen von STK16X.506
*****************************************************************************/
#include "header.h"
/*==========================================================================*
* extern available definitions (#DEFINE):
*===========================================================================*/
/*--------------------------------------------------------------------------*
* DIP switch port:
*---------------------------------------------------------------------------*/
#define SW_DIR_IN 0 /* data direction register value: input */
#define SW_1_DIR DP2^0 /* data direction register: SW 1 */
#define SW_1 P2^0 /* data register: SW 1 */
#define SW_2_DIR DP2^1 /* data direction register: SW 2 */
#define SW_2 P2^1 /* data register: SW 2 */
#define SW_3_DIR DP2^2 /* data direction register: SW 3 */
#define SW_3 P2^2 /* data register: SW 3 */
#define SW_4_DIR DP2^3 /* data direction register: SW 4 */
#define SW_4 P2^3 /* data register: SW 4 */
/*--------------------------------------------------------------------------*
* state of SWITCH:
*---------------------------------------------------------------------------*/
#define SW_ON 1 /* state of SWITCH: on */
#define SW_OFF (!SW_ON) /* state of SWITCH: off */
/*==========================================================================*
* extern available type definitions (TYPEDEF):
*===========================================================================*/
/*==========================================================================*
* extern available constants (CONST):
*===========================================================================*/
/*==========================================================================*
* globale extern available variables (EXTERN):
*===========================================================================*/
/*==========================================================================*
* extern available functions:
*===========================================================================*/
/*--------------------------------------------------------------------------*
* void dpswtch4_init()
*---------------------------------------------------------------------------*
* FT: init port 2 for reading DIP switch
* EP: -
* RW: -
* GP: SW_DIR_IN, sw_1_dir, sw_2_dir, sw_3_dir ,sw_4_dir
*---------------------------------------------------------------------------*/
void dpswtch4_init();
/*--------------------------------------------------------------------------*
* BYTE dpswtch4_read()
*---------------------------------------------------------------------------*
* FT: read state of DIP switch
* EP: -
* RW: state of DIP switch: SWITCH 1 = Bit 0
* SWITCH 2 = Bit 1
* SWITCH 3 = Bit 2
* SWITCH 4 = Bit 3
* GP: sw_1, sw_2, sw_3, sw_4
*---------------------------------------------------------------------------*/
BYTE dpswtch4_read();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -