PDA

View Full Version : WRITE and DT-INTS



Fredrick
- 15th January 2016, 20:26
Hi

I write data to the EEPROM with WRITE and are also using DT-INTS TMR1, but before i execute a write I disable TMR1 with
@ INT_DISABLE TMR1_INT

Is that the correct way to do it?

I´m a little confused when I read the manual about WRITE, The manual says

If interrupts are used in a program, they must be turned off (masked, not
DISABLEd) before executing a WRITE

What do they mean with not DISABLED?

Dave
- 17th January 2016, 16:51
If you are talking about using the WRITECODE command all you have to do is place DEFINE_WRITE 1 at the start of your code and it will do the task for you. I always it as I use the WRITECODE function quite often and always use DT_INTS. Never had a problem yet....

Fredrick
- 17th January 2016, 17:52
I talk about the WRITE


WRITE

WRITE Address,Value

Write Value to the on-chip EEPROM at the specified Address. This instruction may only be used with a PICmicro that has an on-chip EEPROM data area such as the PIC16F84, PIC16C84 and the PIC16F87x series.

WRITE is used to set the values of the on-chip EEPROM at runtime. To set the values of the on-chip EEPROM at programming-time, use the DATA or EEPROM statement.

Each WRITE is self-timed and takes about 10 milliseconds to execute on a PICmicro.

If interrupts are used in a program, they must be turned off (masked, not DISABLEd) before executing a WRITE, and turned back on (if desired) after the write instruction is complete. An interrupt occurring during a WRITE may cause it to fail.

WRITE will not work on devices with on-chip I2C interfaced serial EEPROM like the 12CE67x and 16CE62x parts. Use the I2CWRITE instruction instead.

WRITE 5,B0 ' Send value in B0 to EEPROM location 5
To write a word, each of the 2 bytes that make up the word must be written separately:

w Var Word
WRITE 0,w.BYTE0
WRITE 1,w.BYTE1

Dave
- 18th January 2016, 13:00
Yes you are correct, WRITE as well as WRITECODE work the same. All you have to do is place DEFINE_WRITE 1 at the start of your code and it will do the task for you.

Fredrick
- 18th January 2016, 14:09
Thank you!
I thought that DEFINE_WRITE 1 only was for the PBP "ON INTERRUPT" and not for "ASM" interrupts like DT-INTS

Fredrick
- 25th January 2016, 22:28
DEFINE_WRITE 1 only works on PBP3 and up I think.
How do I do it on PBP 2.60C?

The way I do it now is by disable the TMR1 with the line "@ INT_DISABLE TMR1_INT"

picster
- 21st February 2016, 19:26
It works in PBP 2.60, it's in the printed manual as well under the WRITE statement.