⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 number.h

📁 EP9315开机启动画面
💻 H
字号:
/*
 * $Id: number.h,v 1.2 2003/08/29 03:03:31 dyn Exp $
 *
 * number.h : number-tube driver
 *
 * Copyright (C) 2003 ynding ( haoanian@263.net )
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#ifndef _NUMBER_H
#define _NUMBER_H

#define PBDR	*(unsigned char*)0x80000001	/* PORT B data register */
#define PBDDR	*(unsigned char*)0x80000041	/* PORT B data direction register */
#define LED1CS  *(unsigned int *)0x42000000
#define LED2CS  *(unsigned int *)0x44000000
#define LED3CS  *(unsigned int *)0x46000000
#define LED4CS  *(unsigned int *)0x48000000


/*for the ith number*/
#define NUMBER1 1
#define NUMBER2 2
#define NUMBER3 3
#define NUMBER4 4

/* define each bit of PB port */
#define PB0	(1<<0)
#define PB1	(1<<1)
#define PB2	(1<<2)
#define PB3	(1<<3)
#define PB4	(1<<4)
#define PB5	(1<<5)
#define PB6	(1<<6)
#define PB7	(1<<7)

/* define each segment of the number-tube */
#define a	PB3
#define b	PB1
#define c	PB0
#define d	PB2
#define e	PB5
#define f	PB6
#define g	PB4
#define dp  PB7

/* define numbers from 0 to f */
#define num_0	( a | c | d | e | f | g )
#define num_1	( e | f )
#define num_2	( b | c | d | f | g )
#define num_3	( b | d | e | f | g )
#define num_4	( a | b | e | f )
#define num_5	( a | b | d | e | g )
#define num_6	( a | b | c | d | e | g )
#define num_7	( e | f | g )
#define num_8	( a | b | c | d | e | f | g )
#define num_9	( a | b | d | e | f | g )
#define num_a	( a | b | c | e | f | g )
#define num_b	( a | b | c | d | e )
#define num_c	( a | c | d | g )
#define num_d	( b | c | d | e | f )
#define num_e	( a | b | c | d | g )
#define num_f	( a | b | c | g )
#define point   (dp)


void number(int i,int num);	/* show number on the ith number-tube */
void number_on(int i);/* turn on the ithnumber-tube */
void number_off(int i);	/* close the ith number-tube */
void sendcs(int i);/*make the ith number cs active*/
void num_show(void);	/* show numbers in turn */
void init_num(void);

#endif  /* _NUMBER_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -