📄 dpswtch8.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
* 100 16.05.03 Volker Jung changes for XC16x Controller
* 251 29.07.03 Volker Jung Anpassung an TQ_Select
*****************************************************************************/
#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 */
#define SW_5_DIR DP2^8 /* data direction register: SW 5 */
#define SW_5 P2^8 /* data register: SW 5 */
#define SW_6_DIR DP2^9 /* data direction register: SW 6 */
#define SW_6 P2^9 /* data register: SW 6 */
#define SW_7_DIR DP2^10 /* data direction register: SW 7 */
#define SW_7 P2^10 /* data register: SW 7 */
#define SW_8_DIR DP2^11 /* data direction register: SW 8 */
#define SW_8 P2^11 /* data register: SW 8 */
/*--------------------------------------------------------------------------*
* 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
* SWITCH 5 = Bit 4
* SWITCH 6 = Bit 5
* SWITCH 7 = Bit 6
* SWITCH 8 = Bit 7
* GP: sw_1, sw_2, sw_3, sw_4, sw_5, sw_6, sw_7, sw_8
*---------------------------------------------------------------------------*/
BYTE dpswtch4_read();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -