Da kommt schon das nächste Problem ...

Das Programm soll einen Sharp Sensor an porta.1 abfragen und jeh nach Spannung 3 verschiedene Tonhöhen am Summer ausgeben (die Spannung wird davor noch in Volt umgerechnet).

Code:
Declare Sub Irmitte()
$regfile = "m32def.dat"
$hwstack = 32
$framesize = 32
$swstack = 32
$crystal = 16000000                                         'Quarzfrequenz
$baud = 9600

Dim Irma As Byte
Config Adc = Single , Prescaler = Auto
Porta.7 = 1                                                 'Pullup Widerstand ein
Const Ref = 5 / 1023

Sound Portd.7 , 400 , 450                                   'AnfangsBEEP
Sound Portd.7 , 400 , 250
Sound Portd.7 , 400 , 450
Waitms 1000


Do
Gosub Irmitte
If Irma > 1 Then Sound Portd.7 , 400 , 400 End If
If Irma > 2 Then Sound Portd.7 , 400 , 350 End If
If Irma > 3 Then Sound Portd.7 , 400 , 300 End If
Waitms 500
Loop

Sub Irmitte()
Local Irm As Byte
Start Adc
Irm = Getadc(1)
Irm = Irm * Ref
Irm = Irm * 5.2941
Irma = Irm
End Sub
Bascom sagt "If Irma > 1 Then"... Invalid Datatype aber is doch ein Byte und Variable not dimensioned Was mach ich falsch?