Witam,
męczę się z programikiem mającym zliczyć ilość naciśnięć
przycisku. Mikrostyk po przyciśnięciu łączy masę na PortD.2
w avr'rze at90s2313. Kombinuję i rezultaty mam mizerne.
W pierwszym programiku wykorzystałem przerwanie ale nie
liczy mi naciśnięć tylko przy jednokrotnym naduszeniu guzika
zliczy z 5 impulsów a jak się guzik przytrzyma to cyferki lecą...
W programiku drugim pojawia się tylko w drugiej linijce cyfra 1
i nic więcej nie robi.
Proszę Was o pomoc - co spieprzyłem? gdzie robię błędy?
Pozdrawiam
Przemo
$crystal = 4000000
Dim Count As Integer
Config Lcd = 16 * 2
Config Lcdbus = 4
Config Lcdmode = Port
Config Lcdpin = Pin , Db7 = Portb.0 , Db6 = Portb.1 , Db5 = Portb.2 ,
Db4 = Portb.3 , E = Portb.4 , Rs = Portb.5
On Int0 Int0_int
Do
Enable Interrupts
Enable Int0
Set Portd.2
Loop
End
Int0_int:
Disable Interrupts
Disable Int0
Incr Count
Cls
Lcd "Liczba impulsow:"
Lowerline
Lcd Count
Return
$crystal = 4000000
Dim A As Integer
Ddrd.2 = 0
Config Lcd = 16 * 2
Config Lcdbus = 4
Config Lcdmode = Port
Config Lcdpin = Pin , Db7 = Portb.0 , Db6 = Portb.1 , Db5 = Portb.2 ,
Db4 = Portb.3 , E = Portb.4 , Rs = Portb.5
A = 0
Do
If Pind.2 = 0 Then
Incr A
Cls
Lcd "Liczba impulsow:"
Lowerline
Lcd a
End If
Loop
męczę się z programikiem mającym zliczyć ilość naciśnięć
przycisku. Mikrostyk po przyciśnięciu łączy masę na PortD.2
w avr'rze at90s2313. Kombinuję i rezultaty mam mizerne.
W pierwszym programiku wykorzystałem przerwanie ale nie
liczy mi naciśnięć tylko przy jednokrotnym naduszeniu guzika
zliczy z 5 impulsów a jak się guzik przytrzyma to cyferki lecą...
W programiku drugim pojawia się tylko w drugiej linijce cyfra 1
i nic więcej nie robi.
Proszę Was o pomoc - co spieprzyłem? gdzie robię błędy?
Pozdrawiam
Przemo
$crystal = 4000000
Dim Count As Integer
Config Lcd = 16 * 2
Config Lcdbus = 4
Config Lcdmode = Port
Config Lcdpin = Pin , Db7 = Portb.0 , Db6 = Portb.1 , Db5 = Portb.2 ,
Db4 = Portb.3 , E = Portb.4 , Rs = Portb.5
On Int0 Int0_int
Do
Enable Interrupts
Enable Int0
Set Portd.2
Loop
End
Int0_int:
Disable Interrupts
Disable Int0
Incr Count
Cls
Lcd "Liczba impulsow:"
Lowerline
Lcd Count
Return
$crystal = 4000000
Dim A As Integer
Ddrd.2 = 0
Config Lcd = 16 * 2
Config Lcdbus = 4
Config Lcdmode = Port
Config Lcdpin = Pin , Db7 = Portb.0 , Db6 = Portb.1 , Db5 = Portb.2 ,
Db4 = Portb.3 , E = Portb.4 , Rs = Portb.5
A = 0
Do
If Pind.2 = 0 Then
Incr A
Cls
Lcd "Liczba impulsow:"
Lowerline
Lcd a
End If
Loop