Thursday, May 26, 2016

8051 Program - signed 8bit to 16bit conversion

; subroutine CONV816
; 8-bit Signed number to 16-Bit Signed number conversion
;
; input: r0 = X
;
; output: r1, r0 = X with sign extended to 16 bits
;
; alters: acc

CONV816:mov A, r0
jnb acc.7, Pos
mov r1, #0FFH
ret
Pos:mov r1, #0
ret


Source: Maths Subroutines for the 8051 microcontroller, W.G.Marshall 2002



Related topics:
8051 Program - signed to unsigned conversion 8bit   |   8051 Program - signed to unsigned conversion 16bit   |   8051 Program - signed to unsigned conversion 32bit   |   8051 Program - unsigned to signed conversion 8bit   |   8051 Program - unsigned to signed conversion 16bit   |   8051 Program - unsigned to signed conversion 32bit   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment