Page 1 of 1

PIC16F <-> DS2431 (1-wire) through GPIO

PostPosted: Fri Mar 29, 2013 2:22 pm
by khmok
Hi,

I am using PIC16F873A to communicate with DS2431 (1-Wire). All the 1-wire function (1-wire read, write and etc.) are based on AN126 apps note.
However, I encountered a strange phenomenon. As you see from the attachments, I have saved 0xBC for Data_Bytes[0] and the rest saved with 0x00. However, the moment I step through OWWriteByte, Data_Bytes[7] changed to 0x80 unexpected and it happens everytime.

Note:
1.Data_Bytes variable is ONLY use in this function (to store 8-bytes of data) and ONLY use to transfer to DS2431 (8-bytes as required in scratchpad).
2. In short, it doesn’t exist in other place, not even inside OWWriteByte.

How can that possibly happen? (which is stepping OWWriteByte while other non-relation variable get the value change.)

Extra information:
1. To store data in DS2431, procedure are write scratchpad -> read scratchpad -> copy scratchpad (to desire memory loc).
2. I am using MPLAB IDE v8.46 and HI TECH PICC compiler v9.0
3. 1-Wire has pulled up to 5V with 4.7kohm resistor. PIC16f873A is supply with 5V Vdd.