Page 1 of 1
Desission question and loop number question
Posted: Sun Aug 25, 2013 12:00 pm
by Dutch
Gentlemen… I need your advice….. I tried and learned a lot in the mean time but now I am at a point where I ‘think’ I have found a few ways to make my ‘layout’ more simple in ‘flowcode-ways’ but not sure if it’s possible ….., (I already found out how to make a Input number as variable delay for the ON and OFF)
1-is possible to have my number of loops in the line respond to a input given from switchB? Now only a given number of counts can be there with no variable so I think it needs to be something like a calculation/ countdown to 0 in the ‘Loop while’ but not sure how.
2 less important ,I tried to feed the ‘desission’ or ‘switch’ arm a OR function so it would choose that route if the input is equal to a given serie of numbers (to work along with the no1 option above).
If I put ‘$portB = 1’ it works. But if I put ‘$portB=1|2’ (1 OR 2) to have it go that route at 1 OR 2 and run the program BUT it selects that route at any given input.. even 0?...
whats wrong? or isn't it possible like this? (don't get a syntax error when I put the numbers)
Thanks for looking !
Re: Desission question and loop number question
Posted: Sun Aug 25, 2013 4:14 pm
by medelec35
Hi Dutch,
I Have made some same minor modifications to your flowchart so it will only loop for the value of portB (bits 0 to 3)
From that should be able to change the flowchart to suit your needs.
Martin
Re: Decission question and loop number question
Posted: Sun Aug 25, 2013 9:07 pm
by Dutch
Super thanks Martin!!!!!!
maybe a minor adjustment, but this will save me many lines and gives me so much more variables!
I'm figuring out in a moment what you did to make it happen.
EDIT: really cool solution to have it equates to 0 that way! I also get the decision . but what can I put in the decision (or switch) if I want to have it react on 1 to 15? I'm trying something with ( )
Re: Desission question and loop number question
Posted: Mon Aug 26, 2013 9:52 am
by medelec35
Hi Dutch,
Your welcome.
Glad to have been able to help.
Dutch wrote:but what can I put in the decision (or switch) if I want to have it react on 1 to 15? I'm trying something with ( )
You can do something like this:
Code: Select all
(ReadPortB > 0) && (ReadPortB <= 15)
use && for AND
In reality this should not be necessary since you you look at your flowchart double click on input icon, you will see I have selected use Masking:
This means it will only read the bits that are ticked.
Since only bits 0 to bits 3 (4 bits in total) are ticked then the maximum value retrieved will be 2^(n)-1 = 2^(4)-1 = 16-1 = 15
If you ticked the 4 box then max total = 2^(5)-1 = 31
For those not familiar with maths or scientific calculator:
^ is 'To the power of'.
On my calculator, the button has a x with a white square (called the index) on the upper right to the x.
The x is power.
Other calculators could have a yx button instead.
Martin
Re: Desission question and loop number question
Posted: Mon Aug 26, 2013 10:06 am
by dazz
Hi
Just a quick one, if you put windows calc into scientific mode, its the Xy button,i didnt realise you could change the mode of windows calc until martin mentioned it a while back
Regards
Dazz
Re: Desission question and loop number question
Posted: Mon Aug 26, 2013 10:09 am
by medelec35
dazz wrote:windows calc into scientific mode, its the Xy
Typical!
I have two calculators in front of me and windows one has to be different
Thanks Dazz, I should of mentioned about windows version myself.
One of the calculators I bought from the pound store in the UK
It's a scientific (of course

) but it had all the useful functions of conversion to BIN, HEX, DEC.
But as Dazz reminded me the windows calculator can do all thoes functions as will since with win 7 it has a programmers functions.
(View, programmer)
To run calculator click the windows icon, and in search just type:
win
then enter key.
Re: Desission question and loop number question
Posted: Mon Aug 26, 2013 8:30 pm
by Dutch
Thanks again for thinking along Martin. this surely helps... TOP!
As for smart calculators... for my work to explain in a simple way BCD switches and their codes to installers for 'on the road' i have found a very simple and usefull App for the Iphone. there are more but the most elegant one is 'DMXdip'. It shows a 9Bit dipswitch and a numberpad. It converts direct any dipswitch setting to decimal and vice versa. Yeah, because it's free it has a NAG function build in but hé