This is my first V6 Flow Chart and I can't get my count down timer tab to work in minutes in this flow chart, no matter how I configure it. If someone could show me what I'm doing wrong, it would be wonderful.
Thanks,
Scott
Count Down Timer Won't
Moderator: Benj
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: Count Down Timer Won't
Ok, it would help if you could tell us what happens and what you expect it should do.
First strange thing I notice is in Main macro you call "eeprom1::Read(count)" why do you read the value and ignore it? Did you mean store the value from eeprom in a variable?
Second, in Countdown you increase the value of Count_3 if less then 59 (first decision icon "Yes" branch) and in the next calculation you assign it the value 0. Shouldn't that calculation be within the "No" branch of the first decision icon?
First strange thing I notice is in Main macro you call "eeprom1::Read(count)" why do you read the value and ignore it? Did you mean store the value from eeprom in a variable?
Second, in Countdown you increase the value of Count_3 if less then 59 (first decision icon "Yes" branch) and in the next calculation you assign it the value 0. Shouldn't that calculation be within the "No" branch of the first decision icon?
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Count Down Timer Won't
Additionally to kersing's post You have got decision icon which will always be true because minutes variable is assigned as a byte.
Therefore will only reach 255 then on next increment = 0.
So this will never be true:
Martin
Code: Select all
If Minutes < 65535
Therefore will only reach 255 then on next increment = 0.
So this will never be true:
Code: Select all
Minutes > 1439
Martin
Re: Count Down Timer Won't
Thanks for your inputs. I was able to get the Countdown tab to work after moving that calculation
. The reset section on Main, however, causes the program to hang. I thought I fixed it
If there is a better way to restart- great. When the program is simulated, it acts differently than in hardware, so to see changes I have to program the chip and install it every time, which is time consuming. This is what I want it to do:
1. Power up using stored settings for the 2 PWMs and Countdown timer. it does this.
2. Default to Milliamp Display 4 & 4.1. it does this.
3. Return to Milliamp after 30 seconds on the other Displays. it does this.
4. UP/DN switches set values and stores them in eeprom. it does this.
5. Alternate a port pin continuously (C3). it does this.
6. Read and display two different mA values continuously X
7. Start over if over 24 hours X
Both ADCs appear to be controlled from ADC 2 and are giving negative numbers in the attached file. I am using two 0.47 ohm resistors for voltage drops (one for each channel)
The OLED is strobing too much in hardware for comfortable viewing.
Whatever your thoughts on this ,
Thanks,
Scott


1. Power up using stored settings for the 2 PWMs and Countdown timer. it does this.
2. Default to Milliamp Display 4 & 4.1. it does this.
3. Return to Milliamp after 30 seconds on the other Displays. it does this.
4. UP/DN switches set values and stores them in eeprom. it does this.
5. Alternate a port pin continuously (C3). it does this.
6. Read and display two different mA values continuously X
7. Start over if over 24 hours X
Both ADCs appear to be controlled from ADC 2 and are giving negative numbers in the attached file. I am using two 0.47 ohm resistors for voltage drops (one for each channel)
The OLED is strobing too much in hardware for comfortable viewing.
Whatever your thoughts on this ,
Thanks,
Scott
- Attachments
-
- Spa_B.fcfx
- (49.92 KiB) Downloaded 274 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Count Down Timer Won't
Hi Scott,
For forcing reset I use a c code block with :
Alternatively you could enable Watchdog timer (enable Auto Clear watchdog from Build, Project options, General options tab).
Make sure program does not reset.
Then when you want program to reset, just use a decision branch to point to a endless loop with nothing inside.
Watchdog timer should then reset your hardware.
As for ADC, do you realise that if using GetVoltage the results will only be 0 to 5 if using variable assigned as integers.
For example pot set about half way then variable will only = 2!
If using GetInt then variable = 511
If using GetByte then variable = 127
GetVoltage is really for when variable used is assigned as a float.
Then range will be 0.000000 to approximately 4.995308.
I personally would avoid the float route with most of the 8 bit pics.
Also I would not use ADC_base.
So you can get an idea from running the simulator I would just use any of the other pots.
I.e any of the components with the word potentiometer in it.
E.g Potentiometer (Colour) or even the one you have chosen - Potentiometer (panel)
Martin
For forcing reset I use a c code block with :
Code: Select all
asm
{
goto 0
}
Make sure program does not reset.
Then when you want program to reset, just use a decision branch to point to a endless loop with nothing inside.
Watchdog timer should then reset your hardware.
As for ADC, do you realise that if using GetVoltage the results will only be 0 to 5 if using variable assigned as integers.
For example pot set about half way then variable will only = 2!
If using GetInt then variable = 511
If using GetByte then variable = 127
GetVoltage is really for when variable used is assigned as a float.
Then range will be 0.000000 to approximately 4.995308.
I personally would avoid the float route with most of the 8 bit pics.
Also I would not use ADC_base.
So you can get an idea from running the simulator I would just use any of the other pots.
I.e any of the components with the word potentiometer in it.
E.g Potentiometer (Colour) or even the one you have chosen - Potentiometer (panel)
Martin
Martin
Re: Count Down Timer Won't
Again, many thanks to the Professor!
Although every restart scheme I've tried works, the program hangs but I think its because the OLED problem described here: http://www.matrixtsl.com/mmforums/viewt ... 54&t=15016
If there is new code for the OLED component initialization that address this 'problem'?, that would be great otherwise, I'll report back after I work around it.
Scott
Although every restart scheme I've tried works, the program hangs but I think its because the OLED problem described here: http://www.matrixtsl.com/mmforums/viewt ... 54&t=15016
If there is new code for the OLED component initialization that address this 'problem'?, that would be great otherwise, I'll report back after I work around it.
Scott
Re: Count Down Timer Won't
I overcame the reset problem by adding a 1 sec delay connected to a PNP 2N3906 controlling the positive power input to the OLED (Thanks BENJ) and using ASM ("RESET"); instead of
asm
{
goto 0
}
, which appears not to reset the registers to startup values.
Thanks to all.
Scott
asm
{
goto 0
}
, which appears not to reset the registers to startup values.
Thanks to all.
Scott