I'm using Darryl Taylor's Interrupt routine to increment a variable (display) once on every timer1 overflow. Thanks again Darryl for the cool includes files.
I then use a select case to display 3 different things on my LCD. All is well.
What I would like to do is in the 3rd case (11), if there is anything "not normal" happening, I would like to display it at this step instead of "system normal". Sounds easy, I used another select case "trouble" within my original select case and I'll flag bits (elsewhere in the program) within the variable "trouble" to let me know what the problem is.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
'display = 0
Case 11
display = display + 1
select case trouble
CASE 0
INTCON.7 = 0
Serout2 thelcd,Baud, [I,clr]
Serout2 thelcd,Baud, [I,128," SYSTEM"]
Serout2 thelcd,Baud, [I,196,"NORMAL"]
INTCON.7 = 1
end select
end select
if display = looplength then display = 0
RETURN
goto mainloop
This should work well if I only have one problem at a time. If there are more than 1 problem is there an easier way to step thru the "trouble" bits (maybe some type of for..next loop)to display the problems or is the select case as I have it the best way?
The next select case would be
ETC...........Code:select case trouble
CASE 1,3,5,7,9,11,13,15,17,19........255
INTCON.7 = 0
Serout2 thelcd,Baud, [I,clr]
Serout2 thelcd,Baud, [I,128,"MAIN TANK TEMP"]
Serout2 thelcd,Baud, [I,196,"OVER LIMIT"]
INTCON.7 = 1
Or is there a better way to go about the whole thing!
Go easy on me I'm still a rookie. Any thoughts would be welcome.
16f876,4mhz, PBP2.45, labx2