Shop OBEX P1 Docs P2 Docs Learn Events
Any way to send variables to afunction/procedure — Parallax Forums

Any way to send variables to afunction/procedure

ArchiverArchiver Posts: 46,084
edited 2001-10-02 08:45 in General Discussion
I guess because they are trying to keep it fairly simple so that even
numbsculls like me can use them. On the positive side, look how easy they
have made serial communications and the fact that they supply voltage
regulation, data storage, serial port on any pin etc etc etc etc , the goods
easily outweigh the bads.
Chris


Original Message
From: Sean T. Lamont .lost. <lamont@a...>
To: <basicstamps@yahoogroups.com>
Sent: Tuesday, October 02, 2001 3:35 PM
Subject: Re: [noparse][[/noparse]basicstamps] Any way to send variables to afunction/procedure


>
> I was wondering before why parallax couldn't have built some intelligent
> things like complex branching (if x then instruction, for example, rather
> than trying to construct a bunch of labels) and functions-with-arguments
> into the preprocessor, without changing the stamp as it is in the
> slightest. It would certainly make my Object-oriented sensibilities a
> little happier, rather than constantly writing spaghetti.
>
> On Mon, 1 Oct 2001, Michael Hendricks wrote:
>
> > There is a way to "trick" the stamp into this sort of procedure. However
it is more work than good sometimes. If you are using a SX
> > serries stamp you can use scratchpad to create a stack. In C or ASM when
you "pass variables" you are usually pushing the pointers
> > or variables onto a stack then the function pops them off. We had an
application that required iteration, hence stack based calling.
> > We wrote a simple set of routines that would pop data from the "stack"
(scratch pad). Just a thought. This is a LONG work around and
> > may be more trouble than it is worth to you.
> >
> > MH
> >
> >
> >
Original Message
> > From: <nospam@e...>
> > To: <basicstamps@yahoogroups.com>
> > Sent: Monday, October 01, 2001 12:46 PM
> > Subject: [noparse][[/noparse]basicstamps] Any way to send variables to a function/procedure
> >
> >
> > > While the gosub command is great for reusing code, it would be
> > > WONDERFUL to be able to send variables to them. Does anyone know if
> > > this can be done? Are variables always global? For example I'd like
> > > to do this:
> > >
> > > MAIN:
> > > variable1 ='code here to get a value from a pin
> > > variable2 = doNumberCrunching(variable1)
> > > goto Main
> > >
> > > doNumberCrunching(aNumber)
> > > aNumber = aNumber + 1
> > > doNumberCrunching = aNumber
> > >
> > >
> > > If you've programmed in C or vbscript, or regular basic, you know
> > > what I mean.
> > >
> > > I'm pretty sure subs can't take variables, but is there any kind of
> > > work around?
> > >
> > > Thanks!
> > >
> > >
> > > To UNSUBSCRIBE, just send mail to:
> > > basicstamps-unsubscribe@yahoogroups.com
> > > from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> > >
> > >
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
> >
>
> Sean T. Lamont, CTO / Chief NetNerd, Abstract Software, Inc. (ServNet)
> Seattle - Bellingham - Vancouver - Portland - Everett - Tacoma - Bremerton
> email: lamont@a... WWW: http://www.serv.net
> "...There's no moral, it's just a lot of stuff that happens". - H. Simpson
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Sign In or Register to comment.