View previous topic :: View next topic |
Author |
Message |
Robert_Pre
Joined: 04 Mar 2010 Posts: 53
|
Posted: Mon Feb 29, 2016 7:36 pm Post subject: return from subroutine |
|
|
hello
i need help!
the return of multiple subroutine don't return to the start of the first call.
see in the attach file.
thanks
the loop of prog call--->subroutine 1 call------> subroutine 2 call------->subroutine 3 and hereI will return in the first subroutine,
but the programm return to the start
best regards
RP
(BASCOM-AVR version : 2.0.7.9 , Latest : 2.0.7.8 ) _________________ F1GHO |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Mon Feb 29, 2016 9:11 pm Post subject: |
|
|
Debounce provides a parameter SUB.
Read the fine manual. |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Tue Mar 01, 2016 6:21 pm Post subject: |
|
|
Robert,
you can join me at jeanpierre.duval2 (at) orange..... to help you in french
the help to "debounce" is not very clear. Here sub means that the label is the name used for a GOSUB.
Debounce Pind.0, 0, Pr, Sub
If the PIN pind. becomes low while the program executes the gosub pr: / return
PR:
done something
return
in your program you use sub as the name of a sub that is not correct.
I did my own keyboard without the use of debounce, it is a very old one, sorry I used goto !
we go out of the function when the button is up again
touche =clef()
Function Clef() As Byte
Local Keyboard As Byte
Key = 0
Encore2:
Waitms 20
Memoireclavier = 0
Do
Keyboard = Pind
Select Case Keyboard
Case 254
Key = 1
Exit Do
Case 253
Key = 2
Exit Do
Case 251
Key = 3
Exit Do
Case 247
Key = 4
Exit Do
Case 239
Key = 5
Exit Do
Case 223
Key = 6
Exit Do
Case 191
Key = 7
Exit Do
End Select
Loop 'Until Pind < 255
'Locate 1 , 1 : Lcd Spc(15)
'Locate 1 , 1 : Lcd "key:" ; Key
'Waitms 200
Do
Keyboard = Pind
Loop Until Pind = 255
If Key = 0 Then
Goto Encore2
End If
Waitms 20
Clef = Key
End Function
jp |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Tue Mar 01, 2016 6:53 pm Post subject: |
|
|
Duval JP wrote: | the help to "debounce" is not very clear. |
The help is perfectly clear, you only have to read, from the help:
Quote: | When you specify the optional parameter SUB, a GOSUB to label is performed instead of a GOTO. |
|
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Wed Mar 02, 2016 10:35 am Post subject: |
|
|
please MWS,
you are very clever and all of us are not so.
take a deep breath, and try to be a little more flexible!
many of us, like me, do not speak good English.
YES is clear
Quote: |
Label
The label to GOTO when the specified state is detected
SUB
The label to GOSUB when the specified state is detected
When you specify the optional parameter SUB, a GOSUB to label is performed instead of a GOTO.
|
you are right and also me too, but Sub is 99.9% considered as a procedure, and here this means that we must go to the GOSUB
Some people may not understand
and please this is no offence intended, I love the spirit of the forum, which in general is very friendly
JP |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Wed Mar 02, 2016 8:04 pm Post subject: |
|
|
Duval JP wrote: | you are very clever and all of us are not so. |
I know my stuff. Means: I know this stuff, it has nothing to do about who's clever or not.
Quote: | take a deep breath, and try to be a little more flexible! |
I have no flexibility, if you use false excuses like "help to "debounce" is not very clear", if it actually is clear.
Quote: | many of us, like me, do not speak good English. |
Which is something completely different.
Who is at fault, if I can't understand a certain block of text in a data sheet, because my English is bad, while the data sheet is written in clear English?
Is it me or the data sheet? See the point?
That said, I don't like false excuses pointing to anything or anyone, while hiding own deficits.
That earned you my response.
Can't see that.
Quote: | but Sub is 99.9% considered as a procedure, and here this means that we must go to the GOSUB |
I do not understand what you're talking about and who considers what.
The TO wrote in his source code:
Code: | Debounce Enter , 0 , Menu1
' ...
Sub Menu1
End Sub |
Now, what do you consider:
Quote: | the optional parameter SUB, a GOSUB to label is performed |
means? Does SUB not apply to Sub Menu1? Isn't there quite some resemblance between SUB and Sub?
There's something of course one must know:
is equivalent to:
But this is basic Bascom knowledge, and if you don't know it and even don't know English either, you're very much on the loose.
What will you do then, have more weak excuses?
On the other hand, why would anyone call a Sub() with a Goto? And that info is rather easy to translate, if the SUB-parameter is missing, GOTO is used.
Quote: | Some people may not understand |
If you mention problems with translation, yes, this is no problem, then say it like it is, simply say "my English is not good enough to understand", don't say "the help to "debounce" is not very clear".
If you think it's foggy, the fog may exist only in your mind.
Quote: | and please this is no offence intended |
No offense felt, while you still was not able to convince me with your POV. |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Thu Mar 03, 2016 12:08 pm Post subject: |
|
|
peace love and flowers... |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Thu Mar 03, 2016 8:24 pm Post subject: |
|
|
Duval JP wrote: | peace love and flowers... |
I'll take the flowers |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|