select case question


Results 1 to 7 of 7

Threaded View

  1. #4
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91


    Did you find this post helpful? Yes | No

    Default success so far

    Thanks again Sougata, I pondered your suggestion for a while and what I came up with works exactly as I wanted it to. I'm not sure if I did it entirely as you were suggesting.
    Here is the Select case code I ended up with. It works like a "leap frog" over the unflagged alarms and into the flagged ones. If you or anyone for that matter see a better way, I'm here to learn. I know I've seen a post by Darryl Taylor on sending strings to an LCD. I'm going to look for it to see if it could apply here.

    Code:
    showonlcd:
    
    select case display
                                        
                Case 1                 
                       
                       display = display + 1
                       gosub read_maintemp
                       INTCON.7 = 0
                       Serout2 thelcd,Baud, [I,clr]
                       Serout2 thelcd,Baud, [I,130,"MAIN TANK TEMP"]
                       Serout2 thelcd,Baud, [I,196,#(AD_Result/100),".",#(AD_Result//100),4," ","C"]
                       AD_Result = 0
                       INTCON.7 = 1
                       low buzzer
                case 6                 
                       
                       display = display + 1
                       gosub read_qttemp
                       INTCON.7 = 0
                       Serout2 thelcd,Baud, [I,clr]
                       Serout2 thelcd,Baud, [I,130,"Q/T TANK TEMP"]
                       Serout2 thelcd,Baud, [I,196,#(AD_Result/100),".",#(AD_Result//100),4," ","C"]
                       AD_Result = 0
                       INTCON.7 = 1
                       
                Case 11
                       display = display + 1
                       if trouble = 0 then 
                       INTCON.7 = 0
                       Serout2 thelcd,Baud, [I,clr]
                       Serout2 thelcd,Baud, [I,132,"    SYSTEM"]
                       Serout2 thelcd,Baud, [I,196,"NORMAL"]
                       INTCON.7 = 1
                       looplength = 15
                     else   
                         display = 16
                         looplength = 21
                     ENDIF
                 Case 16       
                        display = display + 1
                        holding = trouble.0
                        if holding = 1 then  
                        INTCON.7 = 0
                        Serout2 thelcd,Baud, [I,clr]
                        Serout2 thelcd,Baud, [I,130,"MAIN TANK TEMP"]
                        Serout2 thelcd,Baud, [I,197,"ALARM"]
                        INTCON.7 = 1
                        trouble.0 = 0
                        looplength = 22
                     else
                         display = 21
                         looplength = 26
                     ENDIF 
                Case 21       
                        display = display + 1
                        holding = trouble.1
                        if holding = 1 then  
                        INTCON.7 = 0
                        Serout2 thelcd,Baud, [I,clr]
                        Serout2 thelcd,Baud, [I,130,"Q/T TANK TEMP"]
                        Serout2 thelcd,Baud, [I,194,"ALARM"]
                        INTCON.7 = 1
                        trouble.1 = 0
                        looplength = 27
                     else
                         display = 26
                         looplength = 31
                     ENDIF      
                Case 26       
                        display = display + 1
                        holding = trouble.2
                        if holding = 1 then  
                        INTCON.7 = 0
                        Serout2 thelcd,Baud, [I,clr]
                        Serout2 thelcd,Baud, [I,130,"MAIN TANK "]
                        Serout2 thelcd,Baud, [I,194,"SKIMMER ALARM"]
                        INTCON.7 = 1
                        trouble.2 = 0
                        looplength = 32
                     else
                         display = 31
                         looplength = 36
                     ENDIF 
                 Case 31       
                        display = display + 1
                        holding = trouble.3
                        if holding = 1 then  
                        INTCON.7 = 0
                        Serout2 thelcd,Baud, [I,clr]
                        Serout2 thelcd,Baud, [I,130,"MAIN TANK RETURN"]
                        Serout2 thelcd,Baud, [I,196,"PUMP ALARM"]
                        INTCON.7 = 1
                        trouble.3 = 0
                        looplength = 37
                     else
                         display = 36
                         looplength = 41
                     ENDIF 
                   Case 36       
                        display = display + 1
                        holding = trouble.4
                        if holding = 1 then  
                        INTCON.7 = 0
                        Serout2 thelcd,Baud, [I,clr]
                        Serout2 thelcd,Baud, [I,130,"WATER LEAK"]
                        Serout2 thelcd,Baud, [I,196,"ALARM"]
                        INTCON.7 = 1
                        trouble.4 = 0
                        looplength = 42
                     else
                         display = 41
                         looplength = 46
                     ENDIF 
    end select
                       
                       if display = looplength then
                       display = 0
                       looplength = 16
                      ENDIF 
    RETURN 
    goto mainloop
    Thanks all for the continued support.
    Last edited by Archangel; - 19th September 2015 at 07:08.

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Sony SIRC IR Issue
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th August 2015, 08:10
  3. Write Onewire data toa I2C memory / read ASCI
    By Eugeniu in forum mel PIC BASIC Pro
    Replies: 67
    Last Post: - 16th November 2008, 19:19
  4. Crystalfontz LCD
    By jman12 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th February 2007, 15:04
  5. Interrupt/timer not really interrupting...
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd May 2005, 22:05

Members who have read this thread : 1

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