Number Counter

Any general or miscellaneous queries that do not fit into the other forum catagories

Moderators: Benj, Mods

Post Reply
deb_mus
Posts: 3
Joined: Tue Nov 03, 2009 8:32 am
Contact:

Number Counter

Post by deb_mus »

Hi,

I am trying to use tutorial 22 (counter), give it a number from which to start counting and condition it to display messages on the LCD at particular times. The idea is to display “open” and “closed” messages on the LCD at 8 and at 19 for a shop.

The first problem is that when i added some switched to control from which number the counter starts counting, the counter counts till 59 minutes and does not add an hour as it used to in the tutorial. (example if it is 09:59:59, after a minute it turns to 09:01:59) What could have caused the counter to do this?

The other thing is that i need to give condition that for example at 08 hours an “open” message is desplayed and at 19 a “closed” message, but the program is not recognising the hours variables and is always desplaying the same meggage. Does anyone have an idea why?

I do not know if i managed to explain myself enough, if you want i can send you the program i am working on.

Thanks for your help
Deborah

User avatar
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:

Re: Number Counter

Post by Benj »

Hello Deborah

Yes attatch your program to the forums and im sure we will be able to shine some light on whats going wrong.

deb_mus
Posts: 3
Joined: Tue Nov 03, 2009 8:32 am
Contact:

Re: Number Counter

Post by deb_mus »

hi,

attached is the program i was working on.

the first one is just the tutorial with an additional macro in which i wanted to control the time from where the counter starts counting. the problem is that after the minutes turn after 59 the hours remain the same, do not add by one.

the second is the same but with the decitions added. the problem is that the program is not recognising the conditions and is constantly displaying the same message instead of changing it according to the given time.

10s a lot for your help and time
regard
deborah
Attachments
tutorial + edit time macro + decisions.fcf
this is tutorial 22 with the edit time macro along with decisions to display messages
(15.57 KiB) Downloaded 313 times
tutorial + edit time macro.fcf
this is tutorial 22 with a macro to edit the time before counter starts
(14.3 KiB) Downloaded 327 times

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: Number Counter

Post by medelec35 »

I have made some modifications to add additional features and correct some errors.
Modification is: if you set hour tens to 2 then it will only let you select 0 to 3 for hour units, since 28 o'clock don't exist :lol:
have corrected bugs so time does not change from 23:59:59 to 24:00:00, instead changes to 00:00:00.Tested and working on on hardware. Still displaying the correct time!

Reason why your program was not working: condition to test for hour change was set up to look at variable Called HOURS, which is incrementing while A3 or A2 is at logic 1 and does not reset if over a certain value, so this figure could be 80 if switches held down long enough. Whereas actual hours are incremented by separate hour units then hour tens. So if time is set at 23:50:20 and HOURS is 80 then when running the hours on LCD would change to 00:50:20. Like wise if switch is only pressed twice and time is set for 23:59, Since HOURS would only be 5 (UNITS + TENS) then when minute is increased by 1, HOURS would only be 6 and not >23.

If you still cant get your hardware to work, make sure your pull-down resistors on used ports A are connected OK between the port and ground. If Pull-down resistors are not fitted (in range of say 4k7 to 470K) then your hardware will behave totally erratic, due to port inputs floating form logic 0 to logic 1 with out switches being touched! Could that be what you are observing?
Suggestions: If you are not open and closed at exactly same times 7 days a week, then I would suggest adding a day of the week counter as well.
Also It would be a good to alter program slightly to allow for switch contact bounce.
For setting time You could have a button to select which part of time requires adjusting which makes the character flash. Then you could include Day of the week with out adding any extra buttons.
There could also be the option to slightly increase or decrease speed since I'm using a crystal and time has gained by approximately 3 seconds every 9 hours
If I get some free time, I will see what I can come up with. If you can get posted software to work then that's a good start. 8)

Please let us know how you got on.
Good luck.
Kind Regards
Martin
Attachments
tutorial + edit time macro_Modified2.fcf
(28.53 KiB) Downloaded 348 times
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: Number Counter

Post by medelec35 »

Added open and closed.
Between 0800 and 1859 display shows OPEN
otherwise display shows CLOSED

BTW Ben has posted a clock:http://www.matrixmultimedia.com/mmforum ... f=5&t=6824
which can be adjusted while running by pressing buttons.
Martin

deb_mus
Posts: 3
Joined: Tue Nov 03, 2009 8:32 am
Contact:

Re: Number Counter

Post by deb_mus »

Hi,

I have tried to open the attachement you have sent me but it is not opening neither on my computer and even on the schools computer. Could it be because I am using Flowcode version 2?

One other thing. I have tried to put the program on a pic trough the kit but an error is coming up. I printed the screen and attached it so you can take a look. I am not using the C-Code (because it asked in the error)

10s alot for your time
Deborah
Doc2.doc
Error print screen
(27.5 KiB) Downloaded 298 times

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: Number Counter

Post by medelec35 »

Posted flowchat I created with V3. I would guess you are correct when you say flowcode saved as V3 will not open in V2,(just like V3 can't open V4 flowcharts) Matrix team would be better answering that one. I beleive V2 is not supported anymore.
Would you like me to post a compile hex file?
If so, if you let me know the config word, and I will include that for you.
personally I would recommend V4 any day. It is very stable and all the extra features makes it a brill product
Martin

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Number Counter

Post by Steve »

Medelec's correct - we can only offer minimal support for really old versions (like v2). You do qualify for an upgrade to v4; this is from Flowcode's datasheet:
Version 2 to version 4 upgrade
Upgrades from version 2 to version 4 will be charged at 70% of the version 4 price.

Post Reply