Shop OBEX P1 Docs P2 Docs Learn Events
Vb and stamp Rc time — Parallax Forums

Vb and stamp Rc time

ArchiverArchiver Posts: 46,084
edited 2003-07-14 18:22 in General Discussion
Hi group:

From: Jimmy
I am building a shiting simulator for a driving school for 18 wheelers I
have got the whole thing working except the analog input I need to monitor 2
analog inputs one for tac and the other clutch to make sure they hit the
friction point each time and to make sure the rpm is not to high or low I am
thinking about using rc time in my code and please bear with me I have a dumb
question if I put this in a loop in the bs2 how can I get the processor to loop
at other loops conditional branch or if then but I need both loops to run
together I realize this processor is not multitasking but this project does not
really need high speed just 2 loops running together any Ideas and thanks for
all your help.Happy stamping. jimmy


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-07-14 15:22
    Hi Jimmy,

    Sure hope you mean "shifting" (sorry).

    I would think you could use RCTime and just read both inputs, do your
    processing, and go again, right? So:

    Loop:
    do RC #1
    do RC #2
    do computations
    goto loop

    I'm not sure if that's the gist of your question or not.

    Al Williams
    AWC
    * Floating point A/D
    http://www.al-williams.com/awce/pak9.htm



    >
    Original Message
    > From: frog28043 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=_Nc8vfl_-Ai--RdXc1CT9UZNAvK9OnNG57dA_x_3083BYZGSX60leVxF1VhvmVXkXzhYLCL1cVbo]frog28043@y...[/url
    > Sent: Monday, July 14, 2003 9:14 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    >
    >
    > Hi group:
    >
    > From: Jimmy
    > I am building a shiting simulator for a driving school
    > for 18 wheelers I have got the whole thing working except the
    > analog input I need to monitor 2 analog inputs one for tac
    > and the other clutch to make sure they hit the friction point
    > each time and to make sure the rpm is not to high or low I am
    > thinking about using rc time in my code and please bear with
    > me I have a dumb question if I put this in a loop in the bs2
    > how can I get the processor to loop at other loops
    > conditional branch or if then but I need both loops to run
    > together I realize this processor is not multitasking but
    > this project does not really need high speed just 2 loops
    > running together any Ideas and thanks for all your help.Happy
    > stamping. jimmy
    >
    >
    >
    > Do you Yahoo!?
    > SBC Yahoo! DSL - Now only $29.95 per month!
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > 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/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-14 15:53
    oops sorry for the typo guys didnt check spelling!!!!!!!

    Al Williams <alw@a...> wrote:Hi Jimmy,

    Sure hope you mean "shifting" (sorry).

    I would think you could use RCTime and just read both inputs, do your
    processing, and go again, right? So:

    Loop:
    do RC #1
    do RC #2
    do computations
    goto loop

    I'm not sure if that's the gist of your question or not.

    Al Williams
    AWC
    * Floating point A/D
    http://www.al-williams.com/awce/pak9.htm



    >
    Original Message
    > From: frog28043 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=cLaUPX5gNoSdlpH23YXjyTdCZPeAN-P7ihbPIBmPrvGM3ziM3dTb9WLTUXdjwMedpj5746NJZj73l2xk_dY]frog28043@y...[/url
    > Sent: Monday, July 14, 2003 9:14 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    >
    >
    > Hi group:
    >
    > From: Jimmy
    > I am building a shiting simulator for a driving school
    > for 18 wheelers I have got the whole thing working except the
    > analog input I need to monitor 2 analog inputs one for tac
    > and the other clutch to make sure they hit the friction point
    > each time and to make sure the rpm is not to high or low I am
    > thinking about using rc time in my code and please bear with
    > me I have a dumb question if I put this in a loop in the bs2
    > how can I get the processor to loop at other loops
    > conditional branch or if then but I need both loops to run
    > together I realize this processor is not multitasking but
    > this project does not really need high speed just 2 loops
    > running together any Ideas and thanks for all your help.Happy
    > stamping. jimmy
    >
    >
    >
    > Do you Yahoo!?
    > SBC Yahoo! DSL - Now only $29.95 per month!
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > 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/




    Do you Yahoo!?
    SBC Yahoo! DSL - Now only $29.95 per month!

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-14 15:55
    Let me expand on Al's psuedo-code:

    Main:
    Do_Important_Stuff
    ON task GOSUB Get_RC1, Get_RC2, Do_Another_Task
    Update task pointer
    GOTO Main

    This structure let's you handle important stuff and divide *background*
    items into managable chunks -- a different chunk will run through each
    iteration of the loop. This

    And -- at the risk of sounding persnickety [noparse][[/noparse]I can't believe I'm actually
    using that word] -- LOOP is now a PBASIC keyword (when using PBASIC 2.5
    syntax) and should not be used as a label.

    -- Jon Williams
    -- Parallax


    Original Message
    From: Al Williams
    Sent: Monday, July 14, 2003 9:23 AM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Vb and stamp Rc time


    Hi Jimmy,

    Sure hope you mean "shifting" (sorry).

    I would think you could use RCTime and just read both inputs, do your
    processing, and go again, right? So:

    Loop:
    do RC #1
    do RC #2
    do computations
    goto loop

    I'm not sure if that's the gist of your question or not.

    Al Williams
    AWC
    * Floating point A/D
    http://www.al-williams.com/awce/pak9.htm



    >
    Original Message
    > From: frog28043 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=8m9HN9CrVpwf_BzLxht18mF3SX0uSI6UYe5EpoeylWgab1pm2Uf48psFX4tj0w1YO03zTmskzJkCbWDs]frog28043@y...[/url
    > Sent: Monday, July 14, 2003 9:14 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    >
    >
    > Hi group:
    >
    > From: Jimmy
    > I am building a shiting simulator for a driving school for 18
    > wheelers I have got the whole thing working except the analog input I
    > need to monitor 2 analog inputs one for tac and the other clutch to
    > make sure they hit the friction point each time and to make sure the
    > rpm is not to high or low I am thinking about using rc time in my code

    > and please bear with me I have a dumb question if I put this in a loop

    > in the bs2 how can I get the processor to loop at other loops
    > conditional branch or if then but I need both loops to run
    > together I realize this processor is not multitasking but
    > this project does not really need high speed just 2 loops
    > running together any Ideas and thanks for all your help.Happy
    > stamping. jimmy
    >
    >
    >
    > Do you Yahoo!?
    > SBC Yahoo! DSL - Now only $29.95 per month!
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > 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/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-14 15:57
    Al ! I was just thinking they were crappy drivers

    Larry Gaminde



    Original Message
    From: "Al Williams" <alw@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: July 14, 2003 7:22 AM
    Subject: RE: [noparse][[/noparse]basicstamps] Vb and stamp Rc time


    > Hi Jimmy,
    >
    > Sure hope you mean "shifting" (sorry).
    >
    > I would think you could use RCTime and just read both inputs, do your
    > processing, and go again, right? So:
    >
    > Loop:
    > do RC #1
    > do RC #2
    > do computations
    > goto loop
    >
    > I'm not sure if that's the gist of your question or not.
    >
    > Al Williams
    > AWC
    > * Floating point A/D
    > http://www.al-williams.com/awce/pak9.htm
    >
    >
    >
    > >
    Original Message
    > > From: frog28043 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Cl9re_HyAs7w8XXoEPOIvr_Lr2PYWjYv1wQWdXEy6C4Y6rz0D1C6cJ-e73e4ry9JpbiQs1evW1cRN57Lsw]frog28043@y...[/url
    > > Sent: Monday, July 14, 2003 9:14 AM
    > > To: basicstamps@yahoogroups.com
    > > Subject: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    > >
    > >
    > > Hi group:
    > >
    > > From: Jimmy
    > > I am building a shiting simulator for a driving school
    > > for 18 wheelers I have got the whole thing working except the
    > > analog input I need to monitor 2 analog inputs one for tac
    > > and the other clutch to make sure they hit the friction point
    > > each time and to make sure the rpm is not to high or low I am
    > > thinking about using rc time in my code and please bear with
    > > me I have a dumb question if I put this in a loop in the bs2
    > > how can I get the processor to loop at other loops
    > > conditional branch or if then but I need both loops to run
    > > together I realize this processor is not multitasking but
    > > this project does not really need high speed just 2 loops
    > > running together any Ideas and thanks for all your help.Happy
    > > stamping. jimmy
    > >
    > >
    > >
    > > Do you Yahoo!?
    > > SBC Yahoo! DSL - Now only $29.95 per month!
    > >
    > > [noparse][[/noparse]Non-text portions of this message have been removed]
    > >
    > >
    > > 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/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-14 16:33
    And to expand a little more:
    This uses 'TaskID' and the 'BRANCH' statement
    to do three 'tasks', then wait 100 mS and do
    them all again.

    This code can be condensed a little,
    (The TaskID cycle can be simplified
    using the 'mod' operator) but this
    is a general expression.

    TaskID VAR BYTE
    MaxTask CON 3

    TaskID = MaxTask
    MAIN:
    Do_Important_Stuff
    TaskID = TaskID + 1
    IF TaskID >= MaxTask THEN Skip1
    ' ELSE
    TaskID = 0
    Skip1:
    BRANCH TaskID, [noparse][[/noparse]DoTask1, DoTask2, DoTask3]
    ' DoTask1 'GOTO' when TaskID == 0

    MainContinue:
    IF TaskID = (MaxTask-1) THEN Main ' do three rapidly
    PAUSE 100 ' THEN pause...
    GOTO MAIN

    ' Tasks...
    DoTask1:
    Do_Stuff
    GOTO MainContinue

    DoTask2:
    Do_OtherStuff
    GOTO MainContinue

    DoTask3:
    Do_YetOtherStuff
    GOTO MainContinue

    END


    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    wrote:
    > Let me expand on Al's psuedo-code:
    >
    > Main:
    > Do_Important_Stuff
    > ON task GOSUB Get_RC1, Get_RC2, Do_Another_Task
    > Update task pointer
    > GOTO Main
    >
    > This structure let's you handle important stuff and divide
    *background*
    > items into managable chunks -- a different chunk will run through
    each
    > iteration of the loop. This
    >
    > And -- at the risk of sounding persnickety [noparse][[/noparse]I can't believe I'm
    actually
    > using that word] -- LOOP is now a PBASIC keyword (when using PBASIC
    2.5
    > syntax) and should not be used as a label.
    >
    > -- Jon Williams
    > -- Parallax
    >
    >
    >
    Original Message
    > From: Al Williams
    > Sent: Monday, July 14, 2003 9:23 AM
    > To: basicstamps@yahoogroups.com
    > Subject: RE: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    >
    >
    > Hi Jimmy,
    >
    > Sure hope you mean "shifting" (sorry).
    >
    > I would think you could use RCTime and just read both inputs, do
    your
    > processing, and go again, right? So:
    >
    > Loop:
    > do RC #1
    > do RC #2
    > do computations
    > goto loop
    >
    > I'm not sure if that's the gist of your question or not.
    >
    > Al Williams
    > AWC
    > * Floating point A/D
    > http://www.al-williams.com/awce/pak9.htm
    >
    >
    >
    > >
    Original Message
    > > From: frog28043 [noparse][[/noparse]mailto:frog28043@y...]
    > > Sent: Monday, July 14, 2003 9:14 AM
    > > To: basicstamps@yahoogroups.com
    > > Subject: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    > >
    > >
    > > Hi group:
    > >
    > > From: Jimmy
    > > I am building a shiting simulator for a driving school for 18
    > > wheelers I have got the whole thing working except the analog
    input I
    > > need to monitor 2 analog inputs one for tac and the other clutch
    to
    > > make sure they hit the friction point each time and to make sure
    the
    > > rpm is not to high or low I am thinking about using rc time in my
    code
    >
    > > and please bear with me I have a dumb question if I put this in a
    loop
    >
    > > in the bs2 how can I get the processor to loop at other loops
    > > conditional branch or if then but I need both loops to run
    > > together I realize this processor is not multitasking but
    > > this project does not really need high speed just 2 loops
    > > running together any Ideas and thanks for all your help.Happy
    > > stamping. jimmy
    > >
    > >
    > >
    > > Do you Yahoo!?
    > > SBC Yahoo! DSL - Now only $29.95 per month!
    > >
    > > [noparse][[/noparse]Non-text portions of this message have been removed]
    > >
    > >
    > > 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/
    >
    >
    >
    >
    > This message has been scanned by WebShield. Please report SPAM to
    > abuse@p...
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-14 17:06
    I personally favor ON task GOSUB over BRANCH these days because it means
    I don't have to direct my tasks back to another label -- the return is
    handled by the GOSUB. And, by structuring tasks as subroutines, they
    can be called from any point in the program; even from each other if the
    situation warrants.

    MaxTask CON 3
    taskID VAR Byte

    Main:
    Do_Important_Stuff
    ON taskID GOSUB Task0, Task1, Task2
    task = task + 1 // MaxTask ' point to next task;
    auto wrap to zero
    GOTO Main

    Task0:
    Do_Task_Stuff
    RETURN

    Task1:
    Do_Task_Stuff
    RETURN

    Task2:
    Do_Task_Stuff
    RETURN


    This is a fairly simple structure. If we move the taskID update to the
    task code, the program can be much more dynamic in it's operation --
    this is particularly useful in robotics.


    MaxTask CON 3
    taskID VAR Byte

    Main:
    Do_Important_Stuff
    ON taskID GOSUB Task0, Task1, Task2
    GOTO Main

    Task0:
    Do_Task_Stuff
    IF (some_condition) THEN
    taskID = new_task ' run conditional next
    task
    ELSE
    task = task + 1 // MaxTask ' run *normal* next task
    ENDIF
    RETURN

    Task1:
    Do_Task_Stuff
    IF (some_condition) THEN
    taskID = new_task
    ELSE
    task = task + 1 // MaxTask
    ENDIF
    RETURN

    Task2:
    Do_Task_Stuff
    IF (some_condition) THEN
    taskID = new_task
    ELSE
    task = task + 1 // MaxTask
    ENDIF
    RETURN


    -- Jon Williams
    -- Parallax


    Original Message
    From: Allan Lane [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=yA-QukNZhUMdjeRiElrp3Z7ZjOebR2_DVMi5yPKtfZ0M4McG_EuxbnYz75n4AQ4N26i2ogIcOn9ghNK_ivekmxyO]allan.lane@h...[/url
    Sent: Monday, July 14, 2003 10:34 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Re: Vb and stamp Rc time


    And to expand a little more:
    This uses 'TaskID' and the 'BRANCH' statement
    to do three 'tasks', then wait 100 mS and do
    them all again.

    This code can be condensed a little,
    (The TaskID cycle can be simplified
    using the 'mod' operator) but this
    is a general expression.

    TaskID VAR BYTE
    MaxTask CON 3

    TaskID = MaxTask
    MAIN:
    Do_Important_Stuff
    TaskID = TaskID + 1
    IF TaskID >= MaxTask THEN Skip1
    ' ELSE
    TaskID = 0
    Skip1:
    BRANCH TaskID, [noparse][[/noparse]DoTask1, DoTask2, DoTask3]
    ' DoTask1 'GOTO' when TaskID == 0

    MainContinue:
    IF TaskID = (MaxTask-1) THEN Main ' do three rapidly
    PAUSE 100 ' THEN pause...
    GOTO MAIN

    ' Tasks...
    DoTask1:
    Do_Stuff
    GOTO MainContinue

    DoTask2:
    Do_OtherStuff
    GOTO MainContinue

    DoTask3:
    Do_YetOtherStuff
    GOTO MainContinue

    END


    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    wrote:
    > Let me expand on Al's psuedo-code:
    >
    > Main:
    > Do_Important_Stuff
    > ON task GOSUB Get_RC1, Get_RC2, Do_Another_Task
    > Update task pointer
    > GOTO Main
    >
    > This structure let's you handle important stuff and divide
    *background*
    > items into managable chunks -- a different chunk will run through
    each
    > iteration of the loop. This
    >
    > And -- at the risk of sounding persnickety [noparse][[/noparse]I can't believe I'm
    actually
    > using that word] -- LOOP is now a PBASIC keyword (when using PBASIC
    2.5
    > syntax) and should not be used as a label.
    >
    > -- Jon Williams
    > -- Parallax
    >
    >
    >
    Original Message
    > From: Al Williams
    > Sent: Monday, July 14, 2003 9:23 AM
    > To: basicstamps@yahoogroups.com
    > Subject: RE: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    >
    >
    > Hi Jimmy,
    >
    > Sure hope you mean "shifting" (sorry).
    >
    > I would think you could use RCTime and just read both inputs, do
    your
    > processing, and go again, right? So:
    >
    > Loop:
    > do RC #1
    > do RC #2
    > do computations
    > goto loop
    >
    > I'm not sure if that's the gist of your question or not.
    >
    > Al Williams
    > AWC
    > * Floating point A/D
    > http://www.al-williams.com/awce/pak9.htm
    >
    >
    >
    > >
    Original Message
    > > From: frog28043 [noparse][[/noparse]mailto:frog28043@y...]
    > > Sent: Monday, July 14, 2003 9:14 AM
    > > To: basicstamps@yahoogroups.com
    > > Subject: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    > >
    > >
    > > Hi group:
    > >
    > > From: Jimmy
    > > I am building a shiting simulator for a driving school for 18
    > > wheelers I have got the whole thing working except the analog
    input I
    > > need to monitor 2 analog inputs one for tac and the other clutch
    to
    > > make sure they hit the friction point each time and to make sure
    the
    > > rpm is not to high or low I am thinking about using rc time in my
    code
    >
    > > and please bear with me I have a dumb question if I put this in a
    loop
    >
    > > in the bs2 how can I get the processor to loop at other loops
    > > conditional branch or if then but I need both loops to run together
    > > I realize this processor is not multitasking but this project does
    > > not really need high speed just 2 loops running together any Ideas
    > > and thanks for all your help.Happy stamping. jimmy
    > >
    > >
    > >
    > > Do you Yahoo!?
    > > SBC Yahoo! DSL - Now only $29.95 per month!
    > >
    > > [noparse][[/noparse]Non-text portions of this message have been removed]
    > >
    > >
    > > 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/
    >
    >
    >
    >
    > This message has been scanned by WebShield. Please report SPAM to
    > abuse@p...


    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/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-14 17:51
    A) Well, it seems like he needs to get both RC's to do his work, not
    that he wants to do two separate quasi-tasks. Not sure though.

    B) Yeah, I need to get a copy of the new compiler I suppose. When will
    it be release and not beta?

    Al Williams
    AWC
    * NEW: PAK-VIa - Read PS/2 keyboards or mice -- double the buffer, lower
    current consumption.
    http://www.al-williams.com/awce/pak6.htm




    >
    Original Message
    > From: Jon Williams [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=J_ZLs3GKmexjFAv7vVnLIxXenmzwBa1QcDHpxUDnUgXTOJ5weno34a_WJaGQNsRt4npjcHbn951q8W-vqw]jwilliams@p...[/url
    > Sent: Monday, July 14, 2003 9:56 AM
    > To: basicstamps@yahoogroups.com
    > Subject: RE: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    >
    >
    > Let me expand on Al's psuedo-code:
    >
    > Main:
    > Do_Important_Stuff
    > ON task GOSUB Get_RC1, Get_RC2, Do_Another_Task
    > Update task pointer
    > GOTO Main
    >
    > This structure let's you handle important stuff and divide
    > *background* items into managable chunks -- a different chunk
    > will run through each iteration of the loop. This
    >
    > And -- at the risk of sounding persnickety [noparse][[/noparse]I can't believe
    > I'm actually using that word] -- LOOP is now a PBASIC keyword
    > (when using PBASIC 2.5
    > syntax) and should not be used as a label.
    >
    > -- Jon Williams
    > -- Parallax
    >
    >
    >
    Original Message
    > From: Al Williams
    > Sent: Monday, July 14, 2003 9:23 AM
    > To: basicstamps@yahoogroups.com
    > Subject: RE: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    >
    >
    > Hi Jimmy,
    >
    > Sure hope you mean "shifting" (sorry).
    >
    > I would think you could use RCTime and just read both inputs,
    > do your processing, and go again, right? So:
    >
    > Loop:
    > do RC #1
    > do RC #2
    > do computations
    > goto loop
    >
    > I'm not sure if that's the gist of your question or not.
    >
    > Al Williams
    > AWC
    > * Floating point A/D
    > http://www.al-williams.com/awce/pak9.htm
    >
    >
    >
    > >
    Original Message
    > > From: frog28043 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=tMSKS6pNkolkN-kAQ-hN4JRDop6wQRhycmrW331gTKvgR8rpnqYo1sCDmo8WhNtjAnaniTTWKX14uaIPZnc]frog28043@y...[/url
    > > Sent: Monday, July 14, 2003 9:14 AM
    > > To: basicstamps@yahoogroups.com
    > > Subject: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    > >
    > >
    > > Hi group:
    > >
    > > From: Jimmy
    > > I am building a shiting simulator for a driving school for 18
    > > wheelers I have got the whole thing working except the
    > analog input I
    > > need to monitor 2 analog inputs one for tac and the other clutch to
    > > make sure they hit the friction point each time and to make
    > sure the
    > > rpm is not to high or low I am thinking about using rc time
    > in my code
    >
    > > and please bear with me I have a dumb question if I put
    > this in a loop
    >
    > > in the bs2 how can I get the processor to loop at other loops
    > > conditional branch or if then but I need both loops to run
    > together I
    > > realize this processor is not multitasking but this project
    > does not
    > > really need high speed just 2 loops running together any Ideas and
    > > thanks for all your help.Happy stamping. jimmy
    > >
    > >
    > >
    > > Do you Yahoo!?
    > > SBC Yahoo! DSL - Now only $29.95 per month!
    > >
    > > [noparse][[/noparse]Non-text portions of this message have been removed]
    > >
    > >
    > > 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/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....




    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/
  • ArchiverArchiver Posts: 46,084
    edited 2003-07-14 18:22
    Agreed, I prefer GOSUB's myself.
    The only reason I would use the
    'BRANCH' version is that it is 'native'
    2.0 PBasic. Once the 2.5 PBasic becomes an
    'alpha' version, I'll use it. Even then,
    there's a lot of 2.0 code out there.

    And your point about changing/incrementing
    the 'TaskID' state variable inside the Tasks
    does give you lots of flexibility with
    how often tasks repeat, or what task runs
    next. I would use it sparingly, though,
    or you'll have the 'spagetti' factor --
    it becomes hard to know what SHOULD
    execute next -- which becomes hard to debug.

    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    wrote:
    > I personally favor ON task GOSUB over BRANCH these days because it
    means
    > I don't have to direct my tasks back to another label -- the return
    is
    > handled by the GOSUB. And, by structuring tasks as subroutines,
    they
    > can be called from any point in the program; even from each other
    if the
    > situation warrants.
    >
    > MaxTask CON 3
    > taskID VAR Byte
    >
    > Main:
    > Do_Important_Stuff
    > ON taskID GOSUB Task0, Task1, Task2
    > task = task + 1 // MaxTask ' point to next task;
    > auto wrap to zero
    > GOTO Main
    >
    > Task0:
    > Do_Task_Stuff
    > RETURN
    >
    > Task1:
    > Do_Task_Stuff
    > RETURN
    >
    > Task2:
    > Do_Task_Stuff
    > RETURN
    >
    >
    > This is a fairly simple structure. If we move the taskID update to
    the
    > task code, the program can be much more dynamic in it's operation --
    > this is particularly useful in robotics.
    >
    >
    > MaxTask CON 3
    > taskID VAR Byte
    >
    > Main:
    > Do_Important_Stuff
    > ON taskID GOSUB Task0, Task1, Task2
    > GOTO Main
    >
    > Task0:
    > Do_Task_Stuff
    > IF (some_condition) THEN
    > taskID = new_task ' run conditional next
    > task
    > ELSE
    > task = task + 1 // MaxTask ' run *normal* next
    task
    > ENDIF
    > RETURN
    >
    > Task1:
    > Do_Task_Stuff
    > IF (some_condition) THEN
    > taskID = new_task
    > ELSE
    > task = task + 1 // MaxTask
    > ENDIF
    > RETURN
    >
    > Task2:
    > Do_Task_Stuff
    > IF (some_condition) THEN
    > taskID = new_task
    > ELSE
    > task = task + 1 // MaxTask
    > ENDIF
    > RETURN
    >
    >
    > -- Jon Williams
    > -- Parallax
    >
    >
    >
    Original Message
    > From: Allan Lane [noparse][[/noparse]mailto:allan.lane@h...]
    > Sent: Monday, July 14, 2003 10:34 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Re: Vb and stamp Rc time
    >
    >
    > And to expand a little more:
    > This uses 'TaskID' and the 'BRANCH' statement
    > to do three 'tasks', then wait 100 mS and do
    > them all again.
    >
    > This code can be condensed a little,
    > (The TaskID cycle can be simplified
    > using the 'mod' operator) but this
    > is a general expression.
    >
    > TaskID VAR BYTE
    > MaxTask CON 3
    >
    > TaskID = MaxTask
    > MAIN:
    > Do_Important_Stuff
    > TaskID = TaskID + 1
    > IF TaskID >= MaxTask THEN Skip1
    > ' ELSE
    > TaskID = 0
    > Skip1:
    > BRANCH TaskID, [noparse][[/noparse]DoTask1, DoTask2, DoTask3]
    > ' DoTask1 'GOTO' when TaskID == 0
    >
    > MainContinue:
    > IF TaskID = (MaxTask-1) THEN Main ' do three rapidly
    > PAUSE 100 ' THEN pause...
    > GOTO MAIN
    >
    > ' Tasks...
    > DoTask1:
    > Do_Stuff
    > GOTO MainContinue
    >
    > DoTask2:
    > Do_OtherStuff
    > GOTO MainContinue
    >
    > DoTask3:
    > Do_YetOtherStuff
    > GOTO MainContinue
    >
    > END
    >
    >
    > --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    > wrote:
    > > Let me expand on Al's psuedo-code:
    > >
    > > Main:
    > > Do_Important_Stuff
    > > ON task GOSUB Get_RC1, Get_RC2, Do_Another_Task
    > > Update task pointer
    > > GOTO Main
    > >
    > > This structure let's you handle important stuff and divide
    > *background*
    > > items into managable chunks -- a different chunk will run through
    > each
    > > iteration of the loop. This
    > >
    > > And -- at the risk of sounding persnickety [noparse][[/noparse]I can't believe I'm
    > actually
    > > using that word] -- LOOP is now a PBASIC keyword (when using
    PBASIC
    > 2.5
    > > syntax) and should not be used as a label.
    > >
    > > -- Jon Williams
    > > -- Parallax
    > >
    > >
    > >
    Original Message
    > > From: Al Williams
    > > Sent: Monday, July 14, 2003 9:23 AM
    > > To: basicstamps@yahoogroups.com
    > > Subject: RE: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    > >
    > >
    > > Hi Jimmy,
    > >
    > > Sure hope you mean "shifting" (sorry).
    > >
    > > I would think you could use RCTime and just read both inputs, do
    > your
    > > processing, and go again, right? So:
    > >
    > > Loop:
    > > do RC #1
    > > do RC #2
    > > do computations
    > > goto loop
    > >
    > > I'm not sure if that's the gist of your question or not.
    > >
    > > Al Williams
    > > AWC
    > > * Floating point A/D
    > > http://www.al-williams.com/awce/pak9.htm
    > >
    > >
    > >
    > > >
    Original Message
    > > > From: frog28043 [noparse][[/noparse]mailto:frog28043@y...]
    > > > Sent: Monday, July 14, 2003 9:14 AM
    > > > To: basicstamps@yahoogroups.com
    > > > Subject: [noparse][[/noparse]basicstamps] Vb and stamp Rc time
    > > >
    > > >
    > > > Hi group:
    > > >
    > > > From: Jimmy
    > > > I am building a shiting simulator for a driving school for
    18
    > > > wheelers I have got the whole thing working except the analog
    > input I
    > > > need to monitor 2 analog inputs one for tac and the other clutch
    > to
    > > > make sure they hit the friction point each time and to make sure
    > the
    > > > rpm is not to high or low I am thinking about using rc time in
    my
    > code
    > >
    > > > and please bear with me I have a dumb question if I put this in
    a
    > loop
    > >
    > > > in the bs2 how can I get the processor to loop at other loops
    > > > conditional branch or if then but I need both loops to run
    together
    > > > I realize this processor is not multitasking but this project
    does
    > > > not really need high speed just 2 loops running together any
    Ideas
    > > > and thanks for all your help.Happy stamping. jimmy
    > > >
    > > >
    > > >
    > > > Do you Yahoo!?
    > > > SBC Yahoo! DSL - Now only $29.95 per month!
    > > >
    > > > [noparse][[/noparse]Non-text portions of this message have been removed]
    > > >
    > > >
    > > > 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/
    > >
    > >
    > >
    > >
    > > This message has been scanned by WebShield. Please report SPAM to
    > > abuse@p...
    >
    >
    > 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/
    >
    >
    >
    >
    > This message has been scanned by WebShield. Please report SPAM to
    > abuse@p...
Sign In or Register to comment.