PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Problem: Unknown Statement



Robin1508
17.05.2008, 17:24
Hi, ich hab hier ein Problem dass ich irgentwie nich wegbekomm:



$regfile = "m32def.dat"
$crystal = 16000000

Declare Function Acttime(byval X As Long) As Integer

Config Lcd = 16 * 1a
Config Lcdpin = Pin , Db4 = Portd.0 , Db5 = Portd.1 , Db6 = Portd.2 , Db7 = Portd.3 , E = Portd.5 , Rs = Portd.4
Config Lcdbus = 4
Cursor Off , Noblink

Config Timer1 = Timer , Prescale = 1024
Enable Timer1
On Timer1 Subroutine
Enable Interrupts

Dim X As Long

Do



Wait 1



Loop


Function Acttime(byval X As Long) As Integer
Cls
Locate 1 , 1
Lcd Str(x)
End Function

Subroutine:
X = X + 1
Acttime(x)
Return




Bascom sagt in der Subroutine zu "Acttime(x)" --> Unknown Statement

wieso?



Gruß Robin

for_ro
17.05.2008, 17:49
Hallo Robin,
im Gegensatz zu einer Sub() möchte eine Funktion ein Ergebnis zurückgeben.

Du musst also in der Funktion irgendwo ein

Acttime=...

setzen, und beim Aufruf dann

I=Acttime(x)

wobei I entsprechend deiner Deklaration ein Integer sein muss.
Schau dir auch mal die Hilfe zu 'Declare Function' an

Gruß

Rolf

Robin1508
17.05.2008, 18:06
optimal, danke :)