?? stkreg_u.c
字號:
/* File: STKREG.C */
/****************************************************************************
*
* STK16XSW.STKREG
* ===============
*
* Routines for the Acces to the stepper motor and the LCD-Display
*
* TQ-Systems GmbH
* ---------------
* Customer: TQ-Components
* Project : STK16XSW
* Tools : uVision 2.05
*
*
* Rev: Date: Name: Modification:
* ----+---------+----------------+------------------------------------------
* 100 05.02.01 A. Lichte Begin
*****************************************************************************/
/****************************************************************************
*
* availability summary
*
* available for Starterkit: STK16XU
* conformed for Starterkit: STK16XU
* available for Modul : TQM167UL TQM167U TQM167UE
*
* conformed for Modul : TQM167UL TQM167U TQM167UE
*****************************************************************************/
/*==========================================================================*
* pragmas:
*===========================================================================*/
/*=========================================================================*
* include files (#INCLUDE):
*==========================================================================*/
/*-------------------------------------------------------------------------*
* standard include files:
*--------------------------------------------------------------------------*/
#include <stdio.h> /* standard I/O functions */
#include <ctype.h> /* typecast functions */
#include <string.h> /* String functions */
#include <setjmp.h> /* global jump functions */
#include <absacc.h> /* absolute accesss */
#include <intrins.h> /* intrinsic functions */
#include <reg167.h> /* Special function register */
/*-------------------------------------------------------------------------*
* project specific include files:
*--------------------------------------------------------------------------*/
#include "stkreg_u.h" /* Register for Starterkit */
/*=========================================================================*
* modul internal definitions (#DEFINE):
*==========================================================================*/
/*=========================================================================*
* modul internal type definitions(TYPEDEF):
*==========================================================================*/
/*=========================================================================*
* modul internal constants (CONST):
*==========================================================================*/
/*=========================================================================*
* extern available constants (CONST):
*==========================================================================*/
/*=========================================================================*
* modul internal variables:
*==========================================================================*/
// Backgrond Register for the STKREG
BYTE stkreg_sreg;
/*=========================================================================*
* global extern available variables (EXTERN):
*==========================================================================*/
/*=========================================================================*
* modul internal functions:
*==========================================================================*/
/*=========================================================================*
* extern available functions:
*==========================================================================*/
/*-------------------------------------------------------------------------*
* void stkreg_init(void)
*--------------------------------------------------------------------------*
* FT: Initialize databus for CS4
* EP: -
* RW: -
* GP: stkreg_sreg: Backgrond Register for the STKREG
*--------------------------------------------------------------------------*/
void stkreg_init(void)
{
ADDRSEL4 = STKREG_BASEADDR;
BUSCON4 = STKREG_BUSCON;
stkreg_sethigh(0xFF, 0); // Initialize STKREG
}
/*-------------------------------------------------------------------------*
* void stkreg_sethigh(BYTE change, BYTE value)
*--------------------------------------------------------------------------*
* FT: Change Bits of the higher Port of the STKREG
* EP: change: Bitmask: Bits whitch become changed
* value : New value of the changed Bits
* RW: -
* GP: stkreg_sreg: Backgrond Register for the STKREG
*--------------------------------------------------------------------------*/
void stkreg_sethigh(BYTE change, BYTE value)
{
IEN=0; // Access could also happend from an interrupt. This could cause problems
stkreg_sreg=((stkreg_sreg&(~change))|(value&change));
IEN=1;
MVAR(BYTE, STKREG_CTRL_ADDR)=stkreg_sreg;
}
/*-------------------------------------------------------------------------*
* void stkreg_writelow(BYTE value)
*--------------------------------------------------------------------------*
* FT: Set the Lowbyte of the STKREG
* EP: value : New value of the Lowbyte of the STKREG
* RW: -
* GP: -
*--------------------------------------------------------------------------*/
void stkreg_writelow(BYTE value)
{
stkreg_sethigh(LCD_R_W,0); // SET Latch to Output
MVAR(BYTE, STKREG_DATA_ADDR)=value;
}
/*-------------------------------------------------------------------------*
* BYTE stkreg_readlow(void)
*--------------------------------------------------------------------------*
* FT: Read the Lowbyte of the STKREG
* EP: value : New value of the Lowbyte of the STKREG
* RW: -
* GP: -
*--------------------------------------------------------------------------*/
BYTE stkreg_readlow(void)
{
stkreg_sethigh(LCD_R_W,LCD_R_W); // SET Latch to Input
return MVAR(BYTE, STKREG_DATA_ADDR);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -