Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Feature Request

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
DH*
Guest





Posted: 09 January 2006, 13:51 PM    Post subject: Feature Request Reply with quote

I would like to have a version of WaitForInterrupt that has a timeout parameter.
Back to top
mikep



Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX

Posted: 09 January 2006, 14:19 PM    Post subject: Reply with quote

In the meantime there is another way of doing what you want.

Typically you would do a WaitForInterrupt() inside a separate task so you don't hold up the mainline processing. Application note AN209 (http://www.zbasic.net/appNotes/AN209.pdf) describes how to resume a task. I haven't tried it but I'm sure this will work for WaitForInterrupt().
Back to top
DH*
Guest





Posted: 09 January 2006, 14:45 PM    Post subject: Reply with quote

I had already read AN209 before posting my request. I still prefer a timeout (preferably with an optional jump to a label).

My app was written a few years ago for the original BX-24. I couldn't afford the overhead associated with multiple tasks so never really explored the possibilities.

The additional RAM of the ZX-24 might make multi-tasking more attractive but I have other uses for that extra RAM.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 09 January 2006, 16:18 PM    Post subject: Reply with quote

An extended version of WaitForInterrupt() is on the enhancement list. The form it would most likely take is something similar to the optional timeout on GetQueue(), e.g.
Code:
WaitForInterrupt(trigger, intNum, timeLimit, timeoutFlag)
Back to top
DH*
Guest





Posted: 09 January 2006, 17:01 PM    Post subject: Reply with quote

Thanks, Don.

NetMedia added that to GetQueue at my request but I would have preferred an optional jump to label rather than the TimeOut flag.

On a related subject InputCapture is only useful if you know in advance how many transitions to expect. I'd like an Ex version with min/max values that would cause it to exit, again with a jump to label.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 09 January 2006, 18:00 PM    Post subject: Reply with quote

Quote:
NetMedia added that to GetQueue at my request but I would have preferred an optional jump to label rather than the TimeOut flag.


I suspect that they chose not to implement "jump to label" because of its decidedly unstructured nature. That would be my argument against it as well. If you prefer a GoTo, you can easily implement that by testing the flag. The only advantage that I can see to the "jump to label" implementation is that it would be slightly faster.

On the other hand, designing the API with an implicit GoTo requires everyone to use the unstructured approach. Additionally, although it probably isn't a concern for the BasicX compiler, unstructured control elements like GoTo, Exit, etc. complicate optimization analysis and limit optimization opportunities.
Back to top
DH*
Guest





Posted: 09 January 2006, 20:28 PM    Post subject: Reply with quote

Quote:
The only advantage that I can see to the "jump to label" implementation is that it would be slightly faster.

And maybe take slightly less code. I was looking for every byte I could possibly save since I was up against the limits.
Back to top
DH*
Guest





Posted: 13 January 2006, 16:12 PM    Post subject: Reply with quote

Quote:
The only advantage that I can see to the "jump to label" implementation is that it would be slightly faster.

Slightly faster might be critical in some instances.

Code:
  For n = 0 To bits
    Register.TCCR1A = 0                          'reset Timer1
    Register.TCNT1H = 0
    Register.TCNT1L = 0
    Register.TIFR = bx0000_0100                  'TOV1
    Register.TCCR1B = 2                          'start Timer1
    Call WaitForInterrupt(1) 
    'THERE MAY NOT BE TIME TO TEST FOR TIMEOUT HERE
    PulseTrain(n) = MakeWord(Register.TCNT1L, Register.TCNT1H)
    If (PulseTrain(n) < 800) Or (PulseTrain(n) > 4000) Then     
      Exit Sub
    End If
  Next
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group