hier mal der code:
Code:
$regfile = "m32def.dat"
$framesize = 32
$swstack = 32
$hwstack = 32
$crystal = 16000000
$baud = 9600
Sound Portd.7 , 400 , 450 'BEEP
Sound Portd.7 , 400 , 250 'BEEP
Sound Portd.7 , 400 , 450 'BEEP
'ADC Konfiguration
Const Ref = 5 / 1023 ' = 5.0 / 1024.0
Config Adc = Single , Prescaler = Auto
Start Adc
Dim W As Word
Dim Volt As Single
'Hautprogramm
Do
Porta.0 = 1
W = Getadc(0)
Volt = W * Ref
Print "ADC-Pin 0: Wert " ; W ; " Volt: " ; Volt
Wait 1
Loop
End
und hier mal die terminallogs:
an A0 nichts angeschlossen:
Code:
**** RN-Control 1.4 *****
Programm: ADC-Test-1
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
An A0 5V VCC
Code:
**** RN-Control 1.4 *****
Programm: ADC-Test-1
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
An A0 5V GND
Code:
**** RN-Control 1.4 *****
Programm: ADC-Test-1
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
ADC-Pin 0: Wert 1023 Volt: 4.999999517
Die 5V sind immer die spannung mit der der MEGA arbeitet
Lesezeichen