While Loop problem???

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

While Loop problem???

Post by Jordy101091 »

Hi all,

First of all Im very happy with my flowcode version 5 but I have some trouble with a while loop.
In my main program I have a loop built in (bottom), where the data is read from different sensors
When it goes into this loop it reads the data from he temp sensor and RTC one time. after that it just hangs, it wont get any further.

I have put output in this loop (LED) to check if it will toggle of at the end of this loop but it doesnt.

Hope somebody can help me, its very annoying.

Regards Jordy
Attachments
Aquarium Controller PIC18F4620.fcf
(78.18 KiB) Downloaded 266 times
the will to learn, should not be stopped by any price

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: While Loop problem???

Post by medelec35 »

Jordy101091 wrote:I have put output in this loop (LED) to check if it will toggle of at the end of this loop but it doesnt.

Hope somebody can help me, its very annoying.

Regards Jordy
Hi Jordy

It does not appear to be crashing to me,
Reason why LED is on all the time is because at the end of the loop you have got 0>D1 to turn LED off, the the very next command is 1>D1 to turn LED on, then rest of the routines with the loop.
Since there is only a few clock cycles between LED off and back on, but loads of clock cycles before LED is off again, LED will appear to be permanently on!

I have modified flowchart to toggle LED on each loop.
Or you could of added another time delay after 0>D1.


Martin
Attachments
Aquarium Controller PIC18F4620 Modded1.fcf
(78.84 KiB) Downloaded 269 times
Martin

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: While Loop problem???

Post by Jordy101091 »

medelec35 wrote:
Jordy101091 wrote:I have put output in this loop (LED) to check if it will toggle of at the end of this loop but it doesnt.

Hope somebody can help me, its very annoying.

Regards Jordy
Hi Jordy

It does not appear to be crashing to me,
Reason why LED is on all the time is because at the end of the loop you have got 0>D1 to turn LED off, the the very next command is 1>D1 to turn LED on, then rest of the routines with the loop.
Since there is only a few clock cycles between LED off and back on, but loads of clock cycles before LED is off again, LED will appear to be permanently on!

I have modified flowchart to toggle LED on each loop.
Or you could of added another time delay after 0>D1.


Martin
Hi Marting,

Thanks for youre reply.
But the thing is my time does not update the same is for my temperature reading.
I have removed the Call_RTC_Rd_time macro and my temperature is updating nicely.
I dont know what im doing wrong here.

Maybe you can help me.

Regards Jordy
the will to learn, should not be stopped by any price

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: While Loop problem???

Post by medelec35 »

Ah so your not talking about simulation, you are referring to hardware?

I was only referring to simulation sorry

I will have a look but no promises since I do not have the hardware you have.

I may not be able to help for that reason.

I have a suggestion:
Use either your LCD or a RS232 for diagnostics.
If it's an issue with time update, before each component macro send a number that increments to the display. When flowchart freezes you will get an idea of the cause since its the component after the last number displayed.
I would need the same hardware to carry those tests out.

Martin
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: While Loop problem???

Post by medelec35 »

Hi Jordy,
Perhaps this might help.
As an example: If you run code on your hardware and after code freezes code shows 7 on the bottom row of LCD,
then issue will be with Component 8 = Receive byte RTC_HR_BCD etc.

Martin
Attachments
Aquarium Controller PIC18F4620 Modded2.fcf
(83.84 KiB) Downloaded 284 times
Martin

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: While Loop problem???

Post by Jordy101091 »

Martin,

I have tryed your program. It shows me the number 1.
That means that the program never goes further then printing the next number.

But it shows me the time that's is stored into the ds1307 correctly. But it doesn't refresh the data I don't understand because the whole thing is inside a loop.

Maybe it's a bug, when I try to use the fat16 component it can't compile the program.

I will send a pm to matrix we request to solve this annoying problem.

Thanks anyway Martin.

Regards jordy.
the will to learn, should not be stopped by any price

Post Reply