Is there a limit to how many Case statements you can have in a Select Case statement?

Doogie

New Member
Hey all,

I'm reading audio levels with a 20x2 and a precision rectifier. Works Great. I'm using the Select Case command to vary a motors speed (PWM). Also works very well. ATM I have 19 Case statements in the Select Case section of the code.

Is there a limit to how many Case statements you can have within a Select Case... End Select statement? I've been searching for an answer and can't find it anywhere.

Speed is not an issue.

Thanks in advance.
Yurs doogie
 

hippy

Technical Support
Staff member
Often the easiest thing is to try it, which is probably all someone else is going to do in providing an answer :)

The limit is the amount of memory. I managed to paste 224 CASE statements into a 20M2 program, 409 into a 20X2 program, before I ran out memory. CASE statements with more substance than mine had would use more memory so one would expect fewer than that in practice.
 

fernando_g

Senior Member
It is definitively memory space related.

Working with a plain 14M, with its very limited program space, I ran out of memory while adding CASE statements.
The board was already made out, so I could not jump to a higher capacity device like the 18X.

At the time, using a LOOKUP instead of SELECT CASE command actually saved my bacon.....just barely.
 

bpowell

Senior Member
It is definitively memory space related.

Working with a plain 14M, with its very limited program space, I ran out of memory while adding CASE statements.
The board was already made out, so I could not jump to a higher capacity device like the 18X.
I think I've seen on here before, somebody took a 20x2 and cut the die removing the lower 6 pins...then was able to fit it into a 14-pin socket...the pinout looks like it would work!

Provided it's not a production device, or something that is mission critical, that would be a pretty cool hack to implement!
 

inglewoodpete

Senior Member
You not have seen my post called "Not a 14X2 but..." It uses a 20X2 SMD device fitted to a 14-pin dil connector. I designed that board in the pre-14M2 days when the 14M had only 256 bytes for program storage!

I still have some bare circuit boards shown in the thread!
 
Top