a simple boxe timer (code included)


Closed Thread
Results 1 to 25 of 25

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    COOL.
    Do you have the Pic Basic code so folks around here can work with it?
    Dave
    Always wear safety glasses while programming.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    COOL.
    Do you have the Pic Basic code so folks around here can work with it?
    It's in the zip file...and it looks a bit goofy to me (But that's just me. It doesn't have near enough colons in it )

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    It's in the zip file...and it looks a bit goofy to me (But that's just me. It doesn't have near enough colons in it )
    Gotta get new glasses. Did not see it.

    Colons-- Definitely needs a re-write

    hozone, thanks for sharing.
    Dave
    Always wear safety glasses while programming.

  4. #4
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    The project looks good

    Avoid this coding style though ...
    Code:
        If (b1 <= 255 And b1 >= 243) Then
            timerN = 1
            timerAc = 600
            timerBc = 180
        End If
        If (b1 <= 242 And b1 >= 219) Then
            timerN = 2
            timerAc = 180
            timerBc = 60
        End If
        If (b1 <= 218 And b1 >= 193) Then
            timerN = 3
            timerAc = 120
            timerBc = 60
        End If
    Very inefficient. Suggest rethinking your schema using a "Select Case" structure. No need for the logical AND operator at all. Put your thinking cap on and you should be able to reduce the size of the code by half!

    Regards,

    Trent Jackson

  5. #5
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Jeremy will correct it for you. If he does his IQ is 120+

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by T.Jackson View Post
    Jeremy will correct it for you. If he does his IQ is 120+
    Already did...down to 38 lines. But since nobody else can read it, decided not to post it...and didn't use select case. Those numbers aren't linear, but they're close enough to do some math on to get the desired results...thereby resulting in a simple single if/then/endif 3-line statement to handle all those if/then's.

  7. #7
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Can you post a readable example using either IF's or Select Case?

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. Replies: 5
    Last Post: - 24th February 2009, 18:55
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. Interrupt/timer not really interrupting...
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd May 2005, 22:05
  5. Timer Accuracy
    By GEEZER in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 31st March 2005, 05:26

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts