Good day everyone. Several years ago, I accidentally got into the hands of an old written-off cash register. It was called "Elves micro-F". Since I'm interested in electronics and programming, including the construction of various devices on microcontrollers, the device decided to explore. Having examined it, I saw:

Fig.1 Appearance cashier
At that time, I already had the experience of creating unpretentious devices from scratch (a clock, a relay controlled from a COM port, etc.). Understanding the finished device seemed much more difficult. For a start, I found on the network a description of this device, a schematic, repair documentation. As it turned out, there are several schemes, they differ quite strongly, although the devices are called almost the same. But in the end, I found the desired scheme. He looked at her and realized that in fact the cash register device is not so complicated.
I needed to figure out:
In this article, I will talk about the beginning of my work. The ultimate goal is to create a thermal printer from an old, withdrawn cash register.
Part 1
Start
At first, I decided to abandon the microcontroller that stood in the board. First, it was possible to program it only on the programmer, which I haven’t had for this type of controllers yet. Secondly, he had little internal flash memory for programs.
Having suffered from a choice, I stopped on the Winbond w78e58b microcontroller. He was in the same package (plcc44), had 32K of program memory and more internal static memory for storing variables, and most importantly, he allowed himself to be programmed using an in-circuit programmer without removing it from the panel!
But even here there was a difficulty: to start programming it, a parallel programmer was needed for this type of microcontroller, in order to sew up the bootloader, with which I would later upload my firmware. Information on how to make such a programmer I found on the Internet, gathered a programmer, stitched bootloader!
Then there was another problem - this unit did not have a connector for connecting to a PC!

Fig.2 Original interface board
Although, as I read in the manuals, there was such a handkerchief, and there were plugs in the case for the device and a connector on the board, but the pairing did not work out. At that time, it was on sale nowhere, and it cost the poor people money. Then I decided to make the interface myself. I broke one plug out of the case, disassembled the socket from the local network with a RJ45 connector, cut this connector into a piece of board and pasted it into the cash register case with hot melt glue. As a result, the normal twisted pair was perfectly inserted outside the click! It remains to connect the connector pins to the microcontroller. Of course, it is impossible directly, it is necessary through a level converter, for example MAX232. On a small piece of breadboard placed the microcircuit itself, strapping capacitors, soldered the wiring. Soldered the cable to connect to the computer from a piece of twisted pair. On the one hand, the usual RJ45 connector, on the other hand, the DB9 mother for the COM port connector.
The next task was to find a compiler, free and not very difficult for such purposes. I got keil microvision. It was some kind of demo version with a limit on the length of the code. For my purposes, enough. The first program was simple: just put something like Hello world on a computer into a terminal program!
I wrote the program, the complexity was only in the initial initialization of ports and service registers. But looking for examples online, I quickly coped with this. Next, I launched the program
8051IspWriter, which fills the firmware. In order for the microcontroller to enter the firmware download mode, it was necessary to activate the built-in bootloader. As it turned out, this can be done by closing the controller output to the ground before energizing. What exactly - found in the datasheet on the microcontroller. The firmware was flooded, after which I turned off, turned on the cashier and saw my text on the terminal screen! The system worked!
Further, I decided to control the cash register a little, or rather to flash the LED. According to the scheme, I determined which leg of the microcontroller this LED is on, I wrote the simplest flasher and the LED began to flash at the checkout! The path has already become visible to the final goal!
Excerpts from source code:
void main(void) { UCHAR i; char c; static int data value; UCHAR bCassaTypeOld; UCHAR iNumSymbolsOld; jmpLDROM=0; // P0 |= 0x01; // PPWR = 1 P1 |= 0x20; // PM1 = 1 P1 |= 0x40; // PM2 = 1 P3 &= ~0x40; // SI = 0 P3 &= ~0x20; // CLOCK = 0 P3 |= 0x80; // LATCH = 1 P3 |= 0x10; // STBA = 1 P3 |= 0x08; // STBB = 1 // initUart(BAUD_RATE_19200); puts("Hello world!"); while(1) ; } Source: https://habr.com/ru/post/424627/
All Articles