📄 r591io.h
字号:
/*======================================================================*/
/* NAME: r591io.h */
/* INFO: In/Out module for the PHYTEC training board equipped with */
/* PHYTEC phyCORE 591 and Philips P8x591 Microcontroller */
/* RIGHTS: Embedded Systems Academy www.esacademy.com */
/*----------------------------------------------------------------------*/
/* DETAILS: LED D1 can be dimmed using set_brightness_d1 - this only */
/* works after the call of init_timer0_dim_d1. Timer 0 is used */
/* to create a PWM signal to D1 */
/*----------------------------------------------------------------------*/
/* HISTORY: V1.0 Pf 21-FEB-2000 */
/* V1.1 Pf 16-JUN-2000 */
/*======================================================================*/
#include "reg591ex.h"
/*======================================================================*/
/* GLOBAL VAR: timer1tick */
/* DESCRIPTION:gets incremented with each occurance of the timer 1 */
/* interrupt set by function init_timer1 */
/*======================================================================*/
extern WORD timer1tick;
/*======================================================================*/
/* FUNCTION: check_button */
/* DESCRIPTION:Reading the status of push button S1 or S2 */
/* INPUT: Sx: 1 or 2 for reading button S1 or S2 */
/* OUTPUT: 0, if button SX is not pushed down */
/* 0xFF, if button is pushed down */
/*======================================================================*/
BYTE check_button (BYTE Sx);
/*======================================================================*/
/* FUNCTION: read_dip_switches */
/* DESCRIPTION:Read the settings of the 8 DIP switches S5 */
/* INPUT: none */
/* OUTPUT: Current value of the DIP switches S5 */
/*======================================================================*/
BYTE read_dip_switches (void);
/*======================================================================*/
/* FUNCTION: read_poti */
/* DESCRIPTION:Read an analog input value at P1.2 - Potentiometer */
/* CAUTION: Starts a A/D conversion and WAITS until it is completed */
/* INPUT: none */
/* OUTPUT: Current value of the DIP switches S5 */
/*======================================================================*/
BYTE read_poti (void);
/*======================================================================*/
/* FUNCTION: switch_leds */
/* DESCRIPTION:Switches LED D1 and D2 on or off */
/* INPUT: on_off: 0 switches both LEDs off, */
/* 1 switches LED D1 on, D2 off */
/* 2 switches LED D1 off, D2 on */
/* 3 switches both LEDs on */
/* OUTPUT: none */
/*======================================================================*/
void switch_leds (BYTE on_off);
/*======================================================================*/
/* FUNCTION: init_timer1 */
/* DESCRIPTION:Initializes timer 1 in mode 3 */
/* Increments the global variable timer1tick with each */
/* occurance of the timer 1 interrupt */
/* CAUTION: EA needs to be set to 1 manually after this function is */
/* called to globally enable ALL interrupts */
/* INPUT: reload: the 16-bit reload value for the time */
/*----------------------------------------------------------------------*/
/* To get specific reload values calculated (for example to achieve a */
/* 5ms interrupt), use the Microcontroller Peripheral Timing Calculator */
/* provided by the Embedded Systems Academy at */
/* www.esacademy.com/faq/calc/philips.htm */
/*----------------------------------------------------------------------*/
/* OUTPUT: none */
/*======================================================================*/
void init_timer1 (WORD reload);
/*======================================================================*/
/* FUNCTION: init_timer0_dim_d1 */
/* DESCRIPTION:Initializes timer 0 which is used to dim D1 */
/* Needs to be called before set_brightness_d1 can be used */
/* CAUTION: EA needs to be set to 1 manually after this function is */
/* called to globally enable ALL interrupts */
/* INPUT: none */
/* OUTPUT: none */
/*======================================================================*/
void init_timer0_dim_d1 (void);
/*======================================================================*/
/* FUNCTION: set_brightness_d1 */
/* DESCRIPTION:Sets the brightness of LED D1 */
/* CAUTION: init_timer0_dim_d1 needs to be called before this */
/* function can work */
/* INPUT: 0-100, a value of 100 or higher makes LED D1 brightest */
/* OUTPUT: none */
/*======================================================================*/
void set_brightness_d1 (BYTE value);
/*======================================================================*/
/* FUNCTION: error_state */
/* DESCRIPTION:If a program discovers a fatal error, this routine can */
/* be used to display an error code to the user. */
/* THIS FUNCTION NEVER RETURNS! ONLY A RESET WILL RECOVER */
/* THE BOARD!
/* INPUT: Error value to be displayed on both LEDs as a blinking */
/* pattern. Only values from 1-12 can be "reasonably" */
/* recognized by counting the "blinks" */
/* OUTPUT: none */
/*======================================================================*/
void error_state (BYTE error);
/*----------------------- END OF FILE ----------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -