FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    11 lesson: single-chip calculation instruction

     

    Single chip microcontroller without inlet position Add A, # data; example: add a, # 10h Add A, Direct; Example: Add A, 10h Add A, RN; Examples: Add A, R7 Add A, @ ri; example: add A, @ r0 Uses: Add the value of A with the value thereof, and final result is returned to A. Example: Mov A, # 30h Add A, # 10h Then the end of the article is executed, the value in A is 40h. The following topic exercises themselves Mov 34h, # 10h MOV R0, # 13h Mov A, 34H Add A, R0 Mov r1, # 34h Add A, @ r1 Brought in place AddC A, RN AddC A, Direct AddC a, @ ri AddC a, # data Uses: add the value of A and the value thereof, and plus the value in the inlet bits C. Description: Since the 51 single-chip microcomputer is an 8-bit machine, you can only do 8 mathematical operations, but the range of 8 operations is only 0-255, which is not enough in actual work, so it is necessary to expand, usually The 2 8-bit mathematics is combined to become a 16-bit operation, so that the range of the number that can be expressed can reach 0-65535. How to merge? In fact, it is very simple, let's take a 10-way number of routines: 66 + 78. These two numbers are added, we don't care about this process, but in fact, we do this: Do 6 + 8 (low) first, then do 6 + 7, this is a high level. I did two additions, but I didn't deliberately divide the addition to two additions, or we didn't realize that we did two additions. The reason why it is divided into two times is because these two numbers exceeded a number of dispensers (0-9). When you have a low position, we do it in your proper position when we do, and then you will add this. The same is true when you do 16 additions in your computer, first do 8 digits, if the two numbers are added, but also "click" to make a tag, this tag is the carry bits c, in the PSW. This C is added to the high addition. Example: 1067H + 10A0H, first do 67h + A0H = 107h, and 107h obviously exceeds 0FFH, so it is finally saved in A, and 1 to the CY bit in PSW, in other words, CY is equivalent to 100h. Then do 10 h + 10h + cyming, the result is 21h, so the final result is 2107h. Single-chip subtraction command with borrowing position Subb A, RN Subb A, Direct Subb A, @ ri Subb a, # data Set (each H, (R2) = 55H, CY = 1, after executing instructions Subb A, R2, the value in A is 73 h. Explanation: There is no single-chip subtraction command without borrowing, if you need to do a subtraction command (when doing the first time), you can clear CY. Multiplication Mul ab The function of this microcontroller command is to multiply the two 8-bit unsigned numbers in A and B, and the multi-multiplier results are generally large, so the final result is expressed in 1 16 digits, where high 8 bits are placed in B Medium, low 8 bits are placed in A. When the product is larger than fffffh (65535), 0V is set (overflow), otherwuit OV is 0, and CY is always 0. Example: (a) = 4Eh, (b) = 5dH, execution instruction After MUL AB, the product is 1 C56H, so it is 1Ch in B, and the A is placed 56h. Division directive Div AB The function of this microcontroller instruction is to use the 8-bit unsigned number in A, except for the 8-bit unsigned number (A / B). The division generally occurs, but it is possible to directly express the decimal in the computer. It is used by our primary school students. If the primary school students have not exposed to the decimal, such as 13/5, their merchants are 2, the remainder is 3. In addition to, the discharge is in A, the remainder is placed in B. CY and OV are 0. If the value in the first B in the first b is 00h, that is, the divisor is 0, then 0V = 1. Add 1 instruction INC A INC RN Inc Direct INC @RI Inc DPTR The use is very simple, that is, add the value in the rear target 1. Example: (a) = 12H, (R0) = 33h, (21H) = 32h, (34H) = 22 h, DPTR = 1234H. Execute the following instructions: INC A (a) = 13h INC R2 (R0) = 34h INC 21H (21H) = 33h INC @ r0 (34h) = 23h INC DPTR (DPTR) = 1235H The resulting results are as shown above. Description: From the results, INC A and Add A, # 1 are similar, but INC A is single byte, single cycle instruction, and add # 1 is double byte, double cycle instruction, and INC A does not affect PSW bit. , If (a) = 0ffh, after INC A (a) = 00h, CY remains unchanged. If it is Add A, # 1, (a) = 00h, and CY must be 1. Therefore, add 1 instructions are not suitable for adding, in fact it is mainly used to do counting, address increase, etc. In addition, the additional commands are all one of the cores of A. The calculation results must also be placed in A, while the objects of the 1 type of instructions are much wide, which can be registers, memory addresses, The address of the address, etc. 1 instruction 1 instruction Dec A Dec rn DIRECT Dec @RI Similar to plus 1 instruction, there is not much to say. Combined training: Mov A, # 12h MOV R0, # 24h Mov 21h, # 56h Add A, # 12h Mov dptr, # 4316h Add A, DPH Add A, R0 CLR C Subb A, DPL Subb A, # 25h INC A Setb C AddC a, 21h Inc R0 Subb A, R0 Mov 24h, # 16h CLR C Add A, @ r0 First, each step is written, and then the above topic is then built, and the changes in the software simulation, the register and the content of the relevant unit are observed, whether the same is the same as the own expected results. Read more

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us