PDA

View Full Version : How many AND / OR are accepted ?



iw2fvo
- 12th July 2015, 17:13
good day ,
I have a very simple qestion regarding the number of AND and OR can be put in the " if " control under PicbasicPro.
Eg.: if (a>b) AND (c>d ) AND (e>f) AND (g>h) AND (i>l ) AND ( m>n) AND (o>p) THEN ....
How many AND / OR are accepted ?
Thanks
Ambro

aratti
- 12th July 2015, 21:57
I think that the number of Logic are limited by the two line space!

But you can do the and Logic with nested if/then like this:

If a>B then
If c>d then
If e>F then
.
.
If x>z then

Code for the Action necessary If all the ands are satisfied

ENDIF
.
.
ENDIF
ENDIF
ENDIF

This type of construct is shorter in terms of ram usage and is much faster than the corresponding "line construct"
With the same approch you can make the OR construct.

Naturaly here the limitation is the ram size of your mcu.

Cheers
Al.

iw2fvo
- 12th July 2015, 22:23
Thanks for the clarification,
All the best.
Ambro