;******************************************************************************
; *
; Notes: Rota hacia la derecha los bits de un registro seleccionado *
; por el programador. El destino de la operación se puede elegir. *
; Cada rotación equivale a dividir por 2 si el bit C del *
; registro STATUS es 0. *
; *
; *
;******************************************************************************
; *
; Revision History: *
; *
;******************************************************************************
;------------------------------------------------------------------------------
; PROCESSOR DECLARATION
;------------------------------------------------------------------------------
LIST p=16F88 ; list directive to define processor
#INCLUDE <p16f88.inc> ; processor specific variable definitions
;------------------------------------------------------------------------------
;
; CONFIGURATION WORD SETUP
;
; The 'CONFIG' directive is used to embed the configuration word within the
; .asm file. The lables following the directive are located in the respective
; .inc file. See the data sheet for additional information on configuration
; word settings.
;
;------------------------------------------------------------------------------
__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_ON & _PWRTE_ON & _WDT_OFF & _INTRC_IO
__CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
ERRORLEVEL -207
ERRORLEVEL -302
;------------------------------------------------------------------------------
;
; VARIABLE DEFINITIONS
;
; Available Data Memory divided into Bank 0 through Bank 3. Each Bank contains
; Special Function Registers and General Purpose Registers at the locations
; below:
;
; SFR GPR SHARED GPR's
; Bank 0 0x00-0x1F 0x20-0x6F 0x70-0x7F
; Bank 1 0x80-0x9F 0xA0-0xEF 0xF0-0xFF
; Bank 2 0x100-0x10F 0x110-0x16F 0x170-0x17F
; Bank 3 0x180-0x18F 0x190-0x1EF 0x1F0-0x1FF
;
;------------------------------------------------------------------------------
VARIABLES UDATA_SHR
Temp1 res 1 ; Reservamos '1' byte para la variable Temp
Num1 equ b'00001000'
;------------------------------------------------------------------------------
; RESET VECTOR
;------------------------------------------------------------------------------
RESET ORG 0x0000 ; processor reset vector
PAGESEL START
GOTO START ; go to beginning of program
;------------------------------------------------------------------------------
; MAIN PROGRAM
;------------------------------------------------------------------------------
START
;Configuramos el oscilador interno para 4MHz
banksel OSCCON
bsf OSCCON,IRCF2
bsf OSCCON,IRCF1
bcf OSCCON,IRCF0
;Realizamos la operacion de rotacion a la derecha
Rota: clrw ; Inicializamos el registro W
movlw Num1 ; Cargamos en W el valor 8 en binario
movwf Temp1 ; Guardamos en Temp1 el valor de la constante Num1
bcf STATUS,C ; Ponemos a 0 el bit C
rrf Temp1,w ; Rotamos a la derecha el valor de Temp y guardamos en W
clrf Temp1 ; Inicializamos la variable Temp1
goto Rota
END