📄 dpswtch1.c
字号:
/* File: DPSWTCH1.C */
/****************************************************************************
*
* 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
*****************************************************************************/
/****************************************************************************
*
* Einsatz黚ersicht
*
* Verf黦bar f黵 Starterkit: STK16X
* Angepasst f黵 Starterkit: STK16X
* Verf黦bar f黵 Modul : TQM165 TQM165U TQM166 TQM167
* TQM167LC TQM167U TQM167UE
* Angepasst f黵 Modul : TQM165 TQM165U TQM166 TQM167
* TQM167LC TQM167U TQM167UE
*****************************************************************************/
/*==========================================================================*
* include files (#INCLUDE):
*===========================================================================*/
/*--------------------------------------------------------------------------*
* standard include files:
*---------------------------------------------------------------------------*/
#include <reg167.h> /* special function register */
/*--------------------------------------------------------------------------*
* project specific include files:
*---------------------------------------------------------------------------*/
#include "dpswtch1.h" /* DIP switch functions */
/*==========================================================================*
* module internal definitions (#DEFINE):
*===========================================================================*/
/*==========================================================================*
* module internal type declarations (TYPEDEF):
*===========================================================================*/
/*==========================================================================*
* module internal constants (CONST):
*===========================================================================*/
/*==========================================================================*
* extern available constants (CONST):
*===========================================================================*/
/*==========================================================================*
* modul internal variables:
*===========================================================================*/
/*--------------------------------------------------------------------------*
* SWITCH control lines:
*---------------------------------------------------------------------------*/
sbit sw_1 = SW_1;
sbit sw_1_dir = SW_1_DIR;
/*==========================================================================*
* globale external available variables (EXTERN):
*===========================================================================*/
/*==========================================================================*
* modul internal functions:
*===========================================================================*/
/*--------------------------------------------------------------------------*
* void dpswtch4_init()
*---------------------------------------------------------------------------*
* FT: init port 2 for reading DIP switch
* EP: -
* RW: -
* GP: SW_DIR_IN, sw_1_dir,
*---------------------------------------------------------------------------*/
void dpswtch4_init()
{
/* set port pins as inputs for reading DIP switch: */
sw_1_dir = SW_DIR_IN;
}
/*--------------------------------------------------------------------------*
* BYTE dpswtch4_read()
*---------------------------------------------------------------------------*
* FT: read state of DIP switch
* EP: -
* RW: state of DIP switch: SWITCH 1 = Bit 0
* GP: sw_1
*---------------------------------------------------------------------------*/
BYTE dpswtch4_read()
{ BYTE state;
state = 0x00 | sw_1; /* save state of SWITCH 1 */
return(state);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -