Stuck in a while loop

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
panuj417
Posts: 4
Joined: Sat Oct 26, 2019 9:33 am
Contact:

Stuck in a while loop

Post by panuj417 »

I am using a PIC16F886.
I am a beginner in this field.
I stuck in a while loop.
anybody help me?
https://drive.google.com/open?id=1KqXQX ... vJSkEQiMB6

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Stuck in a while loop

Post by medelec35 »

Hi panuj417 ,
I have moved your post, so not hijacking a members topic.
One issue is you are reading the value of a button, if the value is true, then the loop is accessed.
There is not a button to read within the loop, so the value will never go from 1 to 0.
You can just place another Button ReadState within the loop.

You also have some issues with your configuration.
For example Watchdog and Low voltage programming is enabled, which will cause issues.

With loads of chips including PIC16F886, It is the value of

Code: Select all

OSSCON 
register that set up the hardware internal osc speed.
The Clock speed within Flowcode sets up timing for all timed critical components and delays.
Looking at the data sheet (page 62) for PIC16F886 the default value is 4MHz.
This means no matter what you set the clock value to, the chip will always be running at 4MHz!
To get the hardware to run at the correct speed, the easiest way within Flowcode is to use the intosc component.
Just click on the search(magnifying glass) and enter intosc
This is how you use the intosc component.
Please follow it all, as you will need to add a C code bock with the correct value.
Whenever I start a project with a new target device, I always run a flash test to make sure the chip is running at the correct speed.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
AbhijitR
Posts: 133
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Contact:

Re: Stuck in a while loop

Post by AbhijitR »

Hello! Martin

As usual every time I read your post I learn something new, thanks for the IntOsc Helper, many thanks to Matrix Team too.

Regards
Abhi

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Stuck in a while loop

Post by medelec35 »

Hi Abhi,
Thank you for the nice comments.
You are very welcome.
Glad we have helped you to learn new things :)
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Post Reply