sub function

General discussion on mikroBasic for AVR.
Post Reply
Author
Message
granel
Posts: 142
Joined: 13 Feb 2007 11:01

sub function

#1 Post by granel » 13 Feb 2007 11:10

please, what the problem?


sub function ustan (dim mot_start, but_up, but_down as byte) as byte
if (mot_start=1) and (but_up=1) and (but_down=1)then
if data>500 then mot_up=0 mot_down=1 rele_torm=1 rele_up_a=0 rele_down_a=0 else
if data=500 then mot_up=0 mot_down=0 rele_torm=0 rele_up_a=0 rele_down_a=0
end if
end if
end sub


23:22 E-48 Return value of the function 'ustan' is not defined JP3_v42.abas

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: sub function

#2 Post by zristic » 13 Feb 2007 11:14

You need to say what is the result value of the function:

Code: Select all

sub function ustan (dim mot_start, but_up, but_down as byte) as byte 
  if (mot_start=1) and (but_up=1) and (but_down=1)then 
    if data>500 then mot_up=0 mot_down=1 rele_torm=1 rele_up_a=0
      rele_down_a=0 else 
    if data=500 then mot_up=0 mot_down=0 rele_torm=0 rele_up_a=0 
     rele_down_a=0 
    end if 
  end if 
  result = 123 ' <- here, this is how your function returns something.
end sub

Post Reply

Return to “mikroBasic for AVR General”