Digital circuit - BCD binary switch

BCD code is actually the original decimal number every 4 with a binary number, each 0-9.

4 is capable of expressing a binary number in the range of 0-15.

 

BCD code section shows the normal decimal to binary four bit binary difference 6 . So that's the key to the binary into BCD code. Laijiangjiang following main steps:

  • First estimates digit decimal, BCD code division advance to the good section, this time BCD to empty any data
  • Then talk about the most significant bit of the original Insert the end from the lowest end of the BCD code, it can be seen as a binary number and BCD code every time the left while the binary complement to cut off the head of BCD code Last but personally feel bit by bit insert more images ~
  • The key here too , mentioned earlier BCD code every four binary (represented one decimal) memory range is 0-9, and the scope of the original binary four storage is 0-15 , so binary-by-bit back-end when inserted BCD, BCD code if a certain period (binary four)> 9 we manually to force it requires the period of +6 carry BCD code satisfies a range of storage - while simply means that has been left, a period of> 9 to +6.
  • Here can be optimized, that is commonly +3 (+011) left method , i.e. to the left before the judgment of whether the segment> 4 (> 0100), certainly if more than more than 9 after the left, so left prior to the first paragraph +3 (+011), then after the left has been achieved carry it.
  • It's that has been inserted into the binary bit-wise (left) from the bottom, while maintaining the scope of each segment will be able to finally get to talk in a 0-9 BCD code.

Guess you like

Origin www.cnblogs.com/GorgeousBankarian/p/11583853.html