?? 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 taken over from 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^12 /* data direction register: SW 1 */
#define SW_1 P2^12 /* data register: SW 1 */
#define SW_2_DIR DP2^13 /* data direction register: SW 2 */
#define SW_2 P2^13 /* data register: SW 2 */
#define SW_3_DIR DP2^14 /* data direction register: SW 3 */
#define SW_3 P2^14 /* data register: SW 3 */
#define SW_4_DIR DP2^15 /* data direction register: SW 4 */
#define SW_4 P2^15 /* 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 0 Bit 3
* GP: sw_1, sw_2, sw_3, sw_4
*---------------------------------------------------------------------------*/
BYTE dpswtch4_read();
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -