سلام
نمیدونم چرا تو این کد وقتی s=2 میشود ، pwm1a ، صفر نمیشود...
[code=c]$regfile = "m8def.dat"
$crystal = 1000000
Config Timer1 = Pwm , Pwm = 10 , Prescale = 1 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up
Start Timer1
Enable Interrupts
Config Int0 = Rising
Enable Int0
On Int0 Ddd
Config Portc = Output
Config Lcdpin = Pin , Db7 = Pind.0 , Db6 = Pind.1 , Db5 = Pind.4 , Db4 = Pind.3 , E = Pind.5 , Rs = Pind.6
Config Lcd = 16 * 2
Cls
Dim W As Integer
Dim Ee As Integer
Dim S As Byte
S = 1
Do
While S = 1
Incr Ee
Waitms 2
Pwm1a = Ee
If Ee = 1024 Then
S = 2
Exit While
End If
Wend
Home
Lcd Ee
If S = 2 Then
Pwm1a = 0
Ee = 0
End If
Lowerline
Lcd S
Loop
End
Ddd:
Return[/code]
اینم پروتیوس:
http://s5.picofile.com/file/8154173292/1411.DSN.html
نمیدونم چرا تو این کد وقتی s=2 میشود ، pwm1a ، صفر نمیشود...
[code=c]$regfile = "m8def.dat"
$crystal = 1000000
Config Timer1 = Pwm , Pwm = 10 , Prescale = 1 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up
Start Timer1
Enable Interrupts
Config Int0 = Rising
Enable Int0
On Int0 Ddd
Config Portc = Output
Config Lcdpin = Pin , Db7 = Pind.0 , Db6 = Pind.1 , Db5 = Pind.4 , Db4 = Pind.3 , E = Pind.5 , Rs = Pind.6
Config Lcd = 16 * 2
Cls
Dim W As Integer
Dim Ee As Integer
Dim S As Byte
S = 1
Do
While S = 1
Incr Ee
Waitms 2
Pwm1a = Ee
If Ee = 1024 Then
S = 2
Exit While
End If
Wend
Home
Lcd Ee
If S = 2 Then
Pwm1a = 0
Ee = 0
End If
Lowerline
Lcd S
Loop
End
Ddd:
Return[/code]
اینم پروتیوس:
http://s5.picofile.com/file/8154173292/1411.DSN.html
دیدگاه