touble with a time calculation


Closed Thread
Results 1 to 40 of 59

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: touble with a time calculation

    EL2_Allow is a Var bit , atm , and that code would require it to become VAR byte , i am getting very full on this chip and every byte less in mem is a good move ,

    i am thinking since the value i am looking for is either 0 or 1 , can i leave the variable as a BIT , even though values higher than 1 are going to occur ?

  2. #2
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: touble with a time calculation

    Quote Originally Posted by longpole001 View Post
    EL2_Allow is a Var bit , atm , and that code would require it to become VAR byte , i am getting very full on this chip and every byte less in mem is a good move
    Tight for space is a very good reason to make the code more efficient.

    Obviously you have a routine that sets the time could you set the EL2_Allow and other "flags" within that code. I am thinking that at present the same comparisons are made multiple times in different places.

    I am also led to believe that compound statements are inefficient.

    Code:
    EL2_Allow =  0
    EL2_Allow =  EL2_Allow + Event1_OT_Day
                        EL2_Allow + Event1_OT_hour 
                        EL2_Allow + Event1_OT_Min         ' if all values are 0 , then don't enable the overrun timer 
                        EL2_Allow + Event1_OT_sec 
                        EL2_Allow + Event1_OT_100th
    is more efficient than

    Code:
    EL2_Allow =  Event1_OT_Day + _
                        Event1_OT_hour + _
                        Event1_OT_Min + _            ' if all values are 0 , then don't enable the overrun timer 
                        Event1_OT_sec + _
                        Event1_OT_100th
    can you explore this idea by trying both ways. This is food for thought for both of us which is very interesting.

Similar Threads

  1. Help with calculation
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th August 2012, 17:10
  2. CHECKSUM CALCULATION, Please Help!
    By wasilus in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd August 2012, 07:55
  3. Calculation Problem - value goes to zero after 65
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 12th March 2010, 05:10
  4. calculation
    By lerameur in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 20th May 2008, 16:28
  5. CRC Calculation - Need a little help
    By Steve43 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 13th March 2005, 01:23

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