set stop count issue
Moderator: Benj
-
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
- Contact:
set stop count issue
this counter works for input frequency below 273hz which is good for what im looking for, it does have addtional circuitry and feedback not shown to make it work, operation is when you set a count it monitors the accumulating counts of a pin and when that pin count matches the set count it outputs logic high signal to another controller pausing the other controller operation........... but if you have a number like 10002 and i take away 10000 i get 20002, why is that? from left to right, #1 switch changes number position, #2 increases number position value #3 decreases number value #4 clears injector counts #5 allows display to update when logic level zero combine 4&5 it resets to beginning of program..... the deal is any number i have on the display, if i want to make the largest digit back to zero it screws up count, count be 11 and if i want 1 then decrease 10's position to zero this is the point of failure, does any of what i explained make sense?
- Attachments
-
- commander_progress.fcf
- (27.53 KiB) Downloaded 246 times
-
- 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: set stop count issue
Hi brandonb.
The reason this is occurring is because the characters stay on the lcd until they are overwritten with other characters including spaces.
e.g if a int value sent to lcd is 1023, then int is changed to just 3 then display will show 3023 because the 023 will still remain as its not overwritten.
The two solutions to this would be:
1) Use clear line command before writing value to lcd. This may not be practical if you have more than 1 set of information displayed on the one line.
or
2) use an additional PrintString " " (use 4 spaces for your application) component macro after the printNumber component macro since the 023 will be overwritten with spaces. This would be a better solution for your flowchart. note don't use too many spaces so the spaces
don't wrap to the nest line down of lcd, otherwise the chars on next line down will be faint and flickering.
Another issue with your flowchart is the command variable can't go above 32767. so you must stop 10000 from being added if command variable is already 30000 or roll-over will occur and the variable will go negative.
for
I have made some suggested alterations for you to look at e.g. PrintString " " and error trapping for when cnt_pos=1
Hope this helps
Martin
The reason this is occurring is because the characters stay on the lcd until they are overwritten with other characters including spaces.
e.g if a int value sent to lcd is 1023, then int is changed to just 3 then display will show 3023 because the 023 will still remain as its not overwritten.
The two solutions to this would be:
1) Use clear line command before writing value to lcd. This may not be practical if you have more than 1 set of information displayed on the one line.
or
2) use an additional PrintString " " (use 4 spaces for your application) component macro after the printNumber component macro since the 023 will be overwritten with spaces. This would be a better solution for your flowchart. note don't use too many spaces so the spaces
don't wrap to the nest line down of lcd, otherwise the chars on next line down will be faint and flickering.
Another issue with your flowchart is the command variable can't go above 32767. so you must stop 10000 from being added if command variable is already 30000 or roll-over will occur and the variable will go negative.
for
I have made some suggested alterations for you to look at e.g. PrintString " " and error trapping for when cnt_pos=1
Hope this helps
Martin
- Attachments
-
- commander_progress2.fcf
- (28.01 KiB) Downloaded 271 times
Martin
-
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
- Contact:
Re: set stop count issue
thanks martin- that was messing with me all day, what an idiot i am right? i actually thought of clearing the display at one point and ignored my impulses then forgot about it until i read your post, your a life saver, i can get some sleep now that you helped me get it working
-
- 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: set stop count issue
Your welcome, and no!brandonb wrote:thanks martin- that was messing with me all day, what an idiot i am right?
Looking at your flowchart your definitely not an idiot.
It's these type of issues that affect us all as they are so easily over looked!
Anyway, I have since altered some of your flowchart for you to have a look at.
Martin
Martin
-
- Posts: 438
- Joined: Mon Aug 29, 2011 12:26 am
- Location: arizona
- Has thanked: 175 times
- Been thanked: 173 times
- Contact:
Re: set stop count issue
martin- thanks for fixing the fcf file,works great,xplain alittle more on how the error trapping works with the comments you wrote in the decision block? also as you probably remember im using the pic16f690 and i run them at factory default which is 4MEG hz, they run with external crystal to 20MEG and max internal command of 8MEG.... when i put a Cblock command for the ossco70 to run 8 megahertz internal it does run the chip at 8 meg based on the fact that i check it by turning on and output then turning it off with no delays and checking the frequency increase with the command which doubles, but i get weird things that happen--> the display flickers on start up for 30 seconds and the delays that i put in for the switch scrolling speed are faster than they should be, why does this happen? is it normal or is there a setting that im missing, the file i posted had a command for 4meg so everything is normal... because i wanted to move up to the pic16f1939 which had 4 times the program memory and i wanted to use a higher clock speed with out problems, plus the changes that were made dropped the total loop speed by 100hz, i need to get that back up past 250hz while display is running all the time, if i only update the display when the injectors are stopped its frequency is 4.5K on the loop but i like to see the display running all the time