Redesign of cash registers. Part 1
Good afternoon everyone. Several years ago, I accidentally got an old written cash register. He was called "Elves micro-F". Because I am fond of electronics and programming, including the construction of various devices on microcontrollers, the device decided to investigate. Having disassembled it I saw:
board with electronic stuffing and microcontroller AT89C52 in the
Fig.1 The appearance of the cashier
At that time I already had experience of creating simple devices from scratch (clock, relay with control from COM port, etc.). It seemed much more difficult to understand the finished device. For a start, I found on the network a description of this device, a diagram, repair documentation. As it turned out, there are several schemes, they are quite different, although they are called almost identical in this case. But in the end, I found the necessary scheme. He looked at her and realized that in fact the cash register device is not that complicated.
I had to figure out:
how easy it is to program a microcontroller in order not to drag it there, then into the programmer, then back to the board
how to establish an exchange with a computer
how to work with RAM (and there was a serial AT24C08)
how to draw something on the display
How to receive keystrokes
and the most important thing! how to deduce something meaningful on a thermal printer
In this article, I will talk about the beginning of my work. The ultimate goal is to create a thermal printer from the old decommissioned cash register.
At first, I decided to abandon the microcontroller that was in the motherboard. First, it could only be programmed on a programmer, which I did not have for this type of controller. Secondly, he had little internal flash memory for programs.
Having suffered with the choice, I settled on the Winbond microcontroller w78e58b. It was in the same case (plcc44), had 32KB of program memory and more internal static memory for storing variables, and most importantly, it allowed programming itself using an in-circuit programmer without removing it from the socket!
But here it was also a challenge: to start programming it, we needed a parallel programmer for this type of microcontroller to sew a bootloader, with which I would then flood my firmware. Information on how to make such a programmer, I found on the Internet, assembled a programmer, sewed bootloader!
Then there was another problem - this device 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 also plugs in the case of the device for it and a connector on the board, but it was not possible to get this headband. At that time it was on sale nowhere, and it cost money nehily. Then I decided to make the interface myself. I broke one of the plugs out of the case, disassembled the socket from the local network with a connector for RJ4? cut out this connector in a piece of the board and pasted it into the cabinet of the cash desk for hot melt. As a result, the usual twisted pair was perfectly outside to the click; It remains to connect the contacts of the connector to the microcontroller. Directly of course you can not, you need through a level converter, for example MAX232. On a small piece of the breadboard, I placed the microcircuit itself, the capacitors of the strapping, soldered the wiring. Sleed a cable to connect to a computer from a piece of twisted pair. On the one hand is a typical RJ45 connector, with the other DB9 mother for the COM port connector.
The next task was to find a compiler that is free and not particularly complicated for such purposes. I got keil microvision. It was some kind of demo version with a restriction on the length of the code. For my purposes enough. The first program was simple: to output on a computer in the terminal program just something like Hello world!
I wrote the program, the difficulty was only in the initial initialization of ports and service registers. But looking at the network examples, I quickly coped with this. Next, I started the program
8051IspWriter, which fills the firmware. In order for the microcontroller to go into the flush mode of the firmware, 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 power is applied. Which one - found in the datasheet on the microcontroller. The firmware was flushed, after which I turned it off, turned on the cash register and saw my text on the terminal screen! The system worked!
Next, I decided to make some adjustments by the cashier himself, or rather, to flash the LED. According to the scheme, I determined which LED to which foot of the microcontroller is going, I wrote a simple flasher and the LED blinked at the checkout! The path has already become visible to the ultimate goal!
Extracts from the source code:
void main (void)
static int data value;
jmpLDROM = 0;
//I write to the ports initial values so as not to burn the thermal head and the step
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
//this procedure from the library to work with COM port
puts ("Hello world!");
It may be interesting
Thankyou for sharing the data which is beneficial for me and others likewise to see.Gulf Coast Western Reviews
Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.GSM Solutions