| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
AN98 Interfacing Xicor EEPROM Watchdog Timer Family Microcontroll
Top Searches for this datasheetApplications Staff, February 1997 Introduction Xicor EEPROM watchdog timer family on-chip programmable watchdog timer nonvolatile EEPROM memory. These features, coupled with 3-line Serial Peripheral Interface (SPI) 78Kseries microcontroller from NEC, make effective combination features performance. This application note will explore some possibilities will provide example schematics software. Interface 78K-Series microcontroller typically serial ports. these, synchronous three-line interface, used with watchdog timer (SPI WDT). This interface requires only additional line, chip select. Figure shows possible configuration. illustrated this connection requires additional components. Sample code, provided later section, written support hardware shown Figure AN98 Interfacing Xicor EEPROM Watchdog Timer Family Microcontrollers Implementation While interface code implementation complex, there some areas where care must taken achieve functional code. write enable command (WREN) must precede each write operation, including write status register. WREN command begins with line going completed with line returning HIGH. Once writes have been enabled, they active only during byte, page, status register write. This means WREN command must precede each write operation. write enable also reset automatically upon power-up. possible write block data single operation. However, each block bytes long block write cannot cross block boundary. block boundaries begin addresses where bits through "0". previously described, WREN 78K-Series X25043 RESET RESET Figure Interfacing Xicor 78K-Series using synchronous serial port. Xicor, Inc. 1511 Buckeye Drive Milpitas, 95035 (408) 432-8888 AN98-1 Xicor command required before block written. This block write mechanism implemented sample firmware code. possible write values into status register change block protection change watchdog timer value. Since status register nonvolatile, write register must follow same restrictions other non-volatile writes. This means that write status register will take maximum 10ms complete, cannot occur concurrently with data write operations. When using watchdog timer, /RESET signal sent after selectable period time. microcontroller does respond this amount time, will reset. toggling line, watchdog /RESET held-off. sample firmware code does include this watchdog timer /RESET hold-off operation. circuit Figure shows pull-up resistor /RESET line. This required, since open drain output. Typically, however, microcontroller /RESET circuit that allows user initiated re-start. this case, resistor shown figure additional component, part reset mechanism. Code Listings listing interface firmware included following pages. code consists test program that moves block data from EEPROM, then moves block from EEPROM 78K2 internal RAM. EEPROM-specific routines takes less than bytes code. These routines are: Init_SIO This routine will synchronous serial port communicate with WDT. Put_Byte This routine sends data byte EEPROM using internal hardware shifter microcontroller. Write_Stat This routine will write value into EEPROM status register. AN98 Get_Byte This routine gets byte from EEPROM using internal hardware shifter microcontroller. Wait_COM After writing byte microcontroller internal hardware shift register, this routine will wait byte transmit complete. Wait_EE This routine will wait EEPROM write complete. E2_Command_Fix This routine will send various commands EEPROM. Block_Read This routine will read block data from EEPROM will save block RAM. EEPROM source address pointer destination address pointer, along with block size bytes, pre-specified. Block_Write This routine writes block data EEPROM. data source address pointer EEPROM destination address pointer prespecified, number bytes block. This routine handles data blocks that begin EEPROM border handle blocks greater than bytes. Read_Stat This routine will return current value EEPROM Status register. Conclusion members NEC's 78K-series microcontrollers come equipped with on-board watchdog timer only family (the uPD7824x) on-chip EEPROM. introduction Xicor removes these limitations with single 8-lead device. Since, this combination requires interface hardware minimal code, perfect combination many industrial control applications. Additional Xicor code found Xicor through Xicor FaxBack system). Xicor reached toll free 1-800-258-8864, (408) area code internationally 1-408-9430655. Xicor's will support 19.2K baud rate modem parity, words, stop bit, local echo). Xicor application notes also available through Xicor's FaxBack system (408) 954-1627. AN98-2 Xicor TITLE ('X25164/644 Interface') File Name: PC(213) OPERATION: This program will access Xicor Serial EEPROM with Serial Peripheral Interface (SPI) watchdog timer This routine EEPROM that uses synchronous serial port K-series devices. This program written DDB. TESTPG: Define Equates WREN Command: Write enable WRDI Command: Write Disable RDSR Command: Read Status Register WRSR Command: Write Status Register READ Command: Read EEPROM WRITE Command: Write EEPROM EEPROM Write Progress P6.0 Chip enable line Msg1 Start address EEPROM block NUM_TRY read this long before giving Define Stack area STKSEG DSEG 0FE00H STACK: Define Variables VARIAB DSEG 0FE20H BYTE_COUNT: MESSAGE: Where data moved. Used test program., Vector Table VRESET CSEG 9000H START CMAIN CSEG 9080H Main Routine Initialize System. AN98 AN98-3 Xicor START: movw call !Init_SIO Initialize Serial port Turn Xmit Recv #00010111B RFM, #00000000B PM6, #00000000B #STACK Disable interrupts Fetch,no addr,1 wait Disable refresh pulse Select bank P64-67=output stack pointer AN98 PM0, set1 Disable EEPROM following Test program that writes block data into EEPROM from ROM, then reads back into 78K2 internal area. TEST: movw #MSG_ROM Location message movw #Msg1 Location message EEPROM BYTE_COUNT, Write bytes EEPROM call movw movw call call call LOOP: MSG_ROM: LOOP !Block_Write Write block #MESSAGE Location message #Msg1 Location message EEPROM BYTE_COUNT, Read bytes from EEPROM !Block_Read #10H !Write_Stat !Fini_SIO Timer mSec Timer Turn Serial port 'This test Serial EEPROM' AN98-4 Xicor Following various routines complete above operation. Init_SIO Initialize Serial Port Fini_SIO Turn Serial Wait_COM Wait communication complete Wait_EE Wait EEPROM Write complete Put_Byte Sends byte EEPROM Get_Byte Gets Byte from EEPROM E2_Command_Fix Sends commands WREN (Write Enable) WRDI (Write Disable) RDSR (Read Status register) WRSR Write Status Register) READ (Read EEPROM) WRITE (Write EEPROM) Read_Stat Reads EEPROM Status register Write_Stat Writes EEPROM Status Register Block_Read Reads block data from EEPROM Block_Write Writes block data EEPROM Init_SIO This routine will initialize Serial port Synchronous operation, using internal clocking 750K bps. Routines Called: None Input: None Output: None Registers used: Init_SIO: set1 set1 End_Ser_Setup: clr1 clr1 CSIIF Interrupt after each xfer Clear Sync Serial Intr Flag MK0H, #10000000B Disable serial interrupt PMC3, #0CH CSIM, Serial clock fCLK/8 CTXE Turn transmit mode CRXE Turn receive mode AN98 AN98-5 Xicor Fini_SIO This routine will initialize Serial port Synchronous operation, using internal clocking 750K bps. Routines Called: None Input: None Output: None Registers used: Fini_SIO: clr1 CTXE Turn transmit mode clr1 CRXE Turn receive mode End_Ser_Setup Wait_COM This routine will wait interrupt signal xmit recv complete Routines Called: None Input: None Output: None Registers used: None Wait_COM: btclr return: Wait_EE This routine will wait EEPROM write sequence complete. Routines Called: None Input: None Output: None Registers used: Wait_EE: Wait_EE_LP: call !Read_Stat Read Status Register #NUM_TRY Maximum number samples CSIIF, $Return Wait_COM Wait completion Xmit/Rcv AN98 AN98-6 Xicor dbnz Wait_done: else, return Put_Byte This routine will move byte data from memory pointed register EEPROM. Routines Called: None Input: Address data send Output: Next address data send Registers used: Put_Byte: SIO, byte serial port Wait_COM Wait byte sent Get_Byte This routine will move byte data from EEPROM memory pointed register. Routines Called: None Input: None Output: Returned byte Registers used: Get_Byte: SIO, Send dummy byte activate recv call !Wait_COM Wait byte recv'd byte E2_Command_Fix This routine will send control signal EEPROM Command: Write enable Command: Write Disable Command: Read Status Register Command: Write Status Register Command: Read EEPROM Command: Write EEPROM Routines Called: None Input: Command; Address EEPROM Output: None Registers used: None WIP, $Wait_done Write complete, done. $Wait_EE_LP done, give more time much. AN98 AN98-7 Xicor E2_Command_Fix: clr1 Put_byte Enable EEPROM Write Command serial port AN98 Read_Stat This routine will read value from status register Routines Called: None Input: None Output: Status value Registers used: Read_Stat: call call set1 #RDSR Read Status Register !E2_Command_Fix !Get_byte Disable chip Write_Stat This routine will write value status register Routines Called: None Input: Status register data Output: None Registers used: Write_Stat: call set1 call call set1 #WREN Prepare enable writing !E2_Command_Fix Send WREN command Disable EEPROM #WRSR Write Status Register !E2_Command_Fix !Put_byte Write status Disable chip AN98-8 Xicor Block_Read This routine will read block data from EEPROM Routines Called: Get_Data_Byte Input: Save address pointer, BYTE_COUNT number bytes Output: Address next save location Registers used: BYTE_COUNT Block_Read: call call call Blk_Rd_Loop: call dbnz set1 !Get_Byte [HL+], BYTE_COUNT, $Blk_Rd_Loop Disable EEPROM #READ Send reset command !E2_Command_Fix !Put_Byte !Put_Byte Send Send Send Send upper address byte EEPROM Start Address lower address byte EEPROM Start Address EEPROM Address AN98 Block_Write This routine will write block data EEPROM Since EEPROM byte page, limit bytes data written before issuing non-volatile write cycle. Also, order avoid data wrapping page, care must taken when writing over page boundaries. Routines Called: E2_Command_Fix, Put_Byte, Wait_EE Input: Internal Address EEPROM (where data written) Address data written BYTE_COUNT Number bytes write Output: None Registers used: BYTE_COUNT Block_Write: call set1 Write_OP: #WRITE #WREN !E2_Command_Fix Prepare enable writing Send WREN command Disable EEPROM AN98-9 Xicor call call call Blk_Loop: call dbnz Next_bit: incw NV_Write: set1 call call set1 #WRDI !E2_Command_Fix Disable writes Disable EEPROM !Wait_EE BYTE_COUNT, Block_Write Disable EEPROM Wait writes complete bytes sent keep $Blk_Loop Increment EEPROM address pointer Check byte block boundary this block start? keep sending [HL+] !Put_Byte BYTE_COUNT, $Next_bit NV_Write next byte Send points next byte Count byte, last one, write else check byte boundary !E2_Command_Fix !Put_Byte !Put_Byte Start writing Send upper address byte Send EEPROM Start Address Send lower address byte Send EEPROM Start Address EEPROM Address AN98 AN98-10 Other recent searchesPC1602A-L - PC1602A-L PC1602A-L Datasheet FZ1200R12KF4 - FZ1200R12KF4 FZ1200R12KF4 Datasheet FAN7317B - FAN7317B FAN7317B Datasheet APL602B2 - APL602B2 APL602B2 Datasheet APL602L - APL602L APL602L Datasheet
Privacy Policy | Disclaimer |