?? number.c
字號:
/*
* $Id: number.c,v 1.2 2003/08/29 03:03:31 dyn Exp $
*
* number.c : keyboard 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
*
*/
#include "number.h"
static unsigned char numbers[17] = {
num_0, num_1, num_2, num_3,
num_4, num_5, num_6, num_7,
num_8, num_9, num_a, num_b,
num_c, num_d, num_e, num_f,
point
};
/* show number on the ith number-tube ,num 17 as point*/
void number(int i,int num)
{
PBDDR = 0xff;
PBDR = 0xff;
sendcs(i);
PBDR = numbers[num];
sendcs(i);
return;
}
/*make the ith number cs active*/
void sendcs(int i)
{
if(i == NUMBER1)
LED1CS = 0x00;
else if(i == NUMBER2)
LED2CS = 0x00;
else if(i == NUMBER3)
LED3CS = 0x00;
else if(i ==NUMBER4)
LED4CS = 0x00;
}
/* turn on the ithnumber-tube */
void number_on(int i)
{
PBDDR = 0xff;
PBDR = 0xff;
sendcs(i);
return;
}
/* close the ithnumber-tube */
void number_off(int i)
{
PBDDR = 0xff;
PBDR = 0x00;
sendcs(i);
return;
}
/* show numbers in turn */
void num_show(void)
{
int i,j;
for(j=1;j<=4;j++){
for ( i=0;i<17;++i ) {
number(j,i);
wait(1000);
}
}
return;
}
void init_num(void)
{
int i;
PBDDR = 0xff; //set PB port output
/* for(i=1;i<=4;i++){
number_on(i);
wait(1000);
}*/
for(i=1;i<=4;i++){
number_off(i);
wait(1000);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -