8051시계만들기 프로그램식
본 자료는 3페이지 의 미리보기를 제공합니다. 이미지를 클릭하여 주세요.
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
해당 자료는 3페이지 까지만 미리보기를 제공합니다.
3페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

8051시계만들기 프로그램식에 대한 보고서 자료입니다.

본문내용

f [0] & 0xF0) >> 4) * 10) + (rtbuf [0] & 0x0F);
rtc->secs = (((rtbuf [1] & 0x70) >> 4) * 10) + (rtbuf [1] & 0x0F);
rtc->minutes = (((rtbuf [2] & 0x70) >> 4) * 10) + (rtbuf [2] & 0x0F);
rtc->hours = (((rtbuf [3] & 0x30) >> 4) * 10) + (rtbuf [3] & 0x0F);
rtc->day = (rtbuf [4] & 0x07);
rtc->date = (((rtbuf [5] & 0x30) >> 4) * 10) + (rtbuf [5] & 0x0F);
rtc->month = (((rtbuf [6] & 0x10) >> 4) * 10) + (rtbuf [6] & 0x0F);
rtc->year = (((rtbuf [7] & 0xF0) >> 4) * 10) + (rtbuf [7] & 0x0F);
/*------------------------------------------------------------------------
------------------------------------------------------------------------*/
void rtclock_set (
struct rtclock_st *rtc)
{
unsigned char rtbuf [8];
register unsigned char i;
/*-----------------------------------------------
-----------------------------------------------*/
rtbuf [0] = (((rtc->hsecs / 10) & 0x0F) << 4) | (rtc->hsecs % 10);
rtbuf [1] = (((rtc->secs / 10) & 0x07) << 4) | (rtc->secs % 10);
rtbuf [2] = (((rtc->minutes / 10) & 0x07) << 4) | (rtc->minutes % 10);
rtbuf [3] = (((rtc->hours / 10) & 0x03) << 4) | (rtc->hours % 10);
rtbuf [4] = (rtc->day & 7);
rtbuf [5] = (((rtc->date / 10) & 0x03) << 4) | (rtc->date % 10);
rtbuf [6] = (((rtc->month / 10) & 0x01) << 4) | (rtc->month % 10);
rtbuf [7] = (((rtc->year / 10) & 0x0F) << 4) | (rtc->year % 10);
/*-----------------------------------------------
-----------------------------------------------*/
INT_SAVE;
INT_DISABLE;
rtc_reset ();
INT_RESTORE;
/*-----------------------------------------------
-----------------------------------------------*/
INT_SAVE;
INT_DISABLE;
rtc_init ();
for (i = 0; i < 8; i++)
{
rtc_write_byte (rtbuf [i]);
}
INT_RESTORE;
/*-----------------------------------------------
-----------------------------------------------*/
INT_SAVE;
INT_DISABLE;
rtc_reset ();
INT_RESTORE;
}
/*------------------------------------------------------------------------
------------------------------------------------------------------------*/
Rtclock.h Source
/*------------------------------------------------------------------------
RTCLOCK.C
real-time clock routines.
------------------------------------------------------------------------*/
/*------------------------------------------------
RTCLOCK.C
Routines to start, stop, read, and write the
internal real-time clock.
------------------------------------------------*/
struct rtclock_st
{
unsigned char hsecs; /* hundredths of seconds (00-99) */
unsigned char secs; /* seconds (00-59) */
unsigned char minutes; /* minutes (00-59) */
unsigned char hours; /* hours (00-23) */
unsigned char day; /* day of week (0-7) */
unsigned char date; /* date (00-31) */
unsigned char month; /* month (00-12) */
unsigned char year; /* year (00-99) */
};
extern code char *day_of_week [];
unsigned char rtc_read_byte (void);
void rtc_write_byte (
unsigned char val);
void rtclock_initialize (void);
void rtclock_stop (void);
void rtclock_get (
struct rtclock_st *rtc);
void rtclock_set (
struct rtclock_st *rtc);

키워드

8051,   전화회로,   시계,   프로그램,   keil,   c,   compiler
  • 가격2,000
  • 페이지수11페이지
  • 등록일2004.06.24
  • 저작시기2004.06
  • 파일형식한글(hwp)
  • 자료번호#257079
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니