三位bcd加法计数器_两个8位BCD编号的加法| 8085微处理器

该博客介绍了如何使用8085微处理器进行两个8位BCD数的加法运算。通过详细算法描述,包括加载数字、计算进位、检查和调整结果,并最终存储结果,实现BCD加法计数。
摘要由CSDN通过智能技术生成

三位bcd加法计数器

Problem statement:

问题陈述:

To perform addition operation between two 8-bit BCD numbers using 8085 microprocessor.

使用8085微处理器在两个8位BCD编号之间执行加法运算。

Algorithm:

算法:

  1. Load the two numbers in HL pair register.

    将这两个数字加载到HL对寄存器中。

  2. Store 00 on a register to calculate carry.

    将00存储在寄存器中以计算进位。

  3. Move the content of register H to accumulator.

    将寄存器H的内容移至累加器。

  4. Add the content of accumulator with the content of register L.

    将累加器的内容与寄存器L的内容相加。

  5. Check if the sum is greater than 09 then add 06 to result.

    检查总和是否大于09,然后将06加到结果中。

  6. If carry flag is equal to 0, goto step no 8 otherwise goto step no 7.

    如果进位标志等于0,则转到步骤8,否则转到步骤7。

  7. Increment the value of carry by 1.

    将进位值增加1。

  8. Store the result in memory.

    将结果存储在内存中。

  9. Move the content from register to accumulator.

    将内容从寄存器移到累加器。

  10. Load the result in memory.

    将结果加载到内存中。

  11. Terminate the program.

    终止程序。

Program:

程序:

	LHLD    2050
	MVI     C, 00
	MOV     A, H
	ADD     L
	DAA
	JNC **
	INR     C
	** STA  3050
	MOV     A, C
	STA     3051
	HLT

Observation:

观察:

    INPUT: 
    2050:32
    2051:77

    OUTPUT: 
    3050:01
    3051:09

Hence we successfully added two BCD number with carry.

因此,我们成功地将两个BCD号码加进了进位

翻译自: https://www.includehelp.com/embedded-system/addition-of-two-8-bit-bcd-numbers-using-8085-microprocessor.aspx

三位bcd加法计数器

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值