此帖出自嵌入式系统论坛
最新回复
以下是我測試時間的編程
但我不知道要如何讓時間顯示在LCD上
#include
#include
#include
#include "LCD_Driver.h"
//function protoypes
void Timer0_Init();
//global variable
int min;
int sec;
int main()
{
char str[]="Hello, world!";
int i;
//initialize LCD module
LCD_init();
DDRA = 0xFF; //port A as output
DDRC = 0x7F; //port C as output except PC7
Timer0_Init(); //call the func to initialize the timer
sei();
int_start =1;
LCD_display('Time is %02d:%02d\r', min, sec);//要如何讓時間顯示在LCD上
x = sec;
input = PINC;
while(1)
{
if ( (input&0x80) != (PINC&0x80) )
{
input = PINC;
if (int_start ==1)
{
cli();
int_start = 0;
}
else
{
sei();
int_start = 1;
}
}
if (min!=PORTC)
{
PORTC = min;
}
if (x!=sec)
{
printf("Time is %02d:%02d\r", min, sec);//要如何讓時間顯示在LCD上
x = sec;
}
}
}
}
void Timer0_Init()
{
//set the frequency of timer0
OCR0 = 77;
TCCR0 |= (1
详情
回复
发表于 2007-6-8 00:03
| ||
|
||
此帖出自嵌入式系统论坛
| ||
|
||
EEWorld Datasheet 技术支持