ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING Programming serial memory chips. Encyclopedia of radio electronics and electrical engineering Encyclopedia of radio electronics and electrical engineering / Microcontrollers Non-volatile memory chips with serial data input and output are widely used today to store set modes and fixed settings in TVs, radios and other household appliances. When repairing it, it often becomes necessary to read the contents of such microcircuits or write new data to them. Usually this is done with the help of special devices - programmers. But in order to program one or two microcircuits in amateur conditions, it is unprofitable to purchase a rather expensive programmer. A normal personal computer will do just fine. One of the most common non-volatile memory chips is AT93C46 from ATMEL. To communicate with the microcontroller, it is equipped with a serial interface, consisting of only three single-bit buses SK (synchronization), D1 (data input) and DO (data output). These buses are connected in parallel to all the nodes in the device with such an interface. The data is transmitted bit by bit. accompanying each bit with a clock pulse SK. The AT93C46 chip also provides CS (chip select) inputs for switching it to the active state and ORG (organization). If the latter is connected to a power source, 64 sixteen-bit memory cells are formed in the microcircuit, if with a common wire - 128 eight-bit cells. To read content or program using a computer, the AT93C46 chip must be connected to the socket of the LPT1 or LPT2 port, as shown in the figure. Since the ORG input of the microcircuit is connected to a common wire, the memory organization is eight-bit. It is recommended to apply the +5 V voltage from an external source, but you can use any free output line of the port by programmatically setting a high logic level on it. The service program shown in the table is written in BASIC (Power Basic compiler version 2.10f). The program starts by asking for the port number to which the chip is connected. Depending on the response of the port variable operator, the value of the base address of the selected port is soldered: 888 (hexadecimal 378H) for LPT1 or 632 (hexadecimal 278H) for LPT2. The out port.0 command sets all port data bus pins to a logic low voltage. Next, the operator is asked to select the mode of reading data from the chip or writing to it and enter the name of the file in which the read information will be saved or the information prepared for writing is located. Those who use other versions of BASIC should be aware that the syntax of the operators for working with files may be different. The program not only saves the data read from the chip or written to it in a file or reads from it, but also displays it on the monitor screen in the form of a hexadecimal dump. The procedures for reading and writing data are somewhat different, but they use the same operations to "communicate" with the microcircuit, designed in the program as functions:
The internal control unit of the AT93C46 chip receives and executes commands from the DI line. Each instruction begins with a start bit of logic 1, followed by two opcode bits and the required number of memory and data address bits. Before each command is given, the CS input must be set to a high logic level, after its completion - to a low one. The read data (READ) instruction has an opcode of 10 followed by a location address. In response, the microcircuit will output the DO data byte stored at the specified address, which can be read using the shiftin function. After the power is turned on, the AT93C46 chip automatically switches to a mode in which erasing and writing data is prohibited, which prevents their accidental damage. So before. To write data to it, you must enable this operation by issuing the EWEN - Erase/Write Enable command. Its operation code is 00 followed by address 11 xxxxx. The values of the last five bits of the address are not analyzed by the EWEN command, and they can be anything. Once given, the EWEN command is valid until it is canceled by a special command or until the microcircuit power is turned off. The write command (WRITE) has opcode 01 followed by the location address and the data byte to be written. Having received such a command, the control device starts to execute an internal recording cycle, the duration of which is not more than 10 ms. Until it ends, the microcircuit does not respond to new commands. If at this time a short logic low pulse is applied to the CS input, the DO output will be set and will remain low until the cycle is completed. As soon as it goes high, you need to set the CS input low. after which the chip is ready to receive new commands. If the mentioned pulse is not applied to the CS input or is applied after the write cycle is completed, the DO output state will remain high-impedance. In addition to the considered commands, there are others: prohibit erasing / writing (EWDS), write a constant to all memory cells (WRAL), erase all memory cells (ERAL). In practice, they are used relatively rarely. A description of all commands, as well as other details of the design and operation of the AT93C46 chip, can be found in [1, 2]. The described program with minor modifications can be used to program any memory chip of the АТ9Схх family by setting the appropriate address range. For example, the AT93C56 chip contains 256. and AT93C66 - 512 eight-bit memory cells. 93X16.EXE - a version of the program designed to work with the AT93C46 chip in a sixteen-bit mode (the ORG input is connected to a power source). Literature
Author: A.Goncharenko, Odessa, Ukraine See other articles Section Microcontrollers. Read and write useful comments on this article. Latest news of science and technology, new electronics: Machine for thinning flowers in gardens
02.05.2024 Advanced Infrared Microscope
02.05.2024 Air trap for insects
01.05.2024
Other interesting news: ▪ Dual Channel Isolated SiC MOSFET Drivers 2EDF0275F and 2EDS9265H ▪ Mercedes electric cars with wireless charging ▪ New speed record for electric boats News feed of science and technology, new electronics
Interesting materials of the Free Technical Library: ▪ site section Tone and volume controls. Article selection ▪ article The Russian constitution is a bribe. Popular expression ▪ article What is the probability of getting identical decks of cards after shuffling? Detailed answer ▪ article Draftsman. Job description
Leave your comment on this article: All languages of this page Home page | Library | Articles | Website map | Site Reviews www.diagram.com.ua |