Gosub not working

General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
plouf
Posts: 27
Joined: 16 Jan 2015 09:34
Location: Athens,Greece

Gosub not working

#1 Post by plouf » 05 Oct 2020 19:00

Hi

trying to call a gosub it says that label identifier is not declared
howeven manual says that label need no declaration..

p.s. i see similar "bugs" in another dialects -> viewtopic.php?f=185&t=69722&p=280984&hi ... ub#p280984

1?!?!?!?!?
Christos

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Gosub not working

#2 Post by filip » 13 Oct 2020 09:01

Hi,

Can you attach the piece of code you are trying to compile ?

Regards,
Filip.

plouf
Posts: 27
Joined: 16 Jan 2015 09:34
Location: Athens,Greece

Re: Gosub not working

#3 Post by plouf » 13 Oct 2020 18:11

why can you compile ANYTHING ?

it fails to the simplest

Code: Select all

program LED_Blinking

main:

      GoSub label1

end.
label1:
    LATA = 0           ' Invert PORTA value
return
Christos

MicroMark
Posts: 181
Joined: 11 Feb 2011 17:22

Re: Gosub not working

#4 Post by MicroMark » 13 Oct 2020 19:09

Try moving your sub-routine above "END".


Code: Select all

program LED_Blinking

main:
TRISA = 0 ' Make port output
While true

     	 GoSub label1

	label1:
    		LATA = 0x0000           ' blink PORTA value
		Delay_ms(500)
   		 LATA = 0xffff         
		Delay_ms(500)
	return
wend
end.

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”