ich habe ein Programm geschrieben, aber das Praoramm läuft nicht richtig, warum?
Code-Tags verwenden ! sieht hübscher ausCode:;**************************** ; 8x8 Software Multiplier ;**************************** LIST P = 16f84, #include<P16f84.INC> mulcnd equ 0x09 ; 8 bit multiplicand mulplr equ 0x10 ; 8 bit multiplier H_byte equ 0x12 ; High byte of the 16 bit result L_byte equ 0x13 ; Low byte of the 16 bit result count equ 0x14 ; loop counter Same equ 1 ;************************************************************************ START GOTO main ; ***************************** Begin Multiplier Routine mpy_S clrf H_byte ; H_byte = 0000 0000 clrf L_byte ; L_byte = 0000 0000 movlw 8 movwf count ; count = 8 movf mulcnd,W ; multiplicand ---> W bcf STATUS, C ; Clear the carry bit loop rrf mulplr, F ; multiplier: 1-bit nach rechts verschieben btfsc STATUS,C ; C=0 , uebergehen addwf H_byte,Same rrf H_byte,Same rrf L_byte,Same decfsz count, F goto loop retlw 0 ; ;******************************************************************** ; Test Program ;********************************************************************* main movlw 0x1f movwf mulplr ; multiplier---> mulplr movlw 0x12 movwf mulcnd ; Multiplicand ---> mulcnd call mpy_S ; END![]()







Zitieren
Lesezeichen