Four-BCD Encoder Circuit Designed on a Single-Chip-Machine

1 Introduction

BCD code is also known as binary/decimal code, which is a binary coded decimal code. When designing and testing a digital circuit hardware process or an integrated circuit with a BCD code interface, it is often desired to easily and quickly generate a BCD code to complete the current Work to verify the correctness of the hardware circuit. For example, the lock-in frequency synthesizing integrated circuit MC145163P has a 4-bit BCD coded interface for setting the loop-N frequency divider. The BCD generator after the production of this article can be provided. 4-bit BCD coded output, convenient to control each bit BCD output, can be quickly BCD coded to complete the test or output BCD code to the integrated circuit BCD coded interface, without frequent jumpers.
In addition, BCD encoding has 8421, 2421, 3 codes and other forms. This article uses the common 8421 code as an example to introduce the implementation of the circuit and the preparation of the program. If you slightly modify the program you can easily implement other types of coding modes (such as 2421 code). This circuit uses the AT89C2051 as the core to design a 4×4 matrix keyboard (S0-S15) so that only a corresponding key (S0-S9) can be pressed on the keyboard to generate a corresponding (decimal 0-9) BCD code. , By setting the switch button (S10-S13) can freely control any one of the 4 digits, during the period of time with the digital tube to display the decimal number corresponding to the current BCD code.
Circuit functions and features:
4-bit BCD coded output, the number of bits can be expanded using the microcontroller port.
Programs that change the key number 0-key number 9 in the software (that is, the function corresponding to S0-S9) can implement other encoding formats (such as 2421 code). See the software section.
The circuit uses the commonly used 8421 code as an example, and there is a digital display of the corresponding decimal number (which can also be omitted).
A complete 4x4 matrix keyboard scan execution program can be ported to other application circuits.
The BCD code is latched by the latch and leads to the interface for easy connection to other circuits.
The "bit" control and the 0-9 coded output do not affect each other. Press the function key directly to get the desired BCD coded output and "digits" selection.

2 circuit block diagram

The circuit schematic is shown in Figure 1.

3 Circuit Analysis

The P1 port of the AT89C2051 forms a 4×4 matrix keyboard (S0-S15), with P1.0-P1.3 as the row line and P1.4-P1.7 as the column line. The design of the keyboard scanning program can achieve the pre-imagined functions ( See Software Design section). Press S0-S9 to generate a BCD code corresponding to a decimal number of 0-9. S10-S13 is used as a switch button for a 4-digit BCD code. S14 and S15 are not used temporarily. They may not be installed. P3.3-P3.0 is a BCD. The data output line of the code can be seen from the circuit, because the function keyboard to achieve 4-bit BCD code output, obviously P3.3-P3.0 as a data bus while simultaneously connected to the four D latches (4042) Switching through S10-S13, only one of the four D latches (U3-U6) is active at a time and “read in” the P3.3-P3.0 data and latches it. In fact, S10-S13 controls the states of P3.4 and P3.5 (there are 4 combinations of P3.4 and P3.5) and obtains the corresponding U3-U6 through the 2-4 line decoder (U2; 74LS139). The effective signal, Table 1 is the state of each chip corresponding to the control of S10-S13. It can be seen that when any one of U3-U6 (eg, U3) is in the valid state and “read in” the data of P3.3-P3.0, the rest ( U4/U5/U6) is in the latched state, retaining the original data, so the user can change the desired BCD code output in any one of the bits.

Table S10-S13 controls the corresponding U3~U6 chip status

button

P3.4(B)

P3.5(A)

U2: 74LS139 output

Actual function

Y0

Y1

Y2

Y3

U3 is valid, U4/U5/U6 is latched and remains

S10

0

0

0

1

1

1

U3 is valid, U4/U5/U6 is latched and remains

S11

0

1

1

0

1

1

U4 is valid, U3/U5/U6 is latched and remains

S12

1

0

1

1

0

1

U5 is valid, U3/U4/U6 is latched and remains

S13

1

1

1

1

1

0

U6 is valid, U3/U4/U5 is latched and remains

U2 (74LS139) is a 2-4 line decoder. The functions are shown in the above table. His input terminals B and A are connected to P3.4 and P3.5 respectively. The output terminals Y0-Y3 are determined by the combination of the input terminals. Each combination Only one output (Y0-Y3) outputs active low. U3-U6 is a D-latch, mainly the relationship between the 5-pin and 6-pin determines the working state of the D-latch. It is known from the data that when the logic potential of the 5-pin and the 5-pin is the same, the chip can output the D3-D0 data. To Q3-Q0; when the logic potentials of the 5 and 6 pins are different, the chip is in the state of latching the original data, and will not "read in" the current D3-D0 data, and the U3-U6 pin 6 is fixed in the circuit. Connected to the low potential, and 5 feet respectively using U2 (74LS139) output signal to control, it is not difficult to achieve "can be achieved individually on the BCD code settings." 4511 is the decoding drive, connected to the total cathode digital tube to display the decimal number corresponding to each current BCD code, easy to observe, the display part is very simple, not repeat them here, at the same time, the display part is not necessary on the circuit, can be omitted The BCD code is derived from J3 and J2. The reason why two linkers are used is for flexibility and convenience.

4 Software Design

Mainly to achieve keyboard processing, the program must confirm which button is pressed, and then go to the appropriate processing program to perform, in fact, the program is a complete keyboard scanning program, if you change the processing of the sub-program can be applied To other control circuits.

The task of the keyboard scanner is simply to confirm whether there is a button press, and then to determine which line the button is in by scanning, and finally to find and calculate the specific button by comparing the preset 4-line table. This leads to the corresponding function program.
The corresponding processing function of each key is relatively simple, as long as corresponding control commands corresponding to different keys are input, different states of P3.3-P3.0 are controlled for S0-S9 to obtain corresponding BCD codes, and for S10-S13 It is to control the state of P3.4 and P3.5 to realize the control of U3-U6. Due to limited space, the detailed contents can refer to the program. When the program starts to execute, it is to control the 4-bit BCD code output one by one, and the corresponding digital tube is displayed in sequence. The initial state is 0001, 0000, 0000, 0000. Four BCD codes are taken from J3 and J2, respectively, and the digital display is 1, 0, 0, 0.

5 Using NSD Absolute Position Encoder with Dedicated Controller Application Example Illustration:

Component combination chart:

Traditional and NSD product detection differences map

NSD Controller and Absolute Position Encoder Diagram

Traditional detection pattern

6 Conclusion:

(1) Traditional detection methods: The function is limited, multiple wirings are needed, and the practical effect is not good. It is difficult to detect the workpiece with small differences.

(2) NSD product detection methods: With a wide range of functions, a single feedback line and a single control line, it is possible to achieve 0 to 32 groups of program call functions and their respective 0~15 group (ON/OFF) switches, with the switch range arbitrarily set. Workpieces with different values ​​greater than 0.004mm can be judged and have high practicality.

continuous inkjet printer

ChinaHAE is professional supplier in printing field, Continuous Inkjet (CIJ) coding and printers and have set the industry standard for print quality, reliability and versatility for over 10 years.

ChinaHAE different inkjet printers of TIJ Inkjet Coding equipment, DOD Expiration date printing machine, CIJ Pet Jar CIJ inkjet printer selling in over 120 countries. CIJ ink jet coding equipment can print on a variety of substrates including, metal, glass, plastic, paper, and wood.

CIJ inkjet printing machine printing speed is high, and printing height up to 18mm.

CIJ inkjet coder


Continuous Inkjet Printer,Inkjet Printer Machine,Computer Inkjet Printer Machine,Automatic Inkjet Printer Machine

Wuhan HAE Technology Co., Ltd. , https://www.whwallprinter.com

Posted on