Hi, still new to Flowcode but learning...
My latest project is too build a clock that displays time and date on the LCD (Port A) on my Eblock programmer.
On Port B i have the switch board that i want to use to adjust the time and date.
I have a lot of code, and many things work, but some don't .
I use the 16F877A
I start by creating a macro that counts the timeroverflows and divide them by 256. After that i use a counter to divide this by 75 to get a second puls.
In this macro the seconds are divided to get minutes and hour pulses.
These are divided further to get days/months and year pulses.
I convert these variables (seconds/minutes/hour) to strings, and these separate strings to one time string, here is my first problem.
I want to make one string timetotal= hourstring + ":" + minutestring + ":" + secondstring
But if i do this in one time i get an error.
So i split the action in two parts:
-------------------------------------------------
timetotal = hourstring + ":" + minutestring
timetotal = timetotal + secondstring
-------------------------------------------------
Before i make this string i test if one of the parts are less than 10.
In that case i put a leading zero in front of it.
-------------------------------------------------
If seconds < 10
then
secondstring="0" + secondstring
-------------------------------------------------
In Flowcode this works, on the controller it doesn't, the string returns a "00" until it is larger than 10..
This is problem 2..
When i try to convert this project to HEX, than these problems are showed by the convertwindow..
Warning unreferenced functions removed:
FCM_DispKnipper in: TimeDate.c
FCD_LCDDisplay0_GetDefines in: TimeDate.c
FCD_LCDDisplay0_PrintASCII in: TimeDate.c
FCD_LCDDisplay0_Command in: TimeDate.c
FCD_LCDDisplay0_RawSend in: TimeDate.c
FCD_LCDDisplay0_PrintNumber in: TimeDate.c
LCD_2032710_Dummy_Function in: TimeDate.c
What do they mean?
Thanks for your help...
BTW, is there somewhere a Flowcode project that does what i want to do?
Making clock, different problems
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Hello MJU
In the Examples directory of Flowcode V3 there is a file call TUT22. This is an example of a digital clock and should help a lot with your program.
The warnings you are receiving are C functions for the LCD that are not being called by your program. Therefore they are nothing to worry about unless there are functions listed that you are using.
In the Examples directory of Flowcode V3 there is a file call TUT22. This is an example of a digital clock and should help a lot with your program.
The warnings you are receiving are C functions for the LCD that are not being called by your program. Therefore they are nothing to worry about unless there are functions listed that you are using.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
Thanks, found the tutorial.
My clock was somewhat more complicated
But my question was more about string manipulation.
Apparently string manipulation has its limitations.
When i want to do this:
timetotal= hourstring + ":" + minutestring + ":" + secondstring
It doesn't work (maybe it's too long)?
So i need to do this like this in the same stringmanipulation:
timetotal = hourstring + ":" + minutestring
timetotal = timetotal + secondstring
The other problem was that to mainpulate strings like this:
If seconds < 10
then
secondstring="0" + secondstring
works in flowcode, but on the board it doesn't..
Is this a flowcode issue or am I asking too much of the controller?
My clock was somewhat more complicated

But my question was more about string manipulation.
Apparently string manipulation has its limitations.
When i want to do this:
timetotal= hourstring + ":" + minutestring + ":" + secondstring
It doesn't work (maybe it's too long)?
So i need to do this like this in the same stringmanipulation:
timetotal = hourstring + ":" + minutestring
timetotal = timetotal + secondstring
The other problem was that to mainpulate strings like this:
If seconds < 10
then
secondstring="0" + secondstring
works in flowcode, but on the board it doesn't..
Is this a flowcode issue or am I asking too much of the controller?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Hello
Doing the following works in Flowcode and on the chip.
seconds = "0" + seconds
The part that does not work is the code that you are using for your decision.
if seconds < 10
This is because you are trying to compare an array of bytes with a single byte. If you have a numeric version of the number, ie contained in one byte then this would also work correctly.
As for the building up of your strings. Must you combine them all into one or will multiple calls to the LCD functions solve the problem.
Eg
Print String (hourstring)
Print ASCII (':')
Print String (minstring)
etc.
Doing the following works in Flowcode and on the chip.
seconds = "0" + seconds
The part that does not work is the code that you are using for your decision.
if seconds < 10
This is because you are trying to compare an array of bytes with a single byte. If you have a numeric version of the number, ie contained in one byte then this would also work correctly.
As for the building up of your strings. Must you combine them all into one or will multiple calls to the LCD functions solve the problem.
Eg
Print String (hourstring)
Print ASCII (':')
Print String (minstring)
etc.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel