PDA

View Full Version : READ WRITE not working consistantly on 12f675



sccoupe
- 18th September 2009, 17:25
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.



read 0, delay
read 8, rpm.byte0
read 10, rpm.byte1


In the program I use the following to set the delay.


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


And the following code to set the RPM


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?

Acetronics2
- 18th September 2009, 18:02
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

sccoupe
- 18th September 2009, 22:57
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.

Acetronics2
- 19th September 2009, 08:52
Hi, Soucoupe


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

sccoupe
- 19th September 2009, 15:31
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.

Acetronics2
- 19th September 2009, 16:15
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