DS2346 is 1-wire device with 64-bit unique ID, 2-byte battery cycle counter, A/D converter for battery monitoring (voltage & temperature) and 32 bytes eeprom for user data.
Connection requires 3 wires:
- ground (pin 4 in programmer),
- data line (pin 5 in programmer),
- vdd (pin 8 in programmer)
Below are ready to use scripts for REVELPROG-IS.
You can read more about Custom Scripts Programming here: viewtopic.php?f=22&t=280
DS2436 Read EEPROM (5 pages, 32 bytes per page = 160 bytes total*)
Code: Select all
#SCRIPT HEADER;
SCRIPT:v1.8.1;
#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;
// PAGE 1 read (24 EEPROM bytes + 8 dummy bytes)
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:CC, 71; // SKIP ROM + COPY NV1 to SP1
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:CC, 11, 00; // SKIP ROM + READ SCRATCHPAD + SP1 ADDR
// PAGE 2 read (8 EEPROM bytes + 24 dummy bytes)
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:CC, 77; // SKIP ROM + COPY NV2 to SP2
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:CC, 11, 20; // SKIP ROM + READ SCRATCHPAD + SP2 ADDR
// PAGE 3 read (8 SRAM bytes + 24 dummy bytes)
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:CC, 7A; // SKIP ROM + COPY SRAM to SP3
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:CC, 11, 40; // SKIP ROM + READ SCRATCHPAD + ADDR
// PAGE 4 read
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:CC, B2, 60; // SKIP ROM + READ REGISTERS + REG. START. ADDR
// PAGE 5 read
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:CC, B2, 80; // SKIP ROM + READ REGISTERS + REG. START. ADDR
* there are dummy bytes, please check datasheet which bytes are valid and which can be changed
DS2436 Read 64-bit unique ID
Code: Select all
#SCRIPT HEADER;
SCRIPT:v1.8.1;
#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;
#OPERATION;
SW:0,0,1,7,0,0,0,0,0,500;
INSTR:33;
DS2436 Write EEPROM (2 pages: SP1 and SP2 = 24 + 8 = 32 bytes of user data)
- hard coded data in script
Code: Select all
#SCRIPT HEADER;
SCRIPT:v1.8.1;
#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;
// Unlock NV1
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:CC, 44; // SKIP ROM + Unlock NV1
// PAGE1 Write EEPROM (24 bytes)
#OPERATION;
SW:1,23,0,0,0,0,0,0,0,500;
INSTR:CC, 17, 00; // SKIP ROM + WRITE SCRATCHPAD + SP1 address
DATA: 11,22,33,44,55,66,77,88,99,AA,BB,CC,DD,EE,11,22,33,44,55,66,77,88,99,AA;
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:CC, 22; // SKIP ROM + Copy SP1 to NV1
// PAGE2 Write EEPROM (8 bytes)
#OPERATION;
SW:1,7,0,0,0,0,0,0,0,500;
INSTR:CC, 17, 20; // SKIP ROM + WRITE SCRATCHPAD + SP2 address
DATA: 11,22,33,44,55,66,77,88;
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:CC, 25; // SKIP ROM + Copy SP2 to NV2
DS2436 Write EEPROM (2 pages: SP1 and SP2 = 24 + 8 = 32 bytes of user data)
- data from buffer (since v1.8.5 only)
Code: Select all
//DS2436 WRITE EEPROM (using current data in buffer)
#SCRIPT HEADER;
SCRIPT:v1.8.5;
#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;
// Unlock NV1
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:CC, 44; // SKIP ROM + Unlock NV1
// PAGE1 Write EEPROM (24 bytes)
#OPERATION;
SW:1,23,0,0,0,0,0,0,0,500;
INSTR:CC, 17, 00; // SKIP ROM + WRITE SCRATCHPAD + SP1 address
DATA: BUFFER, 0;
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:CC, 22; // SKIP ROM + Copy SP1 to NV1
// PAGE2 Write EEPROM (8 bytes)
#OPERATION;
SW:1,7,0,0,0,0,0,0,0,500;
INSTR:CC, 17, 20; // SKIP ROM + WRITE SCRATCHPAD + SP2 address
DATA: BUFFER, 20;
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:CC, 25; // SKIP ROM + Copy SP2 to NV2
DS2436 Reset Battery Cycle Counter
Code: Select all
#SCRIPT HEADER;
SCRIPT:v1.8.1;
#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;
// Reset cycle counter
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR: CC, B8; // SKIP ROM + Reset cycle counter (=0)
DS2436 Increment Cycle Counter
Code: Select all
#SCRIPT HEADER;
SCRIPT:v1.8.1;
#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;
// Increment cycle counter
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR: CC, B5; // SKIP ROM + Inrement cycle counter (+1)
DS2436 Read Cycle Counter
Code: Select all
#SCRIPT HEADER;
SCRIPT:v1.8.1;
#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;
// Read cycle counter
#OPERATION;
SW:0,0,1,1,0,0,0,0,0,500;
INSTR:CC, B2, 82; // SKIP ROM + READ Cycle counter register
DS2436 Read Battery Temperature (with A/D conversion at first step)
Code: Select all
#SCRIPT HEADER;
SCRIPT:v1.8.1;
#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;
// Start A/D conversion for temperature
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR: CC, D2; // SKIP ROM + Convert T
// Read Temperature
#OPERATION;
SW:0,0,1,1,0,0,0,0,0,500;
INSTR:CC, B2, 60; // SKIP ROM + READ Temperature Register
DS2436 Read Battery Voltage (with A/D conversion at first step)
Code: Select all
#SCRIPT HEADER;
SCRIPT:v1.8.1;
#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;
// Convert Voltage
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR: CC, B4; // SKIP ROM + Convert V
// Read Voltage
#OPERATION;
SW:0,0,1,1,0,0,0,0,0,500;
INSTR:CC, B2, 77; // SKIP ROM + READ Voltage Register