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
While Loop problem???
Moderator: Benj
- 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???
- Attachments
-
- Aquarium Controller PIC18F4620.fcf
- (78.18 KiB) Downloaded 266 times
the will to learn, should not be stopped by any price
-
- 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???
Hi JordyJordy101091 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
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
- 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???
Hi Marting,medelec35 wrote:Hi JordyJordy101091 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
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
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
-
- 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???
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
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
-
- 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???
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
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
- 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???
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.
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