标题: 求助!!!为啥这个程序显示不正常呢? [打印本页] 作者: donny_y 时间: 2013-5-20 14:24 标题: 求助!!!为啥这个程序显示不正常呢? $regfile = "m8def.dat"
$crystal = 1000000
$baud = 9600
Config Timer0 = Timer , Prescale = 8 '定义T0为定时器,8分频
On Timer0 T0_interrupt '定时器T0溢出指向T0_interrupt中断程序
Config Portd = Output 'PORTD口定义为输出,控制各段
Config Portc = Output 'PORTC口定义为输出,控制公共端
Leds Alias Portd 'PORTD口别名定义为Leds
Ledv Alias Portc 'PORTC口别名定义为Ledv
'Dim Digital As Word '定义变量
Dim Led_code(10)as Byte
Dim Led_seg(4)as Byte
Dim Led_disp(4) As Byte
Dim Temp As Byte
Dim I As Byte
Enable Interrupts '全局中断使能
Enable Timer0 '定时器中断使能
Restore Digital_code
For I = 1 To 10
Read Led_code(i)
Next
Restore Digtal_seg
For I = 1 To 4
Read Led_seg(i)
Next
Do
Idle '单片机进入空闲状态
Loop
End
T0_interrupt: 'Timer0中断执行程序
Led_disp(1) = 1
Led_disp(2) = 2
Led_disp(3) = 3
Led_disp(4) = 4
For I = 1 To 4
Ledv = &H00
Leds = &HFF
Temp = Led_disp(i)
Leds = Lookup(temp , Digital_code)
Ledv = Led_seg(i)
Next