is this a disaster waiting to happen

johnlong

Senior Member
Hi All
the following passes syintax but is it or will it confuse the chip later on

select case b0
case=0 (do nothing left blank)
case>0 high B.1
end select

regards john
 

srnet

Senior Member
Interesting concept, chips (PICAXEs ?) getting confused.

They should be consistent in what they do, rather than getting 'confused' even if what they do is not what you expect.
 

lbenson

Senior Member
To the point, if the SELECT CASE statement is desired, this works in the simulator.
Code:
do
  select case b0
    case=0 ' (do nothing left blank)
    case>0 high B.1
  end select
  pause 2000
  b0 = b0 xor 1 ' toggle between 0 and 1
  low B.1
loop
 

hippy

Technical Support
Staff member
The form of the SELECT-CASE may be a little unusual but, assuming it does what is intended, will work as intended, and will always work as intended, in Simulation and on a physical chip.
 

johnlong

Senior Member
Hi All

Thanks Ibenson you code snippet explaines it nicely
It was just a thing I was thinking looking at if statements

if b1=1 then
high B.1
else
endif
seemed to me that if you are within a multiple select case structure it would have the same effect
as the above if statement. Just curious if it would throw the case statement into a hissy fit later on (going back to it things not put back as should be)
regards
john
 
Last edited:

hippy

Technical Support
Staff member
It was just a thing I was thinking looking at if statements

if b1=1 then
high B.1
else
endif
seemed to me that if you are within a multiple select case structure it would have the same effect
as the above if statement.
Note that your SELECT-CASE statement has "CASE >0" which isn't the exact same as your "IF bX=1", though it will be equivalent if your variable only ever holds 0 and 1 values.

If wanting a "not zero" conditional test in CASE or IF it can can be "<>0", "!=0", ">0", "=1", or ">=1".

I would say that ">0" and ">=1" do not indicate a "not zero" as well as the others, suggest a numerical "non zero" rather than a logical "not zero".
 

johnlong

Senior Member
Hi Hippy
The signing was not so much as for whats being used more for example purposes to
get a consensis if the blanking would cause a problem with the case statement
ie not clearing or leaving it hanging for a command to complete
Its to refreash the menu selection for a nextion display as I was finding
that at start up and refreash the picaxe was inc the RTC variables by 1
Code:
symbol marker=b10
symbol mins=b15
symbol QT=34

	select case marker
		case "^"	
				select case mins
		case=0	'no reponse return without any command sent to display display refreashes with nex variable not picaxe
		case>=1	hserout 0, ("t0.txt=",QT,#mins)
		case "+" 			
				mins= mins+1 max 59 
				hserout 0, ("t0.txt=",QT,#mins)
		
		case "-" 		
				mins= mins-1 min 0
				hserout 0, ("t0.txt=",QT,#mins)
		end select 
		end select
								
				RETURN
regards john
 
Top