Voir prog ci dessous:
'Pendule LCD
'
Dim Nbintt1 As Byte
Dim Millisec As Word
Dim Cent As Byte
Dim Sec As Byte
Dim Mi As Byte
Dim He As Byte
Dim Date As Byte
Dim Mois As Byte
Dim An As Word
Dim Reloadt1 As Word
Reloadt1 = 65535 - 40000 ' = 25535
'Le timer compte de Reload à 65535
'25535 = 0x63bf
Cls
Lowerline
Lcd " === Pendule LCD ==="
P0 = &H55
Waitms 200
P0 = &HAA
Waitms 200
'configuration du timer
Config Timer1 = Timer , Gate = Internal , Mode = 1
Load Timer1 , Reloadt1
Th1 = &H8A
Tl1 = &HCF
Enable Interrupts
Enable Timer1
Priority Set Timer1
Start Timer1
P1 = 0
On Timer1 Increment
Affichage:
If Cent >= 25 Then '25 x 40000 = 1 seconde
Cent = 0
inc Sec
End If
If Cent > 12 Then P0 = &H55 Else P0 = &HAA ' Clignoter les LEDs
If Sec = 60 Then
Sec = 0
inc Mi
End If
If Mi = 60 Then
Mi = 0
inc He
End If
If He = 24 Then
He = 0
inc Date
End If
Upperline
Lcd He ; " : " ; Mi ; " : " ; Sec ; "," ; Cent ; " "
Goto Affichage
End
Increment:
'inc NbIntT1
inc Cent
If P1 = 0 Then P1 = 255 Else P1 = 0 'pour voir le fonctionementà l'oscillo
Return
Les mesures faites à l'oscillo ne corroborent pas les doc d'Intel, Atmel et de Bascom. Est-ce-que le Basic est incompatible avec la mesure du temps ?
Dommage car je me faisais une joie de réaliser des petites applis avec ce micro, ce n'est pas les idées qui manquent . . . .
Help !
