READ WRITE not working consistantly on 12f675


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2009
    Posts
    29

    Default READ WRITE not working consistantly on 12f675

    I am using a 12f675 and the read write commands and is doesnt seem consistant the way that they work.

    At the beginning of the program I use the following to grab the values.

    Code:
    read 0, delay
    read 8, rpm.byte0
    read 10, rpm.byte1
    In the program I use the following to set the delay.

    Code:
        REWRITED:
            write 0, delay
            read 0, delayc
            if DELAY <> DELAYC then goto rewrited

    And the following code to set the RPM

    Code:
        PULSIN gpio.2,0,RPM
        LIMIT = RPM
        IF gpio.3 = 1 THEN GOTO CHANGE
        
        REWRITER:
            write 8, limit.byte0
            write 10, limit.byte1
            read 8, limit.byte0
            read 10, limit.byte1
            if limit <> rpm then goto rewriter

    The delay in ms works ever time and keeps the setting even after power off.

    The rpm work speratically.

    Any ideas?

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Talking So many reasons ...

    YES ...

    1) Write need 10 ms ....

    2) PULSIN swings for about 1 Digit ( The rollover error ... )

    3) a thermal engine doesn't have a perfectly steady RPM ... Woes a bit !!!

    ... What is your Gadget used UPON and FOR ???

    4) What's the purpose of that ????

    REWRITED:
    write 0, delay
    read 0, delayc
    if DELAY <> DELAYC then goto rewrited
    Except loosing time ??? You expect an EEPROM Failure ???

    That won't help in any way !!!

    Alain
    Last edited by Acetronics2; - 18th September 2009 at 18:07.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Feb 2009
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    Does that mean that I need to have a 10ms pause after the write instruction to make it wqork correctly?

    Ill do some research on what you mean by PULSIN 'swing'.

    For this part, I want to run an engine at a certain rpm and then do a PULSIN to get the time between triggers. When I press a button, I want to save that value to compare later. Then it continuosly does PULSIN and compares the saved value with the new one, if its a smaller value, then the rpm is higher and I turn on a light. If the value is larger then the rpm is slower and the light goes off. My problem SEEMS to be that it doesnt save the value correctly or not at all when power is removed. So even if not real accurate, the value should change.

    The rewrite was put in to make sure the write happened do to it not saving correctly. I guess this is not the case so it can be removed.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Wink PHYSICS Problem ...

    Hi, Soucoupe

    Quote Originally Posted by sccoupe View Post
    Does that mean that I need to have a 10ms pause after the write instruction to make it wqork correctly?
    NOT necessary ... PBP cares for you ...

    That means it happens things WHILE Eeprom Writing ...


    Ill do some research on what you mean by PULSIN 'swing'.
    You only could find that with " rollover" keyword ... old logics users have learnt it was 0 or 1 state ... if number is between ... result woes a bit !!!

    For this part, I want to run an engine at a certain rpm and then do a PULSIN to get the time between triggers. When I press a button, I want to save that value to compare later. Then it continuosly does PULSIN and compares the saved value with the new one, if its a smaller value, then the rpm is higher and I turn on a light. If the value is larger then the rpm is slower and the light goes off. My problem SEEMS to be that it doesnt save the value correctly or not at all when power is removed. So even if not real accurate, the value should change.
    YOUR problem is the RPM value is slightly changing with time ( due to the combustion engine working principle ...) , despite you think it's a constant speed ... actual value is 1500 +/- 50 rpm. ( Example )

    My model plane engines run @ XXXXX rpm ... +/- 100 rpm ...

    Sooooo ... PULSIN will return a slightly and slowly changing value AROUND a steady value !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Feb 2009
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    I realize that the rpm is not constant, but im not saving it all of the time in any case. For instance, If I save a PULIN value for 400rpm and then change it to 6000rpm and reboot the pic, it may keep the old 400rpm value. Very inconsistant the way it works.

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Cool

    Quote Originally Posted by sccoupe View Post
    I realize that the rpm is not constant, but im not saving it all of the time in any case. For instance, If I save a PULIN value for 400rpm and then change it to 6000rpm and reboot the pic, it may keep the old 400rpm value. Very inconsistant the way it works.
    Please ...

    Provide Your Full code ... AND Your electrical scheme. ( Even PM if confidential ...)

    Will be MUCH easier to debug than supposing things ...

    Alain
    Last edited by Acetronics2; - 19th September 2009 at 16:18.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Cleaning up code
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2009, 07:14
  2. write -read problem?
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th August 2009, 13:06
  3. SEROUT WORD variable problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th April 2009, 11:20
  4. Q: using MCLR for Input on 12F683
    By picster in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 31st January 2009, 15:25
  5. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19

Members who have read this thread : 1

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