some help with math


Closed Thread
Results 1 to 40 of 65

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: some help with math

    thanks art that works well
    i used an exiting variable for the temp one

    i also did multi if /then statements , which reduced the compile further - those "and " do add up in compile

    i have not seen the command ":" to allow you to put on the same line before btw

    here what works

    cheers

    Sheldon

    Code:
     Show_RF_CH_Select:
     
             gl_y = 8                                           ' show current channel in use on menu heading line  - gl_y = 8  , gl_x= 162,168 
             gl_x= 160                                             
             read $09,val                                       ' get channel ref 
             g_num = val   
             if g_num dig 1 = 0  then                           ' leading 0 supression 
                 gosub put_1dig
                 gl_x = gl_x +6 
                 g_char = " "       ' clear 2nd digit space, case it was used 
                 gosub put_char 
             else
                 gosub put_2dig 
             endif                     
            g_num = 0                                 ' use as temp verable 
             if val < 6 then                          ' if current RF ch = 0-5
                if Menu_Select = 211 then             ' and menu 211
                  g_num = 0                           ' value offset for ch
                  gosub Show_RF_CH_Select_common      ' show  *     * on the selected ch
                endif
             endif    
                                                     
             if val =>6 then                           ' if current RF ch = 6-11
                 if val <= 11 then                     
                   if Menu_Select = 2112 then          ' and on menu 2112
                      g_num = 6                        ' value offset for ch 
                      gosub Show_RF_CH_Select_common
                   endif
                 endif
             endif     
             if val =>12 then                           ' if current RF ch = 6-11
               if Menu_Select = 2113 then           
                   g_num = 12                           ' value offset for ch
                   gosub Show_RF_CH_Select_common       ' show  *     * on the selected ch
               endif
             endif   
     return
     '------------------------------
     Show_RF_CH_Select_common:
        val = 1<<(val-g_num)      ' val = shift right 1 of VAL- Offset RF menu to get   1,2,4,8,16,32 in bit pattern
        gosub Show_current_sel_2  ' show "*   * on selected menu / ch using the bit pattern of VAL 
     return

  2. #2
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: some help with math

    I’m glad if it saved some memory... I made a bigger post but it looks to have disappeared.

Similar Threads

  1. Help with A/D math!
    By dbodenheimer in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 19th March 2011, 00:51
  2. Math help please...
    By Ioannis in forum General
    Replies: 2
    Last Post: - 20th June 2008, 10:18
  3. PBPL Math...new math takes more cycles...Always?
    By skimask in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th February 2008, 10:22
  4. Math help please!!!
    By jbirnsch in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 10th August 2007, 14:45
  5. math help
    By houa in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th January 2006, 16:58

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