q3
30.05.2007, 20:20
hi leute ich schreib mal den quellcode....hab nen atmega8 und passendes board mit rn-funk ...hab allerdings ein problem mit der anzahl der messwerte pro sekunde.. nun meine frage geht das irgendwie schneller?
$regfile = "m8def.dat"
$hwstack = 82
$framesize = 68
$swstack = 68
$crystal = 16000000 'Quarzfrequenz
$baud = 19200
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Timsk = &B00100101
Mcucr = &B00001010
Gicr = &B11000000
Sreg = &B10000000
Tccr1b = &B11000010
Config Pinc.0 = Input
Config Pinc.1 = Input
Config Pinc.2 = Input
Config Pinc.3 = Input
Config Pind.0 = Input
Config Pind.2 = Input
Config Pind.3 = Input
Const Ref = 4950 / 1023
Const Zei = 1 / 0.0156
Dim A As Integer
Dim I As Integer
Dim Volt As Long
Dim D As Long
Dim W As Long
Config Single = Scientific , Digits = 1
On Timer0 Aus
On Int0 Ir0 'Portd pin3
Config Timer1 = Timer , Capture Edge = Rising , Noise Cancel = 0 , Prescale = 1024
Config Timer0 = Timer , Prescale = 1024
Stop Timer1
Stop Timer0
Dim Test As Integer
Do
For I = 0 To 3
Start Adc
W = Getadc(i)
Volt = W * Ref
Print ; I ; " " ; Volt
Waitms 30
Next I
'D = D * Zei
Loop
End
Aus:
A = A + 1
Return
Ir0:
Stop Timer1
D = Timer1
Timer1 = 0
Print "4 " ; D
Start Timer1
Return
$regfile = "m8def.dat"
$hwstack = 82
$framesize = 68
$swstack = 68
$crystal = 16000000 'Quarzfrequenz
$baud = 19200
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Timsk = &B00100101
Mcucr = &B00001010
Gicr = &B11000000
Sreg = &B10000000
Tccr1b = &B11000010
Config Pinc.0 = Input
Config Pinc.1 = Input
Config Pinc.2 = Input
Config Pinc.3 = Input
Config Pind.0 = Input
Config Pind.2 = Input
Config Pind.3 = Input
Const Ref = 4950 / 1023
Const Zei = 1 / 0.0156
Dim A As Integer
Dim I As Integer
Dim Volt As Long
Dim D As Long
Dim W As Long
Config Single = Scientific , Digits = 1
On Timer0 Aus
On Int0 Ir0 'Portd pin3
Config Timer1 = Timer , Capture Edge = Rising , Noise Cancel = 0 , Prescale = 1024
Config Timer0 = Timer , Prescale = 1024
Stop Timer1
Stop Timer0
Dim Test As Integer
Do
For I = 0 To 3
Start Adc
W = Getadc(i)
Volt = W * Ref
Print ; I ; " " ; Volt
Waitms 30
Next I
'D = D * Zei
Loop
End
Aus:
A = A + 1
Return
Ir0:
Stop Timer1
D = Timer1
Timer1 = 0
Print "4 " ; D
Start Timer1
Return