12f675_fuse_about_to_blow!


Closed Thread
Results 1 to 40 of 929

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    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.

  2. #2
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Mmmm,
    You mean stuck in a loop
    Cryptic I know but are you 'hinting' that the way to do part two of the mission, namely:

    Total parts run before M/C stops for maintenance For each run
    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?

    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.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    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.
    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.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    And writes to a different EEPROM location each time.
    More to think about there then.All part of the learning process.

    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

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    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.

  6. #6
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    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

  7. #7
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    From the brief:

    M_S VAR BYTE 'STORED IN EEPRON LOCATIONS 12 AND 13
    Does M_S need to be set as a BYTE or a WORD? If it's a BYTE is this ok?

    Code:
    WRITE 12, M_S
    Dave

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts