Going around in circles?
You mean stuck in a loop
tap tap tap
that is funny![]()
Going around in circles?
You mean stuck in a loop
tap tap tap
that is funny![]()
Dave
Always wear safety glasses while programming.
You mean stuck in a loop
Yep,exactly that
If I can't crack it by tomorrow night I'm going to have to ask for a pointer. I was going to ask for one tonight but I think I'm in the right ball park for a small break through (he typed deludedly but hopefully).
Dave
Last edited by LEDave; - 6th May 2010 at 22:24.
Mmmm,Cryptic I know but are you 'hinting' that the way to do part two of the mission, namely:You mean stuck in a loop
Is to have the Total count (part one of mission) actually run inside a WORD size loop and Total parts run is actually the loop count itself? So that whenever the loop stops (ie, MC stops) that value is then written to EEPROM as Total parts run?Total parts run before M/C stops for maintenance For each run
The thinking would then be that Total count just carries on and parts run ie the loop count resets to zero and then starts again on power up.
Dave
Last edited by LEDave; - 7th May 2010 at 17:38.
And writes to a different EEPROM location each time. So if you have five start ups you will have five EEPROM locations (10 actually, 2 per WORD), plus the pair of locations for the TOTAL.The thinking would then be that Total count just carries on and parts run ie the loop count resets to zero and then starts again on power up.
Dave
Always wear safety glasses while programming.
More to think about there then.All part of the learning process.And writes to a different EEPROM location each time.
Learning how to program these PIC's is like learning a foreign language, doing a crossword puzzle and a Rubick's cube (all at the same time)...
It'll come with time and practice though (I hope...!)
Dave
Sometimes understanding the process is the difficult part. When I am asked to help modify a machine from manual to auto I will set up a video recorder so I can study the complete sequence the machine is expected to go through.
In my last post I forgot a variable. You will need a variable to remember how many times the machine has been started. Let's call this M_S.
The first time the machine starts all EEPROM locations will have the value of zero.
So the first thing will be to increment M_S to 1 and save that.
Now the machine will go into normal operation.
The TOTAL is incrementing. Saving to EEPROM.
The Parts_Run is incrementing. Saving to EEPROM, this location could have the name of PS_1.
The machine is shut down and re-started.
The TOTAL EEPROM location(s) is read and the value is placed into var TOTAL.
M_S is read and if it is 1 then two things need to happen. M_S will now be incremented and saved back to EEPROM. Now the Parts_Run value will need to write to another EEPROM location, this location could be named PS_2.
The number of parts ran the first time will be unchanged. You may want to display this on the LCD.
The same thing will happen each time the machine re-starts withe the Parts Run value saving to a different EEPROM location.
Lets say you set this up for 5 re-starts.
Code:TOTAL VAR WORD 'STORED IN EEPROM LOCATIONS 0 AND 1 PS_1 VAR WORD 'STORED IN EEPRON LOCATIONS 2 AND 3 PS_2 VAR WORD 'STORED IN EEPRON LOCATIONS 4 AND 5 PS_3 VAR WORD 'STORED IN EEPRON LOCATIONS 6 AND 7 PS_4 VAR WORD 'STORED IN EEPRON LOCATIONS 8 AND 9 PS_5 VAR WORD 'STORED IN EEPRON LOCATIONS 10 AND 11 M_S VAR BYTE 'STORED IN EEPRON LOCATIONS 12 AND 13
Dave
Always wear safety glasses while programming.
Cheers mackrackit,
I can see that it would be a good idea to actually draw up what it is I'm trying to achieve rather than just 'coding' as an idea arrives. These programs can soon grow and become very complicated.
Will be a good 'mission' to achieve this one, I've learned and am still learning from it.
Dave
Bookmarks