Can some kind person please look at this flowcode file for me,
stepper number 2 will not move for/rev using sw3/sw4.
Stepper 1 works ok, as i am new to flowcode i am looking for some help
with the file.
Also i now have 5 keys for flowcode v7, because of purchasing more
chip packs (Thanks Matrix for the easter offer 50% of chip packs)
can i delete the first four keys, and just keep the latest, or do i keep
all the keys ?.
Thanks for looking
Regards Astro1234
RESOLVED Help please with stepper file.
Moderator: Benj
-
- Posts: 50
- Joined: Mon Apr 10, 2017 12:53 pm
- Has thanked: 39 times
- Been thanked: 13 times
- Contact:
RESOLVED Help please with stepper file.
- Attachments
-
- Steper-Forward_Reverse.fcfx
- (22.2 KiB) Downloaded 261 times
Last edited by astro1234 on Sun Apr 16, 2017 3:35 pm, edited 1 time in total.
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Help please with stepper file.
Hi Attached your corrected Flowchart,
However I did it in away that you can see what I did but there are many better ways to do than what you are doing now
but first learn as you are doing now and later you can improve your style
good luck and enjoy![Very Happy :D](./images/smilies/icon_biggrin.gif)
However I did it in away that you can see what I did but there are many better ways to do than what you are doing now
but first learn as you are doing now and later you can improve your style
good luck and enjoy
![Very Happy :D](./images/smilies/icon_biggrin.gif)
- Attachments
-
- Steper-Forward_Reverse.fcfx
- (22.2 KiB) Downloaded 281 times
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Posts: 50
- Joined: Mon Apr 10, 2017 12:53 pm
- Has thanked: 39 times
- Been thanked: 13 times
- Contact:
Re: Help please with stepper file.
thank you QMESAR for your help, i see that i set the properties switch to the wrong settings.QMESAR wrote:Hi Attached your corrected Flowchart,
However I did it in away that you can see what I did but there are many better ways to do than what you are doing now
but first learn as you are doing now and later you can improve your style
good luck and enjoy
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Regards astro1234
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Help please with stepper file.
you are welcome ![Very Happy :D](./images/smilies/icon_biggrin.gif)
The important thing here is not that it the wrong setting, however that you understood how we get to value 4 and 8 for SW3 and SW4![Very Happy :D](./images/smilies/icon_biggrin.gif)
![Very Happy :D](./images/smilies/icon_biggrin.gif)
The important thing here is not that it the wrong setting, however that you understood how we get to value 4 and 8 for SW3 and SW4
![Very Happy :D](./images/smilies/icon_biggrin.gif)
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Posts: 50
- Joined: Mon Apr 10, 2017 12:53 pm
- Has thanked: 39 times
- Been thanked: 13 times
- Contact:
Re: Help please with stepper file.
is the value 4 and 8 seen as a binary number,? because i see in the props/switch boxes 1,2,4,8 are used.QMESAR wrote:you are welcome
The important thing here is not that it the wrong setting, however that you understood how we get to value 4 and 8 for SW3 and SW4
![Question :?:](./images/smilies/icon_question.gif)
Regards astro1234
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Help please with stepper file.
the 4 and 8 is not the binary number but the decimal equivalent of the binary number of your PORTB which you read the SW inputsis the value 4 and 8 seen as a binary number
We can think of each pin on an IO port as a single bit in an 8-bit binary number,as the PORT is 8 bit wide and starting from left to right the the bits are
7 6 5 4 3 2 1 0 bits
RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0
SW3 connected to bit 2(RB2)
SW4 connected to bit 3(RB3)
your SW3 is connected to RB2 when it is pressed the voltage at the is 5V then the value you read into the PORTB is 0b00000100 in decimal that is 4 , that is way you have to test for 4 and not 1 as you did the same is valid for SW4 it is connected to RB3 when the button is pressed you have 0b00001000 binary is 8 decimal, for SW4 pressed you have to test for the value of 8 and not 2 just notice 0b is the prefix for binary numbers.
secondly this will also only work when you press 1 button at the time if you would press 2 buttons at the same time your code will not work again ,see if you can figure out why not
hope this helps I am no good teacher
![Very Happy :D](./images/smilies/icon_biggrin.gif)
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Posts: 50
- Joined: Mon Apr 10, 2017 12:53 pm
- Has thanked: 39 times
- Been thanked: 13 times
- Contact:
Re: Help please with stepper file.
Thank you i understand now.I am new to flowcode so have a lot to learn.QMESAR wrote:the 4 and 8 is not the binary number but the decimal equivalent of the binary number of your PORTB which you read the SW inputsis the value 4 and 8 seen as a binary number
We can think of each pin on an IO port as a single bit in an 8-bit binary number,as the PORT is 8 bit wide and starting from left to right the the bits are
7 6 5 4 3 2 1 0 bits
RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0
SW3 connected to bit 2(RB2)
SW4 connected to bit 3(RB3)
your SW3 is connected to RB2 when it is pressed the voltage at the is 5V then the value you read into the PORTB is 0b00000100 in decimal that is 4 , that is way you have to test for 4 and not 1 as you did the same is valid for SW4 it is connected to RB3 when the button is pressed you have 0b00001000 binary is 8 decimal, for SW4 pressed you have to test for the value of 8 and not 2 just notice 0b is the prefix for binary numbers.
secondly this will also only work when you press 1 button at the time if you would press 2 buttons at the same time your code will not work again ,see if you can figure out why not
hope this helps I am no good teacher
![Very Happy :D](./images/smilies/icon_biggrin.gif)
regards astro1234