News:

Let's find out together what makes a PIC Tick!

Main Menu

Proc Local variable question

Started by trastikata, May 08, 2022, 08:37 AM

Previous topic - Next topic

trastikata

Hello all,

I am rewriting a program, converting Subs to Procs and I get a strange error, where local variables are not being created, am I missing something in this code?

P.s. The code is stripped to minimum for the error demonstration purpose, there's more into it, otherwise it would have been simply DelayMS  :)

Device=18F26K22        
Declare Xtal=8

Main:
    Delay(30)


Proc Delay(MsDelay As Word)
    Dim i As Word
   
    For i = 0 UpTo MsDelay
        DelayMS 1
    Next
EndProc

top204

A local variable's name must be longer than a single character.

I'll change the error message to detect it when it is created. I thought I had, but it does not seem to be working as I intended. Sometimes, when creating code, the obvious things slip past because a bias creeps into the subconcious and we tend not to see the obvious. :-)

trastikata

Quote from: top204 on May 08, 2022, 09:16 AMA local variable's name must be longer than a single character.

QuoteNote that a local variable's name must consist of more than 1 character.

Now when you said it, I saw it in the manual, but did not pay attention to it all. I saw the max of 32 characters note, but this somehow slipped through - subconcious bias  :)