Logic operation and bit operation instruction of 51 single chip microcomputer

Source: Internet
Author: User

A single-chip logic circuit, the need to compile a program to achieve the following logic circuit of the logical function.

Logic diagram:


Reward Points: 20 | Resolution Time: 2011-1-2 22:53
;------------------------------------------------------------
Best Answer:

First, the logical diagram is written as follows: (with "p1.6\" for "P1.6", others are similar)

P3.0 = ((P1.0 * P1.1) \ * (P1.4 + P1.5) \) + p1.6\) \

And then repeatedly applying the Morgan theorem Simplification:

P3.0 = ((P1.0 * P1.1) \ * (P1.4 + P1.5) \) \ * P1.6

P3.0 = ((P1.0 * P1.1) + (P1.4 + P1.5)) * P1.6

Finally written:

P3.0 = (P1.0 * P1.1 + P1.4 + P1.5) * P1.6

This is much simpler, and the four reverse steps are gone.

The equivalent logical diagram is as follows:


The local programs written in assembly language and C are as follows:
====================================
Assembly language

MOV C, P1.0
ANL C, P1.1
ORL C, P1.4
ORL C, P1.5
ANL C, P1.6
MOV P3.0, C

SJMP $

;===================================
C Language:

Sbit a = p1^0; To determine the PIN as a variable
Sbit B = p1^1;
Sbit C = p1^4;
Sbit d = p1^5;
Sbit e = p1^6;
Sbit f = p3^0;

F = (A & B | c | d) & E; A line of statements can

This topic, in the textbook, is generally required to use 51 single-chip microcomputer bit operation instructions to program, so, the answer should be used in assembly language.
However, see most netizens, to the assembly is relatively dull, so, also put C language in here.

//==================================

Some netizens directly follow the logic diagram to write the program, no prior logic simplification, so the program is hard to write out cumbersome.
The procedure given here is much simpler and faster than several methods upstairs.

Respondents: Doing and discussing the Tao
The questioner evaluates the answer: Thank you very much.
Original title URL: http://zhidao.baidu.com/question/207973840.html
====================================
Here is another question about simplifying the logic.

Using the axioms and theorems of Boolean algebra to find F = (A? B) The simplest logical function expression of ⊙ab.
Reward Points: 0 | Resolution Time: 2011-1-2 19:40
-------------------------------------
Best Answer:

The following uses a\ to represent "A's non", the other is similar.
In the topic, and ⊙, respectively, represent the XOR and the same or, the following use and or non-logical operation to expand and simplify.

F = (A? B) ⊙ab
= (a\b + ab\) * ab + (a\b + ab\) \ * (AB) \
= (a\b * AB + ab\ * ab) + (a\b + ab\) + (AB)
= (0 + 0) + (a\b + ab\) + (AB)
= (0 + 0) + a\b + ab\ + AB
= (0 + 0) + a\b + ab + ab\ + AB
= (0 + 0) + a\b + ab + ab\ + AB
= (0 + 0) + (a\ + A) B + (b\ + b) A
= B + A

Respondents: Doing and talking about
original title URL: http://zhidao.baidu.com/question/210128992.html
=====================================

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.