SE-CLOCK-ES

초등학교 특활 과제용 전자 시계 KIT

BASIC 언어를 사용한 가장 간단한 시계 KIT입니다.
Demo 버젼 컴파일러 사용으로 
누구나  쉽게 마이크로 프로세서를 배울 수 있습니다.

SE-CLOCK-ES 소스(Bascom 8051 BASIC)

BASCOM 8051 데모 버젼 컴파일러(4K 사용가능)

BASCOM 8051 컴파일러 한글 매뉴얼


CPU에 HEX 파일이 라이팅 되어 있습니다.

'---------------------------------------------------------------------------
' Description:
'
' SE-CLOCK-ES
'
' Especially Designed CLOCK for Elementary School Student
'
' +-----------------------------------------+
' | |
' | O +----+ +----+ +----+ +----+ |
' | A.M| | | | O | | | | |
' | | | | | | | | | |
' | +----+ +----+ +----+ +----+ |
' | | | | | | | | | |
' | P.M| | | | O | | | | |
' | O +----+ +----+ +----+ +----+ |
' | WWW.SAMPLE.CO.KR |
' | |||| | -NNN- | |||||||| +-+--+-- | |
' | ZZZZ = -NNN- Z ZZZZZZZZ |o| |-- = |
' | ZZZZ | -NNN- Z ZZZZZZZZ +-+--+-- | |
' | ZZZZ -NNN- Z ZZZZZZZZ 7805 1uF|
' | |||| 1uF -NNN- | |||||||| |
' | -NNN- ||| |
' |1uF -NNN- O ALM|||ZZZ |
' || ||ZZZZZZ |
' |= +-------------------+ ZZZZZZZZ |
' || ___ | | ZZZZZ||| |
' | / \ > 8051 | ZZ||| |
' | | | | | || DC9V|
' | | | +-------------------+ +----|
' | \___/ __ | |
' | PIEZO ALARM EXIT HOUR MIN<__>33P+----|
' | BUZER [ ] [ ] [ ] [ ] -||- |
' | -||- --|>|-|
' | 33P 1N4007|
' +-----------------------------------------+
'
' Written by Junghoon Kim 08-NOV-2005
' Compiled by BASCOM 8051 Demo
'
' http://www.mcselec.com
'
' SAMPLE Electronics co.
' C-18 P1-fl. Main-bd. ET-Land
' 16-9 Hangangno-3ga Yongsan-gu
' Seoul 190-879 South KOREA
' Tel: +82-2-701-8051
' Fax: +82-2-701-8058
' Mail : sample@korea.com
' Web : HTTP://WWW.SAMPLE.CO.KR
'===========================================================================
$regfile = "REG51.DAT"
'---------------------------------------------------------------------------
' 7 Segment Pattern Data
Const Segpat0 = &B11000000 ' 0 ****A***
Const Segpat1 = &B11111001 ' 1 * *
Const Segpat2 = &B10100100 ' 2 F B
Const Segpat3 = &B10110000 ' 3 * *
Const Segpat4 = &B10011001 ' 4 ****G***
Const Segpat5 = &B10010010 ' 5 * *
Const Segpat6 = &B10000010 ' 6 E C
Const Segpat7 = &B11011000 ' 7 * *
Const Segpat8 = &B10000000 ' 8 ****D***
Const Segpat9 = &B10011000 ' 9
Const Segpblk = &B11111111 ' 10 BLANK
'---------------------------------------------------------------------------
Hour10 Alias P1.0
Led_am Alias P1.1
Led_pm Alias P1.2
Piezo Alias P1.3
Sw_alarm Alias P1.4
Sw_exit Alias P1.5
Sw_hour Alias P1.6
Sw_min Alias P1.7
'---------------------------------------------------------------------------
Dim Icount As Word
Dim Clock_cent As Byte ' 1/100 초 단위(0 ~ 99)
Dim Clock_second As Byte ' 초 단위 변수 (0 ~ 59)
Dim Clock_min As Byte ' 분 단위 변수 (0 ~ 59)
Dim Clock_hour As Byte ' 시 단위 변수 (0 ~ 23)
Dim Alarm_min As Byte ' 분 단위 변수 (0 ~ 59)
Dim Alarm_hour As Byte ' 시 단위 변수 (0 ~ 23)
Dim Data_min As Byte
Dim Data_hour As Byte
Dim Tempa As Byte
Dim Tempb As Byte
Dim Tempc As Byte
Dim Beep As Bit
Dim Dot_high As Bit
Dim Dot_low As Bit
Dim Dot_alarm As Bit
'===========================================================================
On Timer0 Timebase ' Timer0 Interrupt
'---------------------------------------------------------------------------
Config Timer0 = Timer , Gate = Internal , Mode = 2 ' Timer0 Auto Reload Timer Mode
Load Timer0 , 200 ' Auto Reload Constant 200 uSec
Start Timer0 ' Start Timer0
Enable Timer0 ' Enable Timer0
Enable Interrupts ' Enable All Interrupt
'===========================================================================
Icount = 0
Clock_cent = 0
Clock_second = 0
Clock_min = 0
Clock_hour = 0
Alarm_min = 0
Alarm_hour = 0
Beep = 0
Dot_alarm = 1
'---------------------------------------------------------------------------
Main_clock: ' 시계 동작모드
'
If Clock_cent > 99 Then
Clock_cent = 0
Incr Clock_second
End If
'
If Clock_second > 59 Then
Clock_second = 0
Incr Clock_min
End If
'
If Clock_min > 59 Then
Clock_min = 0
Incr Clock_hour
End If
'
If Clock_hour > 23 Then
Clock_hour = 0
End If
'
Data_min = Clock_min : Data_hour = Clock_hour
'
Gosub Dot_proc
Gosub Clock_disp
'
If Sw_alarm = 0 Then
Gosub Alarm_proc
End If
'
If Sw_min = 0 Then
Clock_second = 0
Incr Clock_min
If Clock_min > 59 Then
Clock_min = 0
End If
Waitms 100
End If
'
If Sw_hour = 0 Then
Incr Clock_hour
If Clock_hour > 23 Then
Clock_hour = 0
End If
Waitms 100
End If
'
If Dot_alarm = 0 Then
If Clock_hour = Alarm_hour Then
If Clock_min = Alarm_min Then
Set Beep
Else
Reset Beep
End If
Else
Reset Beep
End If
Else
Reset Beep
End If
'
Goto Main_clock
'===========================================================================
Clock_disp:
'
Tempa = Data_min Mod 10 : Gosub Patconv
If Dot_alarm = 0 Then
Tempb = Tempb And &H7F
End If
P3 = Tempb
'
Tempa = Data_min / 10 : Gosub Patconv
If Dot_high = 0 Then
Tempb = Tempb And &H7F
End If
P2 = Tempb
'
If Data_hour < 12 Then
Reset Led_am : Set Led_pm
Tempc = Data_hour
Else
Reset Led_pm : Set Led_am
Tempc = Data_hour - 12
End If
'
If Tempc = 0 Then
Tempc = 12
End If
'
Tempa = Tempc Mod 10 : Gosub Patconv
If Dot_low = 0 Then
Tempb = Tempb And &H7F
End If
P0 = Tempb
'
Tempa = Tempc / 10
'
If Tempa = 1 Then
Reset Hour10
Else
Set Hour10
End If
'
Return
'
'===========================================================================
Dot_proc:
'
If Clock_second < 30 Then
Reset Dot_low
If Clock_cent < 50 Then
Reset Dot_high
Else
Set Dot_high
End If
Else
Reset Dot_high
If Clock_cent < 50 Then
Reset Dot_low
Else
Set Dot_low
End If
End If
'
Return
'
'===========================================================================
Alarm_proc:
'
Set Dot_high : Set Dot_low
Data_min = Alarm_min : Data_hour = Alarm_hour
Gosub Clock_disp
Waitms 100
'
Alarm_loop:
Data_min = Alarm_min : Data_hour = Alarm_hour
Gosub Clock_disp
If Sw_min = 0 Then
Incr Alarm_min
If Alarm_min > 59 Then
Alarm_min = 0
End If
Waitms 50
End If
'
If Sw_hour = 0 Then
Incr Alarm_hour
If Alarm_hour > 23 Then
Alarm_hour = 0
End If
Waitms 50
End If
'
If Sw_alarm = 0 Then
Set Dot_alarm
Goto Alarm_ret
End If
'
If Sw_exit = 0 Then
Reset Dot_alarm
Goto Alarm_ret
End If
'
Goto Alarm_loop
'
Alarm_ret:
'
Waitms 500
'
Return
'===========================================================================
Patconv: ' FND 패턴 변환
'
Tempa = Tempa And &H0F
Select Case Tempa
Case 0 : Tempb = Segpat0
Case 1 : Tempb = Segpat1
Case 2 : Tempb = Segpat2
Case 3 : Tempb = Segpat3
Case 4 : Tempb = Segpat4
Case 5 : Tempb = Segpat5
Case 6 : Tempb = Segpat6
Case 7 : Tempb = Segpat7
Case 8 : Tempb = Segpat8
Case 9 : Tempb = Segpat9
Case Else
End Select
'
Return
'===========================================================================
Timebase: ' 타이머 인터럽트 실행
'
Incr Icount
'
If Icount > 49 Then ' 49
'
Icount = 0
Incr Clock_cent
End If
'
If Beep = 1 Then
If Piezo = 1 Then
Reset Piezo
Else
Set Piezo
End If
End If
'
Return
'---------------------------------------------------------------------------
'
'============================ END OF FILE ==================================
'
'

자료실:

SE-CLOCK-ES 소스(Bascom 8051 BASIC)

BASCOM 8051 데모 버젼 컴파일러(2K 사용가능)

SE-CLOCK-ES 소스( C Language )

BASCOM 8051 컴파일러 한글 매뉴얼

AT89C51 데이터

 

 

샘플전자 시계 조립 KIT 비교표
(그림을 클릭하시면 관련 페이지로 이동합니다.)

SE-CLOCK-UNI


Lan: C 언어
CPU: AT89C51
기판: 만능기판

SE-CLOCK-FND


Lan: BASIC
CPU: AT89C51
기판: 양면 PCB

SE-CLOCK-LED


Lan: C, BASIC
CPU: AT89C2051
기판: 단면 PCB

SE-CLOCK-LED-U


Lang: C, BASIC
CPU: AT89C2051
기판: 만능기판

SE-CLOCK-DM


Lan: C, BASIC
CPU: AT89C2051
기판: 양면 PCB

SE-CLOCK-DM-U


Lan: C, BASIC
CPU: AT89C2051
기판: 만능기판

SE-CLOCK-ES


Lan: C, BASIC
CPU: AT89C51
기판: 단면 PCB

SE-CLOCK-MINI


Lan: BASIC
CPU: AT89C2051
기판: 양면 PCB

 

가 격 정 보