hallo rolf,
danke für deine antwort!
allerdings funktioniert das so nicht
ich habe hier mal meinen code, vielleicht kannst du dir das ja mal ansehen?!?!
währe nett von dir!
das gilt natürlich für alle
Code:
$regfile = "m32def.dat"
$crystal = 16000000
$baud = 9600
$hwstack = 32
$swstack = 10
$framesize = 40
Declare Function Tastenabfrage() As Byte
Declare Sub Batteriespannung()
Config Lcd = 20 * 4
Config Lcdpin = Pin , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 , E = Portc.4 , Rs = Portc.5
Config Lcdbus = 4
Config Adc = Single , Prescaler = Auto
Config Pina.7 = Input
Porta.7 = 1
Config Timer1 = Timer , Prescale = 1024
Enable Timer1
Enable Interrupts
Timer1 = 49910
On Timer1 Isr_von_timer1
Config Timer0 = Counter , Edge = Falling
Enable Timer0
Timer0 = 255
On Timer0 Isr_von_timer0
Dim A As Integer
Dim Taste As Byte
Dim Volt As Single
Dim Secu As Single
Dim Minu As Single
Dim Hour As Single
Dim X As Single
Dim Tasten_flag As Byte
Dim F As Single
Dim T As Single
Dim Freq As Single
Dim N As Long
Const Ref = 5 / 1023
A = 1
X = 1
Secu = 00
Minu = 00
Hour = 00
T = 0
Tasten_flag = 0
F = 0
Cls
Locate 1 , 4
Lcd "Daten-Terminal "
Locate 2 , 1
Lcd "Zeit = "
Locate 2 , 8
Lcd Hour ; Minu ; Secu
Do
Taste = Tastenabfrage()
If Taste <> 0 Then
Select Case Taste
Case 1
Tasten_flag = 0
Call Batteriespannung
Case 2
Tasten_flag = 0
Writeeeprom Secu , 1
Writeeeprom Minu , 10
Writeeeprom Volt , 20
Case 3
For N = 1 To 100000000
Freq = F / T
Cls
Locate 1 , 1
Lcd "Sekunden = " ; T
Locate 2 , 1
Lcd "Signale = " ; F
Locate 3 , 1
Lcd "==> Frequenz = "
Locate 4 , 1
Lcd Freq ;
If Taste <> 3 Then
Tasten_flag = 1
Exit For
End If
If Tasten_flag = 1 Then
Exit For
End If
Wait 1
Next N
Case 4
Tasten_flag = 0
If Secu = 60 Then
Secu = 00
Minu = Minu + 1
Elseif Minu = 60 Then
Minu = 00
Hour = Hour + 1
End If
Cls
Locate 2 , 1
Lcd "Zeit = "
Locate 2 , 8
Lcd Hour ; Minu ; Secu ;
Waitms 10
Case 5
Tasten_flag = 0
Readeeprom Secu , 1
Readeeprom Volt , 20
Cls
Locate 1 , 4
Lcd " Daten-Terminal "
Locate 2 , 1
Lcd Secu ; " Sekunden "
Locate 3 , 1
Lcd Minu ; " Minuten "
Locate 4 , 1
Lcd Volt ; " Volt "
End Select
End If
Loop
Isr_von_timer1:
Timer1 = 49910
Incr Secu
Incr T
Return
Isr_von_timer0:
Timer0 = 255
Incr F
Return
Function Tastenabfrage() As Byte
Local Ws As Word
Tastenabfrage = 0
Start Adc
Ws = Getadc(7)
If Ws < 500 Then
Select Case Ws
Case 400 To 450
Tastenabfrage = 1
Case 330 To 380
Tastenabfrage = 2
Case 260 To 305
Tastenabfrage = 3
Case 180 To 220
Tastenabfrage = 4
Case 90 To 130
Tastenabfrage = 5
End Select
End If
End Function
Sub Batteriespannung()
Local W As Word
Start Adc
W = Getadc(6)
Volt = W * Ref
Volt = Volt * 5.2941
Cls
Locate 1 , 1
Lcd "Die aktuelle "
Locate 2 , 1
Lcd "Spannung betraegt: "
Locate 3 , 1
Lcd Volt ; " Volt "
Waitms 100
End Sub
im prinzip möchte ich ja nur, dass der code in case 3 bis zu einem tastendruck (der dafür sorgt, dass das prog zu einem anderem case springt) ausgeführt wird und dann soll der andere case-code laufen.
gruß
chris
Lesezeichen