Page 1 of 1

var instead of const

Posted: 30 Oct 2023 21:52
by corado
If i try this

Code: Select all

Function LED_Blink(const i : Word):BYTE;
Begin
  Led_Status := not Led_Status;
  delay_ms(i);
  result:=0;
end;
I got the message
"45 304 Syntax error: Expected "constant expression" but "complex expression" found RTC_DS3234.mpas
45 305 Argument is out of range "i. Argument must be greater than or equal to 0." RTC_DS3234.mpas


Delay is waiting for an constand, but I want to use a variable.
How can I do that?

Re: var instead of const

Posted: 02 Nov 2023 11:11
by Thomas.Pahl@t-online.de
use Vdelay_ms() instead