View Single Post
Old 19-06-2006, 01:44 PM   #16
TTL
Đệ tử 3 túi
 
Tham gia ngày: Jun 2006
Bài gửi: 50
:
Code:
TRISB = 01h
TRISA = 01h
INTCON.GIE = 1
INTCON.INTE = 1
OPTION_REG.INTEDG = 0
'khai bao bien
Dim a As Word
Dim store As Byte
Dim i As Byte
Dim j As Bit
a = 0
i = 0
main:
Lcdout #store
If i >= 11 Then
a = ShiftRight(a, 1)
store = a.LB
Serout PORTA.1, 9600, #store
i = 0
a = 0
Lcdcmdout LcdClear
Endif
Goto main
End
On Interrupt
a.0 = a.0 Or PORTA.0
a = ShiftLeft(a, 1)
i = i + 1
INTCON.INTF = 0
Resume

Giải thích dọan chương trình này sử dung ngắt RB0 dể lấy mã Scancode cua bàn phím sau đó gởi qua port nối tiếp ở chân PortA.1.
TTL vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn