![]() |
![]() |
#19 |
Đệ tử 3 túi
Tham gia ngày: Jun 2006
Bài gửi: 50
: |
Code:
WaitMs 1000 'Khoi tao LCD Define LCD_LINES = 2 Define LCD_CHARS = 16 Define LCD_BITS = 4 Define LCD_DREG = PORTB Define LCD_DBIT = 0 Define LCD_RSREG = PORTA Define LCD_RSBIT = 1 Define LCD_EREG = PORTA Define LCD_EBIT = 3 Define LCD_RWREG = PORTA Define LCD_RWBIT = 2 Lcdinit 'Khai bao bien Dim x As Byte Dim y As Byte Dim g1 As Byte Dim g2 As Byte Dim g3 As Byte Dim g4 As Byte Dim a1 As Byte Dim a2 As Byte Dim b1 As Byte Dim b2 As Byte Dim c1 As Byte Dim c2 As Byte a1 = 0 a2 = 0 b1 = 0 b2 = 0 c1 = 0 c2 = 0 x = 00 y = 00 main: Lcdcmdout LcdClear g1 = x / 10 g2 = x % 10 g3 = y / 10 g4 = y % 10 If x >= 24 Then x = 0 Endif If y >= 60 Then y = 0 Endif If a1 = g1 And a2 = g2 And b1 = g3 And b2 = g4 Then PORTA.0 = 1 Else PORTA.0 = 0 Endif c2 = c2 + 1 If c2 > 9 Then c2 = 0 c1 = c1 + 1 Endif If c1 > 5 Then c1 = 0 b2 = b2 + 1 Endif If b2 > 9 Then b2 = 0 b1 = b1 + 1 Endif If b1 > 5 Then b1 = 0 a2 = a2 + 1 Endif If a2 > 9 Then a2 = 0 a1 = a1 + 1 Endif If a1 >= 2 And a2 >= 4 Then a2 = 0 a1 = 0 Endif Lcdout #a1, #a2, ":", #b1, #b2, ":", #c1, #c2, " ", #x, ":", #y Lcdcmdout LcdLine2Home Lcdout "Digital clock " WaitMs 998 Goto main End On Interrupt WaitUs 100 If PORTB.6 = 1 Then a2 = a2 + 1 Endif If PORTB.4 = 1 Then b2 = b2 + 1 Endif If PORTB.7 = 1 Then x = x + 1 Endif If PORTB.5 = 1 Then y = y + 1 Endif INTCON.RBIF = 0 Resume |
![]() |
![]() |
|
|
![]() |
||||
Ðề tài | Người gửi | Chuyên mục | Trả lời | Bài mới |
Giao tiếp RS232 trên PC bằng Visual Basic. | ngohaibac | Giao tiếp cổng COM và LPT | 129 | 31-10-2013 01:39 PM |
Mikro basic | minhtienbk | Chương trình dịch & các công cụ mô phỏng | 1 | 11-11-2009 08:25 PM |
Ngôn ngữ Basic cho PIC | thaychua | Các ngôn ngữ lập trình khác (CCS C, HT PIC,...) | 10 | 10-10-2007 08:49 PM |
Lập trình cho PIC bằng BASIC | phamgiaquang | Tổ dịch thuật | 11 | 10-10-2007 07:51 PM |
Gặp vấn đề về Mikro Basic | TTL | Các ngôn ngữ lập trình khác (CCS C, HT PIC,...) | 5 | 09-08-2006 07:07 PM |