Efficiency and multiple
Archiver
Posts: 46,084
Hi All,
I have a project that I'm using a BS2SX for. It uses 7 of the 8
banks available, and is, at least to me, relatively complex. I have
it to the point that it runs quite well on the bench, but i'd like to
improve on my sample times. The program initializes in bank 0, goes
to bank 1 to read an input, then gets sent to the appropriate bank
for processing, and returns to bank 1 to begin the loop again. I put
an output in bank 1 which toggles an LED, which I can also monitor
with a frequency meter. So far, the best I can get is about 3.6 hz,
so I'm looking for ways I can make things more efficient, and speed
things up.
The first thing that's troubling me is, I have a series of
if/then statements to evaluate the first input variable. I've read
that this can be improved on with a "branch" statement, but I can't
figure out how to do it in this application.
Here's a snipit, where fpx is the input variable:
if (fpx > 111) and (fpx < 133) then lable 1
if (fpx > 266) and (fpx < 308) then lable 2
if (fpx > 419) and (fpx < 470) then lable 3
if (fpx > 572) and (fpx < 622) then lable 4
if (fpx > 724) and (fpx < 764) then lable 5
if (fpx > 875) and (fpx < 899) then lable 6
Any help would be much appreciated.
Thanks,
Robert
I have a project that I'm using a BS2SX for. It uses 7 of the 8
banks available, and is, at least to me, relatively complex. I have
it to the point that it runs quite well on the bench, but i'd like to
improve on my sample times. The program initializes in bank 0, goes
to bank 1 to read an input, then gets sent to the appropriate bank
for processing, and returns to bank 1 to begin the loop again. I put
an output in bank 1 which toggles an LED, which I can also monitor
with a frequency meter. So far, the best I can get is about 3.6 hz,
so I'm looking for ways I can make things more efficient, and speed
things up.
The first thing that's troubling me is, I have a series of
if/then statements to evaluate the first input variable. I've read
that this can be improved on with a "branch" statement, but I can't
figure out how to do it in this application.
Here's a snipit, where fpx is the input variable:
if (fpx > 111) and (fpx < 133) then lable 1
if (fpx > 266) and (fpx < 308) then lable 2
if (fpx > 419) and (fpx < 470) then lable 3
if (fpx > 572) and (fpx < 622) then lable 4
if (fpx > 724) and (fpx < 764) then lable 5
if (fpx > 875) and (fpx < 899) then lable 6
Any help would be much appreciated.
Thanks,
Robert
Comments
fpx var word
where var byte
lookdown fpx,<[noparse][[/noparse]112,133,267,308,420,470,573,622,725,764,876,899],where
branch where,[noparse][[/noparse]goof,label1,goof,label2,goof,label3,...label6]
goof: ' not in ranges specified
label1: ' etc etc.
-- best regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
mailto:tracy@e...
>Hi All,
> I have a project that I'm using a BS2SX for. It uses 7 of the 8
>banks available, and is, at least to me, relatively complex. I have
>it to the point that it runs quite well on the bench, but i'd like to
>improve on my sample times. The program initializes in bank 0, goes
>to bank 1 to read an input, then gets sent to the appropriate bank
>for processing, and returns to bank 1 to begin the loop again. I put
>an output in bank 1 which toggles an LED, which I can also monitor
>with a frequency meter. So far, the best I can get is about 3.6 hz,
>so I'm looking for ways I can make things more efficient, and speed
>things up.
> The first thing that's troubling me is, I have a series of
>if/then statements to evaluate the first input variable. I've read
>that this can be improved on with a "branch" statement, but I can't
>figure out how to do it in this application.
> Here's a snipit, where fpx is the input variable:
>
> if (fpx > 111) and (fpx < 133) then lable 1
> if (fpx > 266) and (fpx < 308) then lable 2
> if (fpx > 419) and (fpx < 470) then lable 3
> if (fpx > 572) and (fpx < 622) then lable 4
> if (fpx > 724) and (fpx < 764) then lable 5
> if (fpx > 875) and (fpx < 899) then lable 6
>
>Any help would be much appreciated.
>
>Thanks,
>Robert
>
>
>
>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/
I studied Lookdown until I swear I could quote it backwards,
still couldn't make the connection.
Takes an expert. Much appreciated!!
Regards,
Robert
--- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
> Hi Robert, look into the LOOKDOWN command,
>
>
> fpx var word
> where var byte
>
> lookdown fpx,<
[noparse][[/noparse]112,133,267,308,420,470,573,622,725,764,876,899],where
> branch where,[noparse][[/noparse]goof,label1,goof,label2,goof,label3,...label6]
> goof: ' not in ranges specified
>
> label1: ' etc etc.
>
> -- best regards
> Tracy Allen
> electronically monitored ecosystems
> http://www.emesystems.com
> mailto:tracy@e...
>
>
> >Hi All,
> > I have a project that I'm using a BS2SX for. It uses 7 of the
8
> >banks available, and is, at least to me, relatively complex. I have
> >it to the point that it runs quite well on the bench, but i'd like
to
> >improve on my sample times. The program initializes in bank 0, goes
> >to bank 1 to read an input, then gets sent to the appropriate bank
> >for processing, and returns to bank 1 to begin the loop again. I
put
> >an output in bank 1 which toggles an LED, which I can also monitor
> >with a frequency meter. So far, the best I can get is about 3.6 hz,
> >so I'm looking for ways I can make things more efficient, and speed
> >things up.
> > The first thing that's troubling me is, I have a series of
> >if/then statements to evaluate the first input variable. I've read
> >that this can be improved on with a "branch" statement, but I can't
> >figure out how to do it in this application.
> > Here's a snipit, where fpx is the input variable:
> >
> > if (fpx > 111) and (fpx < 133) then lable 1
> > if (fpx > 266) and (fpx < 308) then lable 2
> > if (fpx > 419) and (fpx < 470) then lable 3
> > if (fpx > 572) and (fpx < 622) then lable 4
> > if (fpx > 724) and (fpx < 764) then lable 5
> > if (fpx > 875) and (fpx < 899) then lable 6
> >
> >Any help would be much appreciated.
> >
> >Thanks,
> >Robert
> >
> >
> >
> >To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@y...
> >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/
I think the lookdown works something like this.....When you come to
the lookdown statement it essentially "looks down" the list and
compares the input value (fpx) to the values in the list based on the
comparision operator, which in Tracy's example is < or less than. It
then sets your result variable (where) to the index number of the
first value that makes that comparison true. By index number we mean
that if the 3rd value in the list was the first value that made the
comparison true it would set your result variable to a value of 3.
So for example, if you set fpx = 120, lookdown will compare that value
to the list and set 'where' to 2 because 120 is less than 133 which is
the 2nd value in the list.
If you set fpx = 500, lookdown will compare that value to the list and
set 'where' to 7 because 500 is less than 573 which is the 7th value
in the list.
You then take that 'where' and use it as an offset in a branch
statement to call your subroutines. Lets take my fpx = 500 example.
As we saw above, lookdown will set 'where' to a value of 7. In the
branch instruction you use 'where' which is now 7 as your offset. The
7th address in the branch instruction would be a 'goof' which would
basically do nothing, which is the same thing that would happen if you
put fpx = 500 into your if/then statements.
Lets say though you set fpx = 120. This time through the lookdown,
you will set 'where' to a value of 2 because 120 is less than 133
which is the 2nd value in the list. Now in the branch instruction,
you use 2 as your offset and you call the 2nd address in the branch
which would be 'label1.' As you see this produces the same result as
if you ran it through your if/then statements.
Hopefully it's clear as mud now, and I'm not screwed up!
Later,
Tom
--- In basicstamps@y..., robert_hiebert@s... wrote:
> Hi Tracy,
> I studied Lookdown until I swear I could quote it backwards,
> still couldn't make the connection.
> Takes an expert. Much appreciated!!
>
> Regards,
> Robert
>
> --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
> > Hi Robert, look into the LOOKDOWN command,
> >
> > fpx var word
> > where var byte
> >
> > lookdown fpx,<
> [noparse][[/noparse]112,133,267,308,420,470,573,622,725,764,876,899],where
> > branch where,[noparse][[/noparse]goof,label1,goof,label2,goof,label3,...label6]
> > goof: ' not in ranges specified
> >
> > label1: ' etc etc.
> >
> > -- best regards
> > Tracy Allen
> > electronically monitored ecosystems
> > http://www.emesystems.com
> > mailto:tracy@e...
> >
> >
> > >Hi All,
> > > I have a project that I'm using a BS2SX for. It uses 7 of
the
> 8
> > >banks available, and is, at least to me, relatively complex. I
have
> > >it to the point that it runs quite well on the bench, but i'd
like
> to
> > >improve on my sample times. The program initializes in bank 0,
goes
> > >to bank 1 to read an input, then gets sent to the appropriate
bank
> > >for processing, and returns to bank 1 to begin the loop again. I
> put
> > >an output in bank 1 which toggles an LED, which I can also
monitor
> > >with a frequency meter. So far, the best I can get is about 3.6
hz,
> > >so I'm looking for ways I can make things more efficient, and
speed
> > >things up.
> > > The first thing that's troubling me is, I have a series of
> > >if/then statements to evaluate the first input variable. I've
read
> > >that this can be improved on with a "branch" statement, but I
can't
> > >figure out how to do it in this application.
> > > Here's a snipit, where fpx is the input variable:
> > >
> > > if (fpx > 111) and (fpx < 133) then lable 1
> > > if (fpx > 266) and (fpx < 308) then lable 2
> > > if (fpx > 419) and (fpx < 470) then lable 3
> > > if (fpx > 572) and (fpx < 622) then lable 4
> > > if (fpx > 724) and (fpx < 764) then lable 5
> > > if (fpx > 875) and (fpx < 899) then lable 6
> > >
> > >Any help would be much appreciated.
> > >
> > >Thanks,
> > >Robert
> > >
> > >
> > >
> > >To UNSUBSCRIBE, just send mail to:
> > > basicstamps-unsubscribe@y...
> > >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/
Tracey's answer was clear to me right away. I just couldn't
figure how to get the range between acceptable values figured out
before. The "goof" offsets solved that.
Thanks for taking the time and interest to reply, your
explanation was excellent.
Regards,
Robert
--- In basicstamps@y..., tbanez@h... wrote:
> Robert,
>
> I think the lookdown works something like this.....When you come to
> the lookdown statement it essentially "looks down" the list and
> compares the input value (fpx) to the values in the list based on
the
> comparision operator, which in Tracy's example is < or less than.
It
> then sets your result variable (where) to the index number of the
> first value that makes that comparison true. By index number we
mean
> that if the 3rd value in the list was the first value that made the
> comparison true it would set your result variable to a value of 3.
>
> So for example, if you set fpx = 120, lookdown will compare that
value
> to the list and set 'where' to 2 because 120 is less than 133 which
is
> the 2nd value in the list.
>
> If you set fpx = 500, lookdown will compare that value to the list
and
> set 'where' to 7 because 500 is less than 573 which is the 7th
value
> in the list.
>
> You then take that 'where' and use it as an offset in a branch
> statement to call your subroutines. Lets take my fpx = 500
example.
> As we saw above, lookdown will set 'where' to a value of 7. In the
> branch instruction you use 'where' which is now 7 as your offset.
The
> 7th address in the branch instruction would be a 'goof' which would
> basically do nothing, which is the same thing that would happen if
you
> put fpx = 500 into your if/then statements.
>
> Lets say though you set fpx = 120. This time through the lookdown,
> you will set 'where' to a value of 2 because 120 is less than 133
> which is the 2nd value in the list. Now in the branch instruction,
> you use 2 as your offset and you call the 2nd address in the branch
> which would be 'label1.' As you see this produces the same result
as
> if you ran it through your if/then statements.
>
> Hopefully it's clear as mud now, and I'm not screwed up!
>
> Later,
> Tom
>
> --- In basicstamps@y..., robert_hiebert@s... wrote:
> > Hi Tracy,
> > I studied Lookdown until I swear I could quote it backwards,
> > still couldn't make the connection.
> > Takes an expert. Much appreciated!!
> >
> > Regards,
> > Robert
> >
> > --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
> > > Hi Robert, look into the LOOKDOWN command,
> > >
> > > fpx var word
> > > where var byte
> > >
> > > lookdown fpx,<
> > [noparse][[/noparse]112,133,267,308,420,470,573,622,725,764,876,899],where
> > > branch where,[noparse][[/noparse]goof,label1,goof,label2,goof,label3,...label6]
> > > goof: ' not in ranges specified
> > >
> > > label1: ' etc etc.
> > >
> > > -- best regards
> > > Tracy Allen
> > > electronically monitored ecosystems
> > > http://www.emesystems.com
> > > mailto:tracy@e...
> > >
> > >
> > > >Hi All,
> > > > I have a project that I'm using a BS2SX for. It uses 7 of
> the
> > 8
> > > >banks available, and is, at least to me, relatively complex. I
> have
> > > >it to the point that it runs quite well on the bench, but i'd
> like
> > to
> > > >improve on my sample times. The program initializes in bank 0,
> goes
> > > >to bank 1 to read an input, then gets sent to the appropriate
> bank
> > > >for processing, and returns to bank 1 to begin the loop again.
I
> > put
> > > >an output in bank 1 which toggles an LED, which I can also
> monitor
> > > >with a frequency meter. So far, the best I can get is about
3.6
> hz,
> > > >so I'm looking for ways I can make things more efficient, and
> speed
> > > >things up.
> > > > The first thing that's troubling me is, I have a series of
> > > >if/then statements to evaluate the first input variable. I've
> read
> > > >that this can be improved on with a "branch" statement, but I
> can't
> > > >figure out how to do it in this application.
> > > > Here's a snipit, where fpx is the input variable:
> > > >
> > > > if (fpx > 111) and (fpx < 133) then lable 1
> > > > if (fpx > 266) and (fpx < 308) then lable 2
> > > > if (fpx > 419) and (fpx < 470) then lable 3
> > > > if (fpx > 572) and (fpx < 622) then lable 4
> > > > if (fpx > 724) and (fpx < 764) then lable 5
> > > > if (fpx > 875) and (fpx < 899) then lable 6
> > > >
> > > >Any help would be much appreciated.
> > > >
> > > >Thanks,
> > > >Robert
> > > >
> > > >
> > > >
> > > >To UNSUBSCRIBE, just send mail to:
> > > > basicstamps-unsubscribe@y...
> > > >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/
Sorry I misunderstood your reply. I thought you still needed help!
Glad it worked out for you!
Regards,
Tom
--- In basicstamps@y..., robert_hiebert@s... wrote:
> Hi Tom,
> Tracey's answer was clear to me right away. I just couldn't
> figure how to get the range between acceptable values figured out
> before. The "goof" offsets solved that.
> Thanks for taking the time and interest to reply, your
> explanation was excellent.
> Regards,
> Robert
>
> --- In basicstamps@y..., tbanez@h... wrote:
> > Robert,
> >
> > I think the lookdown works something like this.....When you come
to
> > the lookdown statement it essentially "looks down" the list and
> > compares the input value (fpx) to the values in the list based on
> the
> > comparision operator, which in Tracy's example is < or less than.
> It
> > then sets your result variable (where) to the index number of the
> > first value that makes that comparison true. By index number we
> mean
> > that if the 3rd value in the list was the first value that made
the
> > comparison true it would set your result variable to a value of 3.
> >
> > So for example, if you set fpx = 120, lookdown will compare that
> value
> > to the list and set 'where' to 2 because 120 is less than 133
which
> is
> > the 2nd value in the list.
> >
> > If you set fpx = 500, lookdown will compare that value to the list
> and
> > set 'where' to 7 because 500 is less than 573 which is the 7th
> value
> > in the list.
> >
> > You then take that 'where' and use it as an offset in a branch
> > statement to call your subroutines. Lets take my fpx = 500
> example.
> > As we saw above, lookdown will set 'where' to a value of 7. In
the
> > branch instruction you use 'where' which is now 7 as your offset.
> The
> > 7th address in the branch instruction would be a 'goof' which
would
> > basically do nothing, which is the same thing that would happen if
> you
> > put fpx = 500 into your if/then statements.
> >
> > Lets say though you set fpx = 120. This time through the
lookdown,
> > you will set 'where' to a value of 2 because 120 is less than 133
> > which is the 2nd value in the list. Now in the branch
instruction,
> > you use 2 as your offset and you call the 2nd address in the
branch
> > which would be 'label1.' As you see this produces the same result
> as
> > if you ran it through your if/then statements.
> >
> > Hopefully it's clear as mud now, and I'm not screwed up!
> >
> > Later,
> > Tom
> >
> > --- In basicstamps@y..., robert_hiebert@s... wrote:
> > > Hi Tracy,
> > > I studied Lookdown until I swear I could quote it
backwards,
> > > still couldn't make the connection.
> > > Takes an expert. Much appreciated!!
> > >
> > > Regards,
> > > Robert
> > >
> > > --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
> > > > Hi Robert, look into the LOOKDOWN command,
> > > >
> > > > fpx var word
> > > > where var byte
> > > >
> > > > lookdown fpx,<
> > > [noparse][[/noparse]112,133,267,308,420,470,573,622,725,764,876,899],where
> > > > branch where,[noparse][[/noparse]goof,label1,goof,label2,goof,label3,...label6]
> > > > goof: ' not in ranges specified
> > > >
> > > > label1: ' etc etc.
> > > >
> > > > -- best regards
> > > > Tracy Allen
> > > > electronically monitored ecosystems
> > > > http://www.emesystems.com
> > > > mailto:tracy@e...
> > > >
> > > >
> > > > >Hi All,
> > > > > I have a project that I'm using a BS2SX for. It uses 7
of
> > the
> > > 8
> > > > >banks available, and is, at least to me, relatively complex.
I
> > have
> > > > >it to the point that it runs quite well on the bench, but i'd
> > like
> > > to
> > > > >improve on my sample times. The program initializes in bank
0,
> > goes
> > > > >to bank 1 to read an input, then gets sent to the appropriate
> > bank
> > > > >for processing, and returns to bank 1 to begin the loop
again.
> I
> > > put
> > > > >an output in bank 1 which toggles an LED, which I can also
> > monitor
> > > > >with a frequency meter. So far, the best I can get is about
> 3.6
> > hz,
> > > > >so I'm looking for ways I can make things more efficient, and
> > speed
> > > > >things up.
> > > > > The first thing that's troubling me is, I have a series
of
> > > > >if/then statements to evaluate the first input variable. I've
> > read
> > > > >that this can be improved on with a "branch" statement, but I
> > can't
> > > > >figure out how to do it in this application.
> > > > > Here's a snipit, where fpx is the input variable:
> > > > >
> > > > > if (fpx > 111) and (fpx < 133) then lable 1
> > > > > if (fpx > 266) and (fpx < 308) then lable 2
> > > > > if (fpx > 419) and (fpx < 470) then lable 3
> > > > > if (fpx > 572) and (fpx < 622) then lable 4
> > > > > if (fpx > 724) and (fpx < 764) then lable 5
> > > > > if (fpx > 875) and (fpx < 899) then lable 6
> > > > >
> > > > >Any help would be much appreciated.
> > > > >
> > > > >Thanks,
> > > > >Robert
> > > > >
> > > > >
> > > > >
> > > > >To UNSUBSCRIBE, just send mail to:
> > > > > basicstamps-unsubscribe@y...
> > > > >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/