Академический Документы
Профессиональный Документы
Культура Документы
TESIS
PARA OPTAR EL TITULO PROFESIONAL DE:
INGENIERO ELECTRONICO
PRESENTADO POR:
P R O M O C I O N: 1 9 8 4 - 11
LIMA- PERU
1998
DISEÑO Y CONSTRUCCION DE UN ESTABILIZADOR
DE VOLTAJE USANDO UN MICROCONTROLADOR
A mis queridos padres:
Aquilio y María por su
apoyo material y
espiritual.
A mis hermanos: Hibernón,
Arturo, Natividad y Jesús
Antonio por la ayuda y
comprensión de siempre.
AGRADECIMIENTOS
pág.
PROI,OG,O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
CAPITULO I.
ASPECTOS GENERALES SOBRE ESTABILIZADORES
2.1 Microcontrolador............................... 14
2.2 Microcontroladores de 8 bits, características
generales. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3 Algunos microcontroladores de 8 bits.......... 17
2.3.1 Sección aritmética ............................. 17
2.3.2 Unidad aritmética y lógica..................... 17
VII
CAPITULO III
ANALISIS DE LOS PRINCIPALES PROBLEMAS DE ESTABILIZACION DE
VOLTAJE Y SISTEMA DE SOLUCIONES
ANEXO C
JUEGO DE INSTRUCCIONES DEL 8048AH - 8748AH........... 156
ANEXO D
CARACTERÍSTICAS GENERALES DEL 8748H .................. 172
ANEXO E
ESQUEMA DEL ESTABILIZADOR DE VOLTAJE USANDO UN
MICROCONTROLADOR...... ............................... 176
BIBLIOGRAFIA......................................... 178
PROLOGO
-------
Reguladores de voltaje y estabilizadores de voltaje.
Se llaman reguladores de voltaje a los aparatos,
generalmente accionados manualmente, que compensan las
variaciones de voltaje de la línea de alimentación. En
principio se componen de una serie de contactos dispuestos
en arco de círculo, que mediante una maneta hacen variar
el número de espiras de un transformador cuando la
corriente es alterna, e intercalando elementos de
acumulador cuando la corriente es contínua. Desde luego,
la maneta es movida por una persona que debe estar atenta
a las fluctuaciones del voltaje de la línea de
alimentación para obrar en consecuencia. Por consiguiente,
los reguladores de tensión pueden estar destinados a
compensar un voltaje continuo o alterno, y además es
necesario que una persona vigile para accionar el
regulador.
5
hu pr 1Jt H111ltrnlu11,
0111pJ) 11 111Lul:rn11111'01 tn nl,ll"Pfi, 1 ,, 1·1 1 111' 1 1111111 u' 1i'J11 r1r1 q11n ,, 1
1 1td;o :lo 1111, 1nu11ll. 1 q11� 1 ,xlril 1 11111 ('{Jt11�xli't11 tll 1n,·I 1 1'1111
ticrv1r plt:'
111 n 11t lt, UXI 'Pf.H '. 1 ( 1I H-ifl 1 ¡ )/.j 1 ', IHI J/1
VtH' :1.fllc :Lcn,t r-1 í) u rn Jr1 1. 11Al( !J nH1 rú 1 l1irl 111 IIH-11' PHI d I r11 1 111 n rl,
t1 ,p 'L J�' r.l, po,1:· � r1r. ·I :n, UI Jllll , 1711 1 1 (! 11·11 J (111 l., ,r:1 . 11 �1(1
1··111,1 11If11l1
2.1 Microcontrolador.
. PALABRA DE
CONTADOR ESTADO
PROGRAMA PROGRAMA
�5TROII
R
lll, y
>LW,C9WE
ITTO
1BFOAA.
REGISTRO REGISTRO
MlllJJ.llal
TEMPORAL NDOORES
18) DIRECCIONES RAM
( 8)
Kt:\Jl;:illll1Q
.DI 111 l��All
�-..,,,• UNIDAD "�'""'"'11
u OR ARIT Kt:\Jl:ilKI I?
...., ALMACEN ETI ,- w�, _,,_111() :l
TEMPORAL ,--..
CA ...
• LOGICA
'
PILA 8 NIVELES
AJUSTE .-ro ( CAPACIDAD VARIABLE)
DECIMAL .-n
._ INT SEGUNDO BANCO
LOGIC REGISTRO OPCIONAL
A l4-FO
SALTO 14- F1
CONDI �FT
CONTROL Y TEMPORIZACION � CIONA
l
"' L �CY
u u
INT RESET PROG E A XTAL1 XTAL2 ALE PSEN SS RD WR ALMACENAMIENTO DATOS
o 1) 1 �ACC
t
Memaia M.estreo Avarce
� T BIT ACC
na!zaciál paso a
' exter111 ''Qistai'' almacenanierto . RAM INTERNA
oslackr letl1)U'al de paso , ,
M.estreo drecciaies .• 64x8
Interrupción Lecbsa Esaib.ra
3Jl1Íackr
PROM Desrtfüciál nustra
memaia
prO!fc!ma
Fig. 1
Diagrama de bloques 8048 AH/8748 AH
19
40{15
i SEL MB1
1�4 T
1----------------t--:---
1023
i
8
Dirección 7 ( vectores de
7
lnterupclón temporizador
Fig. 2
Mapa de memoria de programa
Localización O
Activando la línea Reset del procesador, causa la
primera instrucción a ser buscada desde la localización O.
Localización 3
Activando la línea de entrada Interrupt del procesador
(si Interrupt es habilitado), causa un salto hacia la
subrutina de localización 3.
Localización 7
Una Interrupción o rebasamiento del
contador/temporizador (si es habilitado), causa un salto
21
63
RAM USUARIO
32x8
32
BANCO 1
...
31
DE REGISTROS DE Direccionable directamente
TRABAJO cuando está seleccionado el
axe banco 1
t,(1
24 RO
...
23
PILA 8 NIVELES DIRECCIONABLE
O RAM USUARIO INDIRECTAMENTE A TRAVES
DE RO 6 R1
16 X 8 ( RO 6 R1 )
8
...
7 BANCO O
DE REGISTROS
DE TRABAJO Direccionable directamente
cuando está seleccionado
axe el banco O
o R1
"u
RO a R1 ( RO 6 R1 ) PUEDEN
USARSE PARA DIRECCIONAR 256
PALABRAS DE RAM EXTERNA
Fig. 3
Mapa de memoria de datos
1 All I AlO I A9 1 1
A8 A
7
1 Ae I A5 1 A4 1 A3 1 A2 1 Al I AO 1
Fig. 4
Contador de programa
POINTER
1
R23
1
111 1
22
1
1
21
11 o 1
1
20
19
101 1
18
17
10 o 1
16
15
o11 1
14
13
o10 1
1
12
1
1
11
o01 1
1
10
1
1
PSW PC 8-11 09
o00 PC 4-7
1
1
PC 0-3 R8
MSB LSB
Fig. 5
Puntero de stack
CY AC FO 1 $2 $1 so
MSB LSB
CY Acarreo
AC Acarreo auxiliar
FO Indicador o
BS Selección banco registro
Fig. 6
Program status word
Divisor
CARGAR O LEER
XTAL+ 15 --- +32
SALTO C ON INDICADOR
INICIALMENTE PUESTO A CERO TEMPORIZADORACTWADO
TEMPORIZADOR/
DETECTOR
T1 CONTADOR
FLANCOS
IMPULSOS 8 BITS
PAROT INDICADOR
REBASAMIENTO CAPACIDAD
Inicialmente no está puesto a cero
INT
Fig. 7
Temporizador / Contador
SALIDA
RELOJ
I
Puesta T
cero
Salto en test
1 áO ENTRADA
CRISTAL2 TEST
6MHzD
CONTADOR 2.5 ( 2MHz)
ESTADOS
Fig. 8
Circuitos de reloj y temporización
34
Oscilador
1K
RESET
1F
10V
Fig. 9
+SV +SV
AVANCE
PASO A PASO 10K
10K 10K
GRABACION
+SV D a SS
----1 RELOJ
BORRADO
ALMACENAMIENTO
TEMPORAL
1/2 7400
ALE
1/2 7474
Fig. 10
Circuito de avance paso a paso
Secuencia de funcionamiento
PROM
llll
PROGRAMA
+SV MASA _..........A--.
CRISTAL {
__--..i REGISTR01
PUESTA, CERO
"PASO A PASO"
REGISTR02
MEMORIA EXTERNA
.._____ LECTURA
8748
ESCRITURA
TEST { DESHINIBICION
____
..___ __ ALMACENAMIENTO
PROGRAMA
INTERRUPCION
DESHINIBICION
ALMACENAMIENTO
TEMPORAL
BUS DE DIRECCIONES
Fig. 11
Terminales del 8748
Vss 20 Masa
VDD 26 Tensión de alimentación para
programación; 25 V programando; SV
operando, tanto el ROM como EPROM.
40
MEMORIA
PROGRAMA MOV
MEMORIA DATOS
REGISTROS TRABAJC
-
ADO MOV MOi
MOV ADO ADC
ANL
MOVP
ANL
,-..ioVP3
ORL
ORL XRL
ANL
XRL xa-
ORL
XRL XCH XCH
PERIFERICOS
MOV IN
OUTL MOV
ANL
r-,c,1 E/SEN 8048
REGISTROSE/S
1,2 Y BARRA
-llw_li�ll' 8
Fig. 12
Instrucciones de transferencia de datos
44
- Indicador de acarreo.
- Indicador FO.
- Indicador Fl.
Los saltos condicionales permiten una bifurcación a
cualquier posición de una página de memoria (256 octetos)
en ejecución. Las condiciones examinadas son valores
instantáneos en el momento de ejecutarse un salto
condicional. Por ejemplo, la instrucción de salto, si el
acumulador está a cero, examina el acumulador de la misma,
no un indicador de cero intermedio.
La instrucción de decremento de un registro y salto, si
no es cero, combina una instrucción de decremento y otra
de bifurcación para crear una instrucción muy útil en la
implementación de lazos contadores.
Esta instrucción puede designar cualquiera de los 8
registros de trabajo y efectuar una bifurcación a
cualquier dirección de la página que se esté ejecutando.
La instrucción de salto indirecto de un solo octeto
permite acceder a cualquier posición de memoria basándose
en el contenido del acumulador. El contenido del
acumulador apunta a la posición de la memoria programa que
contienen la dirección de salto. La dirección de salto, de
8 bits, está referida a la página de ejecución. Esta
instrucción podría ser usada, por ejemplo, para acceder a
cualquiera de las diferentes rutinas basadas en caracteres
ASCII, los cuales son cargados en el acumulador. De esta
forma, las entradas de teclas ASCII pueden ser usadas para
iniciar diferentes rutinas.
49
2.3.18.6 Subrutinas
de voltaje.
Entre las causas y efectos producidos por los
problemas de estabilización de voltaje, se pueden
mencionar los siguientes:
- Sobretensiones; como causas son originados por
dispositivos conectados a la línea de alimentación que
se apagan repentinamente y que consume gran cantidad de
energía.
Como efectos; produce el calentamiento general de los
equipos electrónicos, causando desperfectos.
- Bajas de tensión; originados en la planta, una carga
excesiva en la planta o consumo en las horas punta.
Como efectos, pueden dañar los equipos electrónicos,
ya que se tiene la operación forzada de los equipos.
- Caída de tensión; se produce como falla momentánea por
efecto de operación en la planta, operaciones de
conmutación o arranque de grandes motores en las
fábricas.
Como efectos pueden causar daños en los equipos
electrónicos, por ejemplo en las computadoras puede
producir fallas en la fuente de alimentación,
disminución de las velocidades en el disk drive y
discos duros .
- Falla de linea de alimentación; son causados por
defectos en las líneas de alimentación de la energía
61
- Basado en microcontrolador.
- Totalmente estado sólido con conmutadores controlados de
silicio ( Triacs).
- Conmutación cuando la corriente pasa por cero, lo que
elimina la emisión de interferencia electromagnética.
- Detección de paso por cero de voltaje de salida para
sincronizar el muestreo y retención del valor del
voltaje de salida lo que permite una respuesta de
reacción a los cambios del voltaje de salida de medio
ciclo (aproximadamente de 8.3 ms. ) .
- Protección contra subvoltaje de 175 volt. Y sobrevoltaje
de 260 volt. de la entrada.
- 3 indicadores luminosos leds muestran el estado del
voltaje de entrada.
- Voltaje de entrada muy bajo.
- Voltaje de entrada normal.
- Voltaje de entrada muy alto.
- Reinicio del sistema en forma selectiva:
Manual o automática:
- Manual.- Se . podrá reiniciar el sistema presionando
un pulsador cada vez que se desee reiniciar el
66
,.... �
CIRCUITO
DE
/
CIRCUITO
SENSAOO
DE v. sAL
DE � VOLTAJE
J. ENT SENSAOO DE SALIDA
DE .___ AUTO-TRANSFORMADOR
VOLTAJE 'L
-<J- •
DE
ENTRADA
-{>-
-- - -
BANCODE
TRIACSDE �
\ AA, r-v
MAYOR PESO
-y V Y.
/\.
• +12V
FUENTES +12V
CIRCUITO
SENSORDE
4
DE
ALIMENTA +5V ,.... CORRIENTE
POR LOS TRIAC
CION
,....
1"1111
Fig. 13
comparación.
La salida VH del comparador va al P2.4 y la salida VL
del otro comparador va al P2.5 que corresponde al puerto 2
del microcontrolador.
Cuando la onda de voltaje en el condensador supera el
nivel máximo de la comparación, entonces en la salida VH
del comparador tenemos una onda de nivel alto, cuando la
onda de voltaje en el condensador baja del valor mínimo de
comparación en la salida VL del otro comparador se tiene
una onda de nivel alto como se ve en la fig. 24, las ondas
se van alternando.
Cuando el voltaje de salida está centrado alrededor de
220 voltios, osea está dentro del rango, éstas ondas tanto
el VH y el VL son iguales, solamente están desfasados.
Además el transistor Ql es muy importante, el cual
cuando el voltaje es cero está en corte y apenas pasa de
cero ya se satura, quiere decir que el transistor en un
lapso de tiempo muy pequeño genera pulsos llamemos pulso
de paso por cero ó VPO a este pulso, el diodo D5 cumple
con la finalidad de hacer llegar una señal rectificada
pero no filtrada a la base del transistor Ql.
Las ondas VH, VL y el pulso de paso por cero, se pueden
observar en la fig. 24, obtenida mediante las simulaciones
realizadas con SPICE.
Cuando el voltaje de salida comienza a subir la onda de
salida VH del comparador comienza a ensancharse y la onda
de salida VL del otro comparador comienza a adelgazarse,
si el voltaje de salida sigue subiendo llega un momento en
74
microcontrolador.
Uno de los terminales del secundario del transformador
en lugar de poner a tierra se está colocando a un voltaje
de referencia de 2.5 voltios, ya que se tiene un divisor
de voltaje respecto a 5 voltios que es el voltaje de
alimentación como se observa en la fig. 14, la razón de
colocar el par de diodos, paralelos pero invertidos es que
en este tipo de amplificadores operacionales los voltajes
aplicados en la entrada deben estar dentro del rango de
los voltajes de polarización sino la salida del
amplificador operacional se distorsiona, como este
amplificador operacional esta polarizado con 5 voltios y
tierra entonces los voltajes de entrada solo deben estar
en el rango de O voltios a +5 voltios, por eso para
garantizar esta condición se colocan los dos diodos en
paralelo pero invertidos ya que en un momento tenemos 2.5
voltios mas 0.7 voltios correspondiente al diodo dando un
resultado de 3.2 voltios, y en otro momento tendremos 2.5
voltios menos 0.7 voltios dando como resultado 1.8 voltios
ambos valores ya sea 3.2 voltios y 1.8 voltios están
dentro del rango del voltaje de polarización por lo tanto
no habrá distorsión en la salida del amplificador
operacional, si no colocamos el voltaje de referencia en
·I
uno de los terminales del secundario del transformador
tendríamos O voltios mas O.7 voltios en un caso y O
voltios menos O.7 voltios en otro caso donde uno de los
valores que es el - O.7 voltios sale fuera del rango de
polarización del amplificador operacional por lo tanto se
77
distorsiona la salida.
El valor de las resistencias R27 y R28 para el divisor
de voltaje debe ser de tal manera que no sea tan al to
comparable con la impedancia de entrada del amplificador
operacional; el condensador C9 de 1 O micro faradios de
capacidad se coloca porque en un divisor de voltaje que se
toma como referencia, siempre se coloca un condensador
para reducir probables perturbaciones de la fuente.
4.7 Diseño del circuito de banco de triacs de menor peso
vx vo
---, --
Ji-2
D3 104 1 1 �
C1 J_ C6
47 I.F
1000 I.F
25V
Ji-1
J2-1 R7 Ji-8
}�h�\±--r_
100 /2W
J_
T 1000
1 C2
� VAC I.F
J2-2 25V
Ji-7
vv
10121 /2W
Ji-10
C3
1000 I.F
10 109 1 25V
-- Ji-9
J2-3
!Y, ENf > 1 1 1 ¡ ¡
Ji-8
R4 U!I<
01'7 018
220 VAC
Ji-6
l 1
R3 R2
J2-4
U!IK 10 I.F
D
vcc - Ji-4
<QocK,I Fig. 14
J2-8 101i;;;,: 101i;;;; 1
Rl
Uf<
J2-5
FUENTES
·-__,�
2.;t< 13 N..._ U3-36
Ji� �
"'"
R25
33t(
, .. l - gN...._ U3-38
C10
.�? \ A22
- 2.21<
U3-1
!:-
R2S33t<
-+9J
R3li!I 33t(
�
Ji-2 ,1 1 h _ 1 ��
V. DIT A...TO
�
R20
Ji-1 -+9,J- � - -
2.a< - .2_,....,.,___ --· \ 1 U3-3'7
� \ R19
JJ<
r�
U3-38
es -L
22 I.F
. RiB R33
J..BK
;-
Ult<
�
R34 4'70 V. DIT BAJO
-+9JO
�
CU.20-pF'
f 2
=�;:�,-;-'u-,.:-_ ±:ir
1 a,� X2
�M7 1- _--;;-
__:e_t_ii_ii'llil!-...J..4Jfq
F
�=�
T0
·-- �
.liil
1
Pl.0 P2.0
�P2.1
Pl.1 87
========:rl1l�t�i
Pl.2 P2.2
Pl.3 P2.3
P2.4 �
EA
NC)RtW...
LED10
NODO
Fig. 16
PlLSADOR
.JlA-11-EZA f-HUEIA
PROCESADOR
AUTO�
T -· R9 0
-vv
�
LEDi � 1 1
l
xso
TRl _j_
�
�
LED2 * 1 ll
CS02
�
LEIX3 ..L 1 1 1 =�
l.ED4
TR4
�
Ji-7
+
+9J Ji.-5
R:38 47121
-+'SJ .---r--n!i \A)C +
-+9J R3? 4"70
1
-+'SJ�
1 1 esos
1 J
�
l_J TR6
Fig. 17
LED7
TRB
LED8 ce
0. llF
90
voltios
10 REM "trafo"
20 CLS
30 LPRINT " TABLA DE ENTRADA/ SALIDA "
40 LPRINT " ---------------------"
50 LPRINT
60 LPRINT
70 LPRINT " Este es un cálculo por computador de la
salida"
75 LPRINT " mas cercana a 220 VOLT. de un
autotransformador "
80 LPRINT " con 8 tomas en el primario dispuestas en 4"
85 LPRINT " superiores x 4 inferiores lo que da 16
combinaciones"
90 LPRINT " (una superior y otra inferior)"
95 LPRINT " Las tomas del autotransformador se muestran
en la fig."
100 LPRINT " y son las que se medirían si el voltaje de"
110 LPRINT "entrada es 220 voltios, la entrada se hará
variar desde"
120 LPRINT "175 voltios hasta 255 voltios"
140 LPRINT "El programa calcula la combinación que da la"
150 LPRINT "salida mas cerca a 220 voltios y se imprimirán
el voltaje de"
160 LPRINT "entrada,salida y la combinación"
91
680 H=J
690 RETURN
700 INPUT A$
710 LPRINT
720 LPRINT
730 LPRINT
740 LPRINT "ENT (VOLT) SAL VOLT) TOMA COMB"
750 LPRINT "---------- "
760 LPRINT
770 RETURN
780 DATA 0,20,40,60,235,240,245,250
TABLA DE ENTRADA/SALIDA
207 222.1464 9
208 217.9048 8
209 218.9524 8
210 220 8
211 221.0477 8
212 222.0953 8
213 217.9535 7
214 218.9768 7
215 220 7
216 221.0233 7
96
/* trafo */
float min, delta, vvs = 0,vy;
int v[8]={0,20,40,60,235,240,245,250};
float vs[16],k[16], vc,gamma,omega;
main ()
{
98
clrscr();
printf(" TABLA ENTRADA/SALIDA\n");
printf(" --------------------\n");
for (n=0;n<=7;n++)
{ printf (" V(%d)= %d\n",n,v[n]);
}
for(q=l;q<= 4;q++)
{printf ("\n");
}
{printf("\n");
}
printf(" %d %d\n",gamma,omega);
printf("para el rango de entrada 175-255 voltios se
tiene\n");
printf("los siguientes voltajes de salida minimo y
máximos \n");
printf("\n\nVS min = %d volt vs max= %d volt\n",
220-gamma,
getch();
}
gosub660 ()
{ min=delta;
vvs= vs[j];
h=j;
}
gosub700()
{
242 221.8334 2
243 218.2041 1
244 219.102 1
245 220 1
246 220.898 1
247 221.7959 1
248 218.24 o
249 219.12 o
250 220 o
251 220.88 o
252 221.76 o
253 222.64 o
254 223.52 o
255 224.4 o
Para el rango de entrada 175 - 255 voltios se tiene
los siguientes voltajes de salida mínimo y máximo:
VS min = 217.5556 volt. VS max = 224.4 volt.
4.12.3 Diagramas de flujo para el programa de control
INHIBIR
TRIACS
NO
SI
NO
NO SI
DELAY
5 SEG.
SI
HABILITAR
TRIACS
COMBINACION (O)
DELAY 1 Seg.
DIAGNOSTICO
Fig. 18
Diagrama de flujo general
1/6
DIAGNOSTICO
Al. PVO
(R7) = 14
- -
MIDE PV(O)
PINTO
� 1 1 +- (R4)
f.- (RS)�
FALLA SI
SI
FALLA
SI
FALLA
SI
FALLA
DIAGNOSTICO
PI (O)
Fig. 19
Diagrama de flujo general
2/6
DIAGN. Pl(O)
(R7) = 14
PI (O)
MIDE Pl(O)
PINT1
.. t
(R )
_. 1 3 1 .,_
�, (R2), .-
FALLA SI
SI
FALLA
SI
FALLA
SI
FALLA
SI
ESTABILIZADO
Fig. 20
Diagrama de flujo general
3/6
ESTABILIZADOR
REF TIEMPO
(R5)=(R2)-6
DELTA
100MS
..;..;.Nº
>- -=----•C
INICIO )
SI
NO
SI
Fig. 21
Diagrama de flujo general
4/, 6
T=O
RUN TIMER
A=R5
SI
SI
NO
T=A =R5
A=R6v R7
SI
SI NO
(ABORTA)
Fig. 22
Diagrama de flujo general
5/6
SI
NO
T=A=R5
A=R6vR7
SI
SI NO
STOPTIMER
A P1
CNT
Fig. 23
Diagrama de flujo general
6/6
111
control
\\SERVICIOS DE
INTERRUPTS
000 15 DIS I
001 04 0B JMP $00B
003 15 DIS I INT\
004 35 DIS TCNT I
005 24 80 JMP $180 FALLA# 1
007 15 DIS I T INT\
008 35 DIS TCNT I
009 24 90 JMP $190 FALLA # 2
------------------------------------------------
\\PROGRAMA DE
DIAGNOSTICO
00B 05 EN I
ooc 23 F7 MOV A,#F7
00E 3A OUTL P2,A
00F 39 OUTL Pl,A
010 09 IN A,Pl
011 D2 15 JB6 $015 MODO ESTAB.
013 24 30 JMP $130 MODO PRUEBA
015 B2 1B JB5 $01B AUTOTIMER
017 92 oc JB4 $00C PULSADOR
112
077 37 CPL A
078 6B ADD A,R3
079 E6 7F JNC $07F
07B EF 59 DJNZ R7,$059
07D 04 07 JMP $007 FALLA # 2
07F FB MOV A,R3
080 03 08 ADD A,#08
082 37 CPL A
083 6D ADD A,R5
084 E6 8A JNC $OSA DIAGNOST. OK
086 EF 59 DJNZ R7,$059
088 04 07 JMP $007 FALLA # 2
------------------------------------------------------
\\PROGRAMA DE
ESTABILIZADOR
OSA 34 E0 CALL lE0
ose 00 NOP
08D 00 NOP
OSE 00 NOP
08F BE 00 MOV R6,#00 VAR. DE SALIDA
091 BF 70 MOV R7,#70 MASK
093 85 CLR FO
094 95 CPL FO
095 AS CLR Fl
096 B9 00 MOV Rl,#00
098 BA 01 MOV R2,#01
09A 34 70 CALL $170 DELAY 100 ms
09C 0A IN A,P2
115
\\RUTINA DE
RETARDO 1 Seg
0D8 35 DIS CNT I
0D9 23 00 MOV A,#00
0DB B8 lD MOV R0,#lD
0DD 62 MOV T,A
0DE 55 STRT T
0DF 16 E3 JTF $0E3
0El 04 DF JMP $0DF
0E3 ES DF DJNZ R0,$0DF
0ES 65 STOP TCNT
0E6 83 RET
\\RUTINA DE
RETARDO S Seg.
0E8 BB 05 MOV R3,#05
0EA 14 D8 CALL $0D8
0EC EB EA DJNZ R3,$0EA
117
0EE 83 RET
\\RUTINA DE
RETARDO 33 ms.
0F0 23 00 MOV A,#00
0F2 62 MOV T,A
0F3 55 STRT T
0F4 16 F8 JTF $0F8
0F6 04 F4 JMP $0F4
0F8 65 STOP TCNT
0F9 83 RET
\\RUTINA DE
RETARDO 100 ms.
170 B8 03 MOV R0,#03
172 14 FO CALL $0F0
174 E8 72 DJNZ R0,$172
176 83 RET
\\RUTINA DE
SALIDA
100 23 00 MOV A, #00
102 62 MOV T,A
103 55 STRT T
104 FD MOV A,R5
105 56 15 JTl $115
107 45 07 JNTl $107
109 62 MOV T,A
118
\\RUTINA DE
RETARDO 100 ms.
170 B8 03 MOV R0,#03
172 14 FO CALL $0F0
174 ES 72 DJNZR0 ,$172
176 83 RET
\\RUTINA
FALLA # 1
180 23 FO MOV A,#F0
1E4 37 CPL A
lES 03 08 ADD A,#08
1E7 AD MOV RS,A
1E8 83 RET
4.12.5 Análisis del programa
5.0U-¡-
1\ '
4.0U �
....,, " "" ,..-------.."fr 1 ------,,/f----:
3.0I.I�
1 ::¡!
:I
,1
2.0tH •I
,¡
;i
1.0U�
:!,¡
,·
1 l
Os
J l
1 Ollls
l ] 1, �
2 01115
_J. �
3 OIIIS
¡� �
4 Olas
J t ) _I �l 1 1
ou+----------------------7-----------------------r----------------------7---··------------------- r----------------------7-----------------------1I1
s 01115
JL
6 IJAs
o U(Q1:c) o U(U2A:S) 9 U(U1A:5)
Tillle
Q)
llJ -=-·_.=--
R..... 'O
�
'
CJ
J 1) 3Q 1-f t-
omo
·r-1
((¡
o o o
Q)
m LE 4 R4 Cú
�
Q 09
l.()
c:::J
0 · --
j" ....1 .:,
-
.
N
0 11 !°
(I'¡
U3 �
00
:t J
...i
ftJ '·il
0 4
ií1
Q ¡_.
[]u
r iLc
t-
1 01
·r-1
o
·r-1
.µ
·n
.µ
O ºLO
t\ :t
l
Q)
(1� R -�7 "' Cú
o
jí¡
1Y10 (1J (1) 00
t·-.
-.
o
o
� ::1 �
·
U:: CC: E CC: ú. RS
1 11 (I'¡
. u
lfl . ·r-1
1\
fi.1=·
c:J
J LEOSQ
.µ
Cú
�
ª e: ,,J rl
-Q.1-1[J 11-
u
-:1
]
t-
"' u, .-.·[
R '.:-9 rl
t·- u oo 01.1.'
...
i,il RE- 'O 'O
fi:20 R14
CJ
r
R 24 . c:J LEo.:-.O 1�1 J
Q)
··C
Q)
Cú
ai;Q i-.[J U �
c::J
fi:19 R2'.:= c:J
111
o
CJ
R1 ::: R 22 c:J R7
Dooo �- :DQ�� � �u . o o otº'·,
fu LEO 7 . c-
R1--
il) O
CJ
t·.- ··(
Q)
1�
0
j1J IJl 07Q ! U � w
o
f/)
IJi LEO R
& S R16
o ;¡ i_r ""'_ o ¡1J ase--> '�
� 1-1 i.oo o
1_1 (i:C
l
� fl �,
IL II iL t-
�
TARJETA DE CONTROL
ESTABILIZADOR
o 1 ·-' 1
T4'.l( 4C D
I a
a a a
a ªª aa Da
I
D D a
D Da D a a
aaa D a a
a aa
-
a D a D D D a a
a a a a ªª a a a a a
a a
a a
a a a a
ªª a a a a
a
a
a a
a a ªªªªªªªªªªªªªªªªªªªª
ªªªa ªªa a
a
a a
ªªªªªªa a
a
a
ªªªªªªªªªªªªªªªªªªªª
a a a
a a
aa a a
ªªªªªªªª a a
I
a
a a a a a a
a a a a
a a a ªªªªªªªª a a
ªªª
I I I ·I I I I I
a a
a a a a
a
a a a a
a a a a a a a a a a a a a a a
a a a a a a a a a
a a a a a a a a a a a a a a a a a
a a
a aaa aaa aaa aaa aaa aaa a aa aaa
a aa aa aa a a aa aa aa a
a aa aa aa a a aa aa aa a
aaa aa a aaa a a a aaa aaa aaa aaa
a a a a a a a a
o o
a a a a a a a a
a a a a a a a a a
Fig. 2 6
....
t
-
:Il ITI
o
- o
1.11 e::::)
-1 1'1.1
r,J
,:)
,:) "TI
:,, e
-1 z
ITI
:,,o�
CJO + -1
,¡, }<; ITI
O(=:) + ,,,
n
-
'� c:::J o
,:... 1))
....
'f Vc:=::)C•:9
c:=)010
e:=) C•11 o '
l'l,I
(=:)012 013CJ
o�c=J
C=:J O 14c:::::)
f.: 1 D15c:::J
o
ºO
:;;
016(=:)
R4
o T2 o
e.•....•t=t•=
o o
Fig. 28
a a o a
a
a a
a a
a a a
a a a
a a a
a
a a a a
a
a a
a a a
a a
a a
a
a a a a
a a a
a
a a
a a a
a
a
a
a a a
a a
a
o
a a a a
a a a
a
a a a
a a a
a a a a a
a a
a a
a a a a
a a a a
a a
o o
o o
a a
Fig. 29
IJ:[1
..&'.J-1
fr}
.JJIJJ
t
::<.L
tlJJ
-ICI
.. •'}
IJJ
IJ-1
t:S:
>::IJ.I
ia te
-1.JJ
Fig. 30
Rl = 1000 1/2 W.
R2 = 1000 1/2 W.
R3 = 1000 1/2 w.
RS = 1000 1/2 w.
R6 = 1000 1/2 W.
R7 = 1000 1/2 W.
R8 = 1000 1/2 W.
R9 = O. 470 5 W.
Rl0 = O. 470 5 W.
Rll = O. 470 5 W.
Rl2 = O.470 5 W.
R13 = O. 470 5 W.
R14 = 0.470 5 W.
Rl5 = O. 470 5 w.
R16 = O.470 5 w.
R17 = 18 Kn 1/4 w.
R18 = 1.8 Kn 1/4 W.
R19 = 1 Kn 1/4 W.
R28 = 33 Kn 1/4 w.
R30 = 33 Kn 1/4 W.
R31 = 4700 1/4 W.
R32 = 10 Kn 1/4 W.
R33 = 10 Kn 1/4 W.
R34 = 4700 1/4 W.
R35 = 4700 1/4 w.
R36 = 10 Kn 1/4 W.
R37 = 4700 1/4 w.
R38 = 3300 1/4 w.
R39 = 4700 1/4 W.
R40 = 10 Kn 1/4 W.
R41 = 3300 1/4 W.
Potenciómetros:
Pl = 50 Kn
P2 = 50 Kn
Condensadores
Cl = 0.1 UF Poliester 250 volt.
C2 = 0.1 uF Poliester 250 volt.
C3 = 0.1 UF Poliester 250 volt.
C4 = 0.1 uF Poliester 250 volt.
es = 0.1 UF Poliester 250 volt.
C6 = 0.1 UF Poliester 250 volt.
C7 = 0.1 UF Poliester 250 volt.
es = 0.1 UF Poliester 250 volt.
IS0l - IS08 = Optoacoplador T9123
TRl - TR8 = Triac BTA08
141
U3 = Microcontrolador D8749H
Ql - Q8 = Transistores 2N3908
Q9 = Transistor 2N3904
LEDl - LED8 = LED
LED9 - LEDl0= LED
Transformador con 8 devanados en el primario
4.12.8 Limitaciones del diseño
R12
10k
R2
D1N4148 18K 75
18K
�o
R5 o
D1N4148 32K
D4 D5 V3
V
V
Rlj�
U2A
t
10k O
D1N4148 +
1
D2 R4
D3 18K R3
D1N4148 2.2K
1
V
I
V6 Q1
Q2N3904
o o
!\
/ ·\
/\ '
J
I '· \,
\
'·
I '
2 .51:f �
\ /\
,,,.,.,____
�'
/
L
I ·¡ / / \ /
/.
.L
.\___,/
1
\
\
.
/
1
\v_J. \
1
\..,V .· \._;.
2.0U � . . •
·-.,
\_; .
¡I \. /
1\ : /
1.5U � 1
1
. . j
1.0U �
1
1
1
1
j
1
:,1
1
l
1
o.su�
OU +-'- - - - - - - - - - - - - - - - - - - - - - 7 - - - - - - - - - - - - - - - - - - - - - - - r - - - - - - - - - - - - - - - - - - - - - - , - - - - - - - - - - - - - - - - - - - - - - - r - - - - - - - - - - - - - - - - - - - - - - , - - - - - - - - - - - - - - - - - - - - - - - i
Os 10ms 20ms 3111115 40ms 50cils 60llls
o U(R5:1) o U(R2:2) 9 U(R3:2)
Th1e
Date: May 13, 1998 Page 1 Tillle: 22 :48 :16
• c:,..silirEO�ij\iiieza1.scfi
Date/Ti111e run: 05/13/98 22:19:53 Tel!lperature: 27.8
(A) C:\HSIHEU54\MEZA1.DAT
12u�---------------------------------------------------------------------------------------------------------------------------------------------.
1 \
,
'
1 1
r- - -- - f \ - - I \ - - / \: - /\ : / \
100 �
'
1
I
su�
I
'
'
,1
' t
(
,!
:i,,
6U� •!
'
' ' ' \ '
¡
fi, ' .
1
,¡
1¡
. 1 ..
/¡
1
4U� ��
-¡1 '
I
, ,• , ,
I. -•¡
··11
:k. ---------------------_¡\ :_--------------- -------�. ----- --------------- --�------------�-�-�J
� � � l
1
i1 '
DO
� 1� 2� 3� 4� 5� 6�
o U(Q1:c) o U(RS:2)
Tillle
Date: Hay 13, 1998 Page 1 TiP1e: 22:38:26
• C:\MSIHEU54\meza1.sch
Date/Ti111e run: 65/13/98 22:19:53 Te111perature: 27.8
(A) C:\MSIMEU54\MEZA1.DAT
6-ffll�--------------------------------------------------------------------------------------------------------------------------------------------,
5.0U
\ I
.--:' !
l
j
i
l
.....
!
4.0U�
1
1 1 f
1
/ :¡
:1,,
I
¡
'1!
1
1 1 1
·I
1
1
1
'1
1
1
i
1 1
_¡l
:,
1 f'
1
/ ,�j \
1
3.UU�
1
¡i.·
,-',.. i
'".J
/·---
il
1
// \{ ,,
, 1 /.· /',
T/'-.... '-... \ .... ........
/
.. , '
'\ 1
l
.,,------._ / !
/ ', I
/
,u
/
\1 I _, - 1 \.
...__/<
/ j
/
\
:1. l'-'·,_.,,,
1 1 t
1\1
•\
i [\
l.}.
'\
./
/ /
1 1
,,
2.0U� j :·,_,.",
_
,.-----._ i� . / / \�,,/
..-----:
,,
I
1
/
i
/ 1 "/
..__/
,
1
1
1
J
f
1.80� .1 '
u·
/
/ 1
1. !
1. '
. ; 1
1 l J 1 1
1
1 1
, 1
!
• 1 •
1
ftU 1 ; ! ' \ :
' ----------------------
/ -----'--- ---_,._--�� ___,-- - -- ---- - - --- - ------------
7-----------------------r --------------------- -7-- - ------=-=-=-=-=-=-�--- ----r - - - -1 ------- 7 -------::--::-i
Os 1 OIIIS 2 Oltts 3 Ottts 4 OlltS 5 01115 6 Orils
o U(R5:1) o U(R2:2) � U(R3:2) U(U1A:5) o U(U2A:5) + U(Q1:c)
Tillle
' ------------------------------------------------------------------------------------------------------------------------------------------
12u�--
1
•
·/\. -i\-
·(\\1.•
-¡(\ .
1ffl.l�
X \ /
/· · .
I/\\\
A
.\\
I \1 /�\\
! , J. \ .
f ¡
I . I
I
\
í\
/.
I¡ . \\ / \· ./ \
I·
' /
su�
1
J \
1 ·/ -� /· ·t I.
; V'
j¡
,!
:!
,,
l1 \\
. \_ / 1 / 1
,,·I
!
J/·· J
II/ í\, · í/ \1 \11\ . I \,. ¡t \
1/
-í· /
•• ;, fI . 1i /i . \ . ./
\ I
\. . I . . . . I
\·\ ¡· . 1 1
/¡'. r
.
I
1 '
. \ /I
1
11 i .
1 i / \' ¡
\
\ ¡: i
¡·, X� -/ I
[
\. I
· \rI /nl
¡
¡ \X /,r1
/
\Y.,·
::- / \)' ¡'
\1
i I¡¡: 1¡
'1 ,.1 '
1 1 H--+----r-. 1 1
\ ·/ 11 . \. , /'
FTi.
¡ /. Y y
f
1
l:y \\
:(,
1¡ 1
, /. !I
\ 1
íl 1 ! / :
\ , \ 1 1 1•
i
• i
.
F /
; 1/
1 1
\ 1 I 1 1 .
......r¡,- ,· -� /�C7 _!'\. . /¡· ':'
1: 1 \ /
. ' t1 !I i1 ,,..-�i
\ 1 ·1 /
\1 1
<
\ / 1 ./ ¡¡·
l ti-----.·
• ..<:.._/� \1 \.
1 LJ____"____ 1 / -��i -
,,v11ri·[,_I --71
/-- --v�\+¡1
�--- ,..,_____ ---· ' · -
1 1 J.ni'-----:
A _.-------.., '
. ._____..,
. 1'--------/� 11 -•
//�
, . 1 ___,./ \-�-�._:___./' .
��J,. . t1 \ 11 : ,1·
\ /' .µ
·11 11 1
1/
2u� I ./
ii
1 !
L
,1
l .
11
� I . \·_" . // .
�� . . '\
1 � '1
. !
¡.,-
: ·¡ :1
L> i,
1 .i.
·;,:
l., ,,
/ ji
;I'
1
1
--���--� --- 1' JJ1!� t
:
'j //
) ¡' i
1 ·
:¡¡ /"
ffll +-� - 1. - - - - -
l
- - - - - - - - - -�-,�--- "T - ¡ - - - - - - - ---:. - .:. - - ---=--= - - - - - r ---- �-
J J: :..--=-_-=-=-=--:;- · 1·= � - .: - - _I_L��-· - - - --- -- ��c�_Lc-�-=-=J�
Os 10111s 2 OIJls 3 0111s 4hs 5 Olls 6 Ollls
o U(RS:1) o U(R2:2) 9 U(R3:2) U(U1A:5) o U(U2A:5) + U(Q1:c) x U(RS:2)
Tillle
IN A,P_· FETCH
I INCREMENT.
IHSTRUCTION PAOQRAM COUHTER
ºINCREMENT
; TIMER
REAO
PORT
:!!.
ORL P, • DATA FETCH INCREMENT
INSTRUCTION PROORAM COUNTER
FETCH INCREMENT
ºINCREMENT
lll,,IER
IHCREMEHT
I 11 IM DIATI! DATA
.
;
RE.AD·.
INCREMENT
1
ºOUTPUT
-..•' 1 PROORAM COUNTER TO PORT
.. - (/)
z
INS Á, BUS -: PORT i
(C
INSTRUCTION PROGRAM COUNTER 'TIMER
-
G)
...... _ OUTL BU A .·. 1 FETCH I
INCREMEHT ;
1 · _ 1
IHCREMENT OUTPUT ! 1
,:. r
...... · S. ·· I NSTRUCTION PROORAM COUNTER ' TIMER TO PORT \ 1 ;- \,
.. � m
CX1
�
ANL BUS • DATA FETCH
.
; IHCREMEHT
'·· . INSTRUCTION PROGRAM COUHTER :
_ . ,·· ºINCREMENT
: TIMER
.
READ PORT \
I
·: ! FETCH .
IMlolEDIATE DATA .
;_: · INCREMEHT
, ·• PROGRAM COUNTER
.
ºOUTPUT
TO PORT
o . ·,•,
,
� . ORL BUS, �·DATA FETCH . IHCREMENT ' �
1
.• ºINCREMENT READ P:ORT.!
..
.
FETCH , . !._,,
I
1 INCREMENT ºOUTPUT _
�:_
o .•:;-�})
.�
:::C · · INSTRUCTION PROQRAM COVNTER • .. ,· ·' TIMER ! ¡ IMMEDIATE DATA PROGRAM COUHTER TO PORT 1
......
'
oi· '
� '
MOVX R A:�. . FETCH .
@ ' · ·
: IHCREMENT
INSTRVCTION PROGRAM COUHTER
FETCH ·.
: OUTPUT RAM.
. ADORESS
INCREMEHT
: Tll,IER
OVTPIJT."'!
DATA TO RAM
· 1- • :_ :
1
'
: :
L _.
. '._' ,
•
.__ RtAO
.!
.1
zm
z
� MOVX A,@R . IHCREMENT OUTPUT RAM INCREMENT _;! :: ;• \ ¿ ·C.
., . . .;
· · , · 1 • �
1\)
:I: IHSTRUCTION PAOQAAM COUNTER ADDRESS ' TIMER (. DATA .
:, FETCH INCREMEHT OUTPUT INCREMEHT _ : ; 1 :_ ·•· AEAD P2
3::
MOVD A.P1 I • . ' ·. ()
..
� INSTRUCTION PAOORAM COUNTER OPCODE/ADDRESS ' TIMEA LOWER
2 ¡. _ ,�
(J)
MOVD p1.A . íETCH INCREMENT OUT.PUT INCREMEHT OUTPUT DATA ·. ! 1.._ _ 1 1 _ , 1
� . INST RUCTIOH PROCAAM COVNTER OPCODE/ADDAHS : TIMER TO P2 LOWlA
CX)
g· AIRO P,A
: · · ··
FETCH IHCREMEHT OVTPVT
INSl RUCTIOH PROGAAM COUHTER OPCODE/ADDAESS
INCREMENT
; TIMER
OVTPVT , : , • L ,
· DATA . : -' 1 '
¡
:
-i -< ·-<
3· ORLO P,A . íETCH IHCREMEHT ; OUTPUT · INCREMENT _ OUTPUT 1 , ·. •. .• :..:_). • : _ . _ .• : ; 1 • __ 1
(/) ' .
:, , · INSTRUCTIOH PROCRAM COVHTER OPCODE/ADDRESS ·! TIMER · DATA , 1 , . ,.. !' . l -i. :;.·
.
m .-·--..·
FETCH IHCREMEHT'
'
tQ · J(COHDITIOHAL) , SAMPLE ºIHCREMENT :·_, •. ! l FETCH • :_ l UPDATE I• _ 1 ·- 3:: a
2 . ___ __ INSl RUCTION PROORAM COVNTEA .! CONDITIOH. SAMPLE ' • . '. IMMEDIATE DATA PROGRAM COUHTEA
CD
ce
STAT T ·
STRT CNT'
l'ETCH
I
IHCAE1,iEHT ·
INSTRUCTIOH PAOORAM COUNTER
•;· - START
COUNlER
STOPTCHT. FETCH INCREMEHT STOP
IHSTRUCTION IPROGRAM COUHTER COUHTER
EHI FETCH · IHCREMENT ENABLE
1
0
ADD A,Rr Add Reglster Contents to Accumulator ADDC A,@R1 Add Carry and Data Memory Contents to Accumulator
ADD A, @RO ;ADD VALUE OF LOCATION a dded to the a ccumulator. Carry is affected.
;31 TO ACC
Operatlon: (A) - (A)+ data + (C)
ADD A, #da ta Add lmmedlate Data to Accumulator Example: ADDC A,#225 ;ADD CARRY ANO '225' DEC
;TO ACC
Encoding: ! O O O O l O O 1 1 J I d7 d5 d5 d4 1 d3 d2 d1 do ] 03H
Descriplion: This is a 2-cycle instruction. The specified data is a dded to lhe a ccumulato ANL A, R r Loglcal ANO Accumulator wlth Reglster Mask
r.
Carry is a ffected.
Encodlng: 1 O l O 1 l 1 r r r 1 58H-SFH
Operation: (A) - (A) + data
Descrlptlon: Data in the a ccumulator is logically ANDed with the mask contained in
Example: ADDID: ADD A,#ADDER: · ;ADD VALUE OF SYMBOL working register 'r'.
;ADDER' TO ACC �·
Operatlon:
. (A) - (A) ANQ,.(Rr) r = 0-7
ADDC A, Rr r
Add Carry and R egister Contents to Accumulator Example: ANDREG: ANL A,R3 ;'ANO' ACC CONTENTS WITH MASK
;IN REG 3
Encoding: j O l 1 1 1 1 r r r 1 78H-7FH
Descrlpllon: The content of !he ca rry bit is a dded to accumulator location ANL A,@ R i Loglcal ANO Accumulator wlth memory Mask
O and the
bit cleared. The contents of register 'r' a re then added to the a ccumul carry
a tor.
Carry is affected. Encodlng: 1 O 1 O 1 1 O O O i 1 50H-51H
Operation: (A) - (A) + (Ar) + (C) r = 0-7 Descrlptlon: Data in the accumulator is logica lly ANDed with the mask contained in the
Example: ADDRGC: ADDC A,R4 ;ADD CARRY ANO REG 4 data memory location referenced by register 'i' bits o-s··.
;CONTENTS TO ACC Operatlon: (A) - (A) ANO ((Ri)) i = 0-1
•• 0-5 in 8048AH/8748H Example: ANDDM: MOV R0,#03FH ;MOVE '3F' HEX TO REG O
0-6 in 8049AH/8749H
ANL A,@R0 ;'ANO' ACC CONTENTS WITH
0-7 in 8050AH
;MASK IN LOCATION 63
•• 0-5 In 8048AH/8748H
0-6 in 8049AH/8749H
0-7 in 8050AH
3-8 3-9
MCS®-48 INSTRUCTION SET MCS®-48 INSTRUCTION SET
Encodlng: 1O 1 O 1 1 O �
O 1 1 l I d7 d5 d5 d4 1 d3 d2 d1 do 1 53H ANLD Pp,A loglcal ANO Port 4-7 wlth Accumulator Mask
Descrlptlon: This is a 2-cycle instruction. Data in the accumulator is logically ANOed Encodlng: l 1 O O 1 l 1 1 p p 1 9CH-9FH
with an immediately-specified mask. Descr!ptlon: This is a 2-cycle instruction. Data on port 'p' is logically ANDed with the
Operatlon: (A) - (A) ANO data digit mask contained in accumulator bits 0-3.
Examples: ANDID: ANL A,#0AFH ;'ANO' ACC CONTENTS Operatlon: (Pp) - (Pp) ANO (A0-3) p = 4-7
;WITH MASK 10101111 Note: The mapping of port 'p' to opcode bits 0-1 is as follows:
ANL A,#3 + X/Y ;'ANO' ACC CONTENTS 1 O Port
---
;WITH VALUE OF EXP
;'3 + XY/Y'
ºº
O 1
4
5
1O 6
ANL BUS, #data• Loglcal ANO BUS wlth lmmedlate Mask
11 7
Example: ANOP4: ANLD P4,A ;'ANO' PORT 4 CONTENTS
Encoding: l 1 O O 1 j 1 O O O 1 1 d7 d5 d5 d4 1 d3 d2 d1 do 1 98H ;WITH ACC BITS 0-3
Descrlpllon: This is a 2-cycle instruction. Data on the BUS port is logically ANOed
with an immediately-specified mask. This instruction assumes prior CALL address Subroutlne Cal!
specification of an 'OUTL BUS, A' instruction,
Opera_tlon: (BUS) - (BUS) ANO data
Encodlng: 1 ª10 a9 aa 1 1 O 1 O O 1 1 a7 ª6 a5 a4 j a3 ª2 ª1 ªo 1
Page Hex Op Code
Example: ANDBUS: ANL BUS,#MASK ;'ANO' BUS CONTENTS
O 14
;WITH MASK EOUAL VALUE
1 34
;OF SYMBOL 'MASK' 54
2
3 74
ANL Pp,#dala loglcal AND Port 1-2 wlth lmmedlale Mask
4 94
5 84
Encodlng: j1 o o 1 ¡1 O p pI J d 7 d6 ds d4 1 d 3 d2 d1 dol 99H-9AH 6 ,.D4
' F4
7
Descrlption: This is a 2-cycle instruction. Data on port 'p' is logically ANDed with an
immediately-specified mask. Descrlptton: This is a 2-cycle instruction. The program counter and PSW bits 4-7 are
saved in the stack. The stack pointer (PSW bits 0-2) is updated. Program
Operatlon: (Pp) - (Pp) ANO DATA p = 1-2 control is then passed to the location specified by 'address'. PC bit 11 is
Example: ANDP2: ANL P2,#0F0H ;'ANO' PORT 2 CONTENTS determined by the most recent SEL MB instruction.
;WITH MASK 'FO' HEX A CALL cannot begin in locations 2046-2047 or 4094-4095. Execution
• For use with interna! program memory ONLY.
;(CLEAR P20-23) continues at ihe instruction following the CALL upon return from the
subroutine.
Operallon: ((SP)) - (PC), (PSW4_7)
(SP) - (SP) + 1
(PC 8_10} - (addr8_ 10)
(PC 0_7) - (addr0_7)
(PC 11) - DBF
3-10 3-11
MCS�-48 INSTRUCTION SET MCS®-48 INSTRUCTION SET
Example: Add three groups of two numbers:Put subtotals in locations 50, 51 and
total in location 52. CLR FO Clear Flag O
MOV R0,#50 ;MOVE ·so· DEC TO AOORESS
;REG O Encodlng: i 1 O O O I O 1 O 1 1 85H
BEGADD: MOV A,R1 ;MOVE CONTENTS OF REG 1
Descrlptlon: Flag O is cleared to zero.
;TO ACC
ADD A,R2 ;ADD AEG 2 TO ACC Operatlon: (FO) - O
CALL SUBTOT ;CALL SUBROUTINE 'SUBTOT'
ADDC A R3 ;AOD REG 3 TO ACC CPL A Complemenl Accumulator
ADOC A,R4 ;ADD REG 4 TO ACC
CALL SUBTOT ;CALL SUBAOUTINE 'SUBTOT' Encodlng: 1 O O 1 1 1 O 1 1 1 1 37H
ADDC A,RS ;AOD REG 5 TO ACC Descrlptlon: The contents of the accumulator are complemented. This is strictly a one's
AODC A,R6 ;ADO AEG 6 TO ACC complement. Each one is changed to zero and vice-versa.
CALL SUBTOT ;CALL SUBAOUTINE 'SUBTOT'
Operatlon: (A) - NOT (A)
SUBTOT: MOV @RO.A ;MOVE CONTENTS OF ACC TO
;LOCATION ADDRESSED BY Example: As sume accumulator contains 0110101 O.
;AEG O CPLA: CPL A ;ACC CONTENTS ARE COMPLE
INC RO ;INCAEMENT AEG O ;MENTEO TO 10010101
AET ;AETUAN TO MAIN PAOGRAM
CPL C Complemenl Carry Bit
CLR A Clear Accumulator
Encodlng: l 1 O 1 O I O 1 1 11 A7H
Encodlng: 1 O O 1 O I O 1 1 1 J 27H Descrlptlon: The setting of the carry bit is complemented; one is changed to zero, and
Descrlptlon: The contents of the accumulator are cleared to zero. zero is changed to one.
Operatlon: A - O Operatlon: (C) - NOT (C)
Example: Set C to one; curren! setting is unknown.
CLR C Clear Carry Bit CTO1: CLÍ},c·· ;C IS CLEAAED TO ZEAO
CPL C ;C IS SET TO ONE
Encodlng: l 1 O O 1 1 O 1 1 1 1 97H
Descrlptlon: During normal program execution, the carry bit can be set to one by the CPL FO Complement Flag O
ADO, ADDC, RLC, CPL C. RAC, and DAA insructions. This instruction
resets the carry bit to zero.
Operatlon: C - O Encodlng: l 1 O O 1 1 O 1 O 1¡ 95H
Descrlptlon: The setting of flag O is complemented; one is changed to zero, and zero is
CLR F1 Clear Flag 1 changed to one.
Operation: FO - NOT (FO)
Encodlng: l 1 O 1 O I O 1 O 1 1 ASH
CPL F1 Complement Flag 1
Descrlpllon: Flag 1 is cleared to zero.
Operatlon: (F1) - O
Encodlng: l 1 O 1 1 1 O 1 O 1/ BSH
Descrlptlon: The setting of flag 1 is complemented; one is changed to zero, and.zero is
changed to one.
Operatlon: (F1) - NOT (F1)
MCS�-48 INSTRUCTION SET MCS®-48 INSTRUCTION SET
o ooooooo OVERFLOW TO C Descrlpllon: This is a 2-cycle instruction. Register 'r' is decremented, then tested for
zero. ff the register contains ali zeros, program control falls through to the
DEC A Decrement Accumulator next instruction. ff the register contents are not zero, control jumps to the ·
specified 'address'.
Encodlng: 1 O O O O I O 1 11 j 07H The address in this case must evafuate to 8-bits, that is, the jump must be
Descriplion: The contents of the accumulator are decremented by one. The carry flag to a location within the current 256-location page.
is not affected. Example: (Rr) - (Rr) -1 _, r = 0-7
Operation: (A) - (A) - 1 lf Rr not O ,,-,
Example: Decrement contents of externa! data memory location 63. (PC0_7) - addr
MOV R0,#3FH ;MOVE '3F' HEX TO REG O Note: A 12-bit address specification does not cause an error if the
MOVX A, @RO ;MOVE CONTENTS OF DJNZ instruction and the jump target are on the same page. lf the DJNZ
;LOCATION 63 TO ACC instruction begins in location 255 of a page, it must jump to a target
DEC A ;DECREMENT ACC address on the following page.
MOVX@R0,A ;MOVE CONTENTS OF ACC TO Example: lncrement values in data memory locations 50-54.
;LOCATION 63 IN EXPANDED MOV R0,1150 ;MOVE ·so· DEC TO ADDRESS
;MEMORY ;REG O
MOV R3,115 ;MOVE 'S' DEC TO COUNTER
DEC Rr Decrement Reglster ;REG 3
INCRT: INC@RO ;INCREMENT CONTENTS OF
Encoding: l 11O O j 1r r r I CBH-CFH :LOCATION ADORESSED BY
;REG O
Descrlpllon: The contents of working register 'r' are decremented by one. INC RO ;INCREMENT ADDRESS IN REG O
Operallon: (Rr) - (Ar) -1 r = 0-7 DJNZ R3, INCRT :DECREMENT REG 3 - JUMP TO
Example: DECR1: DEC R1 ;'INCRT' IF REG 3 NONZERO
;DECREMENT CONTENTS OF REG 1
NEXT- ;'NEXT' ROUTINE EXECUTED
;IF R3 IS ZERO
MCS®-48 INSTRUCTION SET
MCS®-48 INSTRUCTION SET
EN I Enable Externa! lnterrupt Example: lncrement contents of location 100 in externa! data-memory.
INCA: MOV R0,#100 ;MOVE '100' DEC TO ADDAESS REG O
Encodlng: lo o I
O O O 1 O 1 I 0SH
MOVX A,@R0 ;MOVE CONTENTS OF LOCATION
;100 TO ACC
Description: Externa! interrupts are enabled. A low sig nal on the interrupt input pin INC A ;INCREMENT A
initiates the interrupt sequence. MOVX@R0,A ;MOVE ACC CONTENTS TO
;LOCATION 101
EN TCNTI · Enable Timer/Counter lnterrupt
INC Rr lncrement Reglster
Descriptlon: This is a 2_-cycle instruction. Control passes to the specified address if Page Hex Op Code
accumulator bit 'b' is set to one.
o 04
Operation: b = 0-7 1 24
(PC0_ 7) - addr lf Bb = 1 2 44
(PC) = (PC) + 2 lf Bb = O 3 64
Example: JB41S1: JB4 NEXT ;JUMP TO 'NEXT' ROUTINE 4 84
;IF ACC BIT 4 = 1 5 A4
6 C4
JC address Jump lf Carry Is Set
¡,
7 E4
Encoding: 1 1 11 o 1 1 o1 1 a7 a6 a5 a4 1 a3 ª2 a1 ªo I F6H Descrlption: This is a 2-cycle instruction. Bits 0-1O of the program counter are re placed
with the directly-specified address. The setting of PC bit 11 is
Description: This is a 2-cycle instruction. Control passes to the specified address if the
determined by the most recen! SELECT MB instruction.
carry bit is set to one.
Operatlon: (PC8_10) - addr 8-10
Operation: (PC0_7) - addr 11 c= 1 (PC0_7) - addr 0-7
(PC) = (PC) + 2 11 e= o (PC11 )- DBF
Example: JC1: JC OVFLOW ;JUMP TO 'OVFLOW' ROUTINE
Example: JMP SUBTOT ;JUMP TO SUBROUTINE 'SUBTOT'
;IF C = 1
JMP S-6 ;JUMP TO INSTRUCTION SIX
;LOCATIONS BEFORE CURRENT
;LOCATION
JF0 address Jump lf Flag O Is Set
JMP 2FH ;JUMP TO ADDRESS '2F' HEX
Encodlng: ¡ 1 O 1 1 j O 1 1 O j 1 ª7 ª6 ªs ª 4 183 ª2 ª1 ªo 1 86H
JMPP @A lndlrect Jump wlthln Page
Description: This is a 2-cycle instruction. Control passes to the specified address if
flag O is set to one. Encodlng: l 1 O 1 1 1 O O 1 1 1 83H
Operatlon: (PC0_7) - addr 11 FO= 1 Descrlptlon: This is a 2-cycle insruction. The contents of the program memory location
(PC) =(PC) + 2 11 FO= O pointed to by the accumulator are substituted lor the 'page' portion ol the
Example: JF0IS1: JF0 TOTAL ;JUMP TO 'TOTAL' ROUTINE IF FO= 1 program counter (PC bits 0-7).
MCS�-48 INSTRUCTION SET MCS®-48 INSTRUCTION SET
I
Encodlng: 11 1 1 O O 1 1 O 1 I
2.7 a5 a5 a4 a3 ª2 a1 ªo I E6H
(PC) = (PC) + 2 11 T1 = 1
Descripllon: This is a 2-cycle instructi:in. Control passes to the specified address if JNZ Address Jump II Accumulator Is No! Zero
the carry bit is not set, that is. equals zero.
Encodlng: ¡ 1 O O 1 1 O 1 1 O 1 1 a7 a5 ªs a4 1 a 3 ª2 a, ªo 1 96H
Operatlon: (PC0_7) - addr 11 c = o
(PC) = (PC) + 2 11 c = , Description: This is a 2-cycle instruction. Control passes to the specified address if the
accumulator contenis are nonzero at the time this instruction is executed.
Example: JC0: JNC NOVFLO ;JUMP TO 'NOVFLO' ROUTINE
;IF C = O Operation: (PC0_7) - addr 11 A ,;é O
(PC) = (PC) + 2 11 A = O
Example: JACCNO: JNZ 0ABH :JUMP TO LOCATION 'AS' HEX
JNI address Jump II lnlerrupt Input Is Low ;IF ACC VALUE IS NONZERO
Encoding: 11 O O OJ O 1. 1 O 1 • c.7 ª6 a5 a4 I a3 ª2 ª1 ªo l 86H
JTF address Jump II Tlmer Flag Is Set
Descrlption: This is a 2-cycle instruction. Control passes to the specified addfess if the
interrupt input signa! is low (= O), that is, an externa! interrupt has been
signaled. (This signai-initiates an interrupt service sequence if the externa!
Encoding: 1 O O O 1 1 O 1 1 O 1 1 ª7 86ªs 84 1 a 3 ª2 ª1ªº 1 16H
Descrlption: This is a 2-cycle instruction. Control passes to the specified address if the
interrupt is enabled.) timer flag is set to one, that is, the timer/counter register has overflowed.
Operation: (PCo_7) - addr 111 = O Testing the timer flag resets it to zero. (This overflow initiates an interrupt
(PC) = (PC) ... 2 111 = 1 service sequence if the timer-overflow interrupt is enabled.)
Example: LOC 3: JNI EXTINT ;JUMP TO 'EXTINT' ROUTINE Operatlon: (PC0_7) - addr .,, �· lf TF = 1
;IF 1 = O (PC) = (PC) + 2 ,- 11 TF = O
Example: JTF1: JTF TIMER ;JUMP TO 'TIMER' ROUTINE
JNT0 address Jump 11 Test O Is Low ;IF TF = 1
MOV A ,R
r Move Reglster Contents to Accumulator
JT1 address Jump II Test 1 Is High
1 a7 a5 a5 a4 \ a3 ª2 a1 ao \ 56H Encodlng: i 1 1 1 1 J 1 r r r I FSH-FFH
Encoding: 1 O 1 O 1 \ O 1 1 O\
to the specified address il the Descrlpllon: 8-bits of data are removed lrom working register 'r' into the accumulator.
Descrlption: This is a 2-cycle instruction. Control passes
test 1 signa! is high (= 1). Operatlon: (A) - (Ar) r = 0-7
Operalion: (PC0_7)- addr l!T1 = 1 Example: MAR: MOV A,R3 ;MOVE CONTENTS OF REG 3 TO ACC
(PC)= (PC) + 2 lf T1= O
;JUMP TO 'COUNT' ROUTINE MOV A,@Ri Move Data Memory Contents to Accumulator
Example: JT1HI: JT1 COUNT
;IF T1= 1
Encodlng ! 1 1 1 1 1 O O O i 1 F0H-F1H
JZ address Jump 11 Accumulator Is Zero Descrlptlon: The contents of the residen! data memory location addressed by bits o-s·· of
Encodlng: ¡, 1 O O J O 1 1 O1 1 a7 a6 a5 a4 1 a3 a2 a1 ao I C6H
register ·¡· are moved to !he accumulator. Register ·¡· contents are unaffected.
Descrlptlon: This is a 2-cycle instruction. Control passes to the specilied address if Operatlon: (A) - ((Ai)) i = 0-1
the accumulator contains all zeros at the time this instruction is executed.
Example: Assume R1 contains 00110110.
Operation: (PC0_7)-.addr 11 A= O MADM: MOV A,@R1 ;MOVE CONTENTS OF DATA MEM
(PC) = (PC) + 2 lf A# 1
:LOCATION 54 TO ACC
· Example: JACCO: JZ 0A3H ;JUMP TO LOCATION 'A3' HEX
;IF ACC VALUE IS ZERO MOV A ,T Move Timer/Counter Contents to Accumulator
MOV Rr,A Move Accumulator Contents to Reglster MOV T,A Move Accumulator Contents to Tlmer/Counter
Example: MRA: MOV RO.A ;MOVE CONTENTS OF ACC TO REG O Operatlon: (T) - (A)
Example:. ln itialize and start event counter.
MOV Rr,#dala Move lmmediate Data lo Register INITEC: CLR A ;CLEAR ACC TO ZEROS
MOV T,A ;MOVE ZEROS TO EVENT COUNTER
Encoding: 11 O 1 1 j 1 r2 r 1 r o 1 1 d7 d5 d5 d4 1 d3 d2 d1 do 1 B8H-BFH ;START COUNTER
START CNT
Description: This is a 2-cycle instruction. The 8-b i t value specif i ed by 'data' is moved to
reg i ster 'r'. MOVD A,Pp Move Port 4-7 Data to Accumulator
Operation: (Rr) - data r = 0-7
Encodlng: 1 O O O O l 1 1 p p I 0CH-0FH
Examples: MIR4: MOV R4,#HEXTEN ;THE VALUE OF THE SYMBOL
Oescrlptlon: This is a 2-cycle instruction. Data on 8243 por! 'p' is moved (read) to
;'HEXTEN' IS MOVED INTO REG 4
accumulator bits 0-3. Accumulator bits 4-7 are zeroed.
MIR 5: MOV R5,#Pl.(R'R) . :THE VALUE OF THE EXPRESSION
;'Pl.(R'R)' IS MOVED INTO REG 5. Operatlon: (0-3) - (Pp) P = 4-7
. MIR 6: MOV R6, #0ADH ;'AD' HEX IS MOVED INTO REG 6 (4-7) - O
Note: Bits 0-7 of the opcode are used to represen! ports 4-7. lf you are
MOV@ R¡,A Move Accumulalor Contents to Data Memory coding in b inary rather than assembly language. the mapping i s as
follows:
Encoding: j 1 O 1 O I O O O i j A0H-A1H
Bi ts 1 O Port
D escrlption: The contents of the accumulator are moved to the resident data memory
location whose address i s specified by bits 0-5.. of register T. Register 'i' 00 4
contents are unaffected. O1 5
1O 6
Operation: ((Ri)) - (A) i = 0-1
:<
1 1 7
Example: Assúme RO contai ns 00000111.
MOMA: MOV @RO.A ;MOVE CONTENTS OF ACC TO Example: INPPT5: MOVD A,P5 ;MOVE PORT 5 DATA TO ACC
;LOCATION 7 (REG 7) ;BITS 0-3. ZERO ACC BITS 4-7
MOV@ Ri ,#data Move lmmediate Data to Data memory MOVD Pp,A Move Accumulator Data to Port 4-7
Encodlng: i 1 O O 1 1 O O O í 1 90H-91H
MOVP3 A,@A Move Page 3 Data to Accumulator Descriplion: This is a 2-cycle instruction. The contents of the accumulator are moved to
the externa! data memory location addressed by register 'i'. Register ·¡·
Encodlng: l 1 1 1 O j O O 1 1 j E3H contents are unaffected. A write pulse is generated.
Descríptlon: This is a 2-cycle instruction. The contents of the program memory location Operation: ((Ri)) - A i = 0-1
(within page 3) addressed by the accumulator are moved to the
accumulator. The program counter is restored following this operation. Example: Assume RO contains 11000111.
MXDMA: MOVX @RO.A ;MOVE CONTENTS OF ACC TO
Operatíon: (PC 0_7)-(A) ;LOCATION 199 IN EXPANDED
(PC8-11) -0011 :DATA MEMORY
�
(A)-((PC))
-.;""'
Example: Look up ASCII equivalent of hexadecimal code in table contained at the NOP The NOP lnstruction
beginning of page 3. Note that ASCII characters are designated by a
7 -bit code; the eighth bit is always reset. Encodlng: 1 O O O O I O O O O 1 OOH
TABSCH: MOV A, # 088H ;MOVE '88' HEX TO ACC (10111000) Descrlption: No operation is performed. Execution continues with the following
ANL A, #7FH ;LOGICAL ANO ACC TO MASK BIT instruction.
;7 (00111000)
MOVP3 A,@A ;MOVE CONTENTS OF LOCATION '38' ORL A,Rr Logical OR Accumulator With Register Mask
;HEX IN PAGE 3 TO ACC (ASCII '8')
Access contents of location in page 3 labelled TAB1. Encodlng: [ O 1 O O l 1 r r r 1 48H-4FH
Assume current program location is not in page 3. Descrlptlon: Data in the accumulator is logically ORed with the mask contained in
TABSCH: MOV A, #LOW TAB 1 ;ISO LATE BITS 0-7 OF LABEL working register 'r'.
;ADDAESS VALUE
MOVP3 A,@A :MOVE CONTENTS OF PAGE 3 Operallon: (A) - (A) OR (Ar) r = 0- 7
;LOCATION LABELED 'TA81' TO ACC . xample: ORREG: ORL A,R4
E ;'OR' ACC CONTENTS WITH
: ;MASK IN REG 4
MCS®-48 INSTRUCTION SET MCS®-48 INSTRUCTION SET
ORL A,@R¡ Logical OR Accumulator Wlth Memory Mask ORLO Pp,A Loglcal OR Port 4-7 Wlth Accumulator Mask
Encoding: lo 1 O O I O O O i l 40H-41H ¡
Encoding: 1 O O O ¡ 1 1 p p1 8CH-8FH
Descriptlon: Data in the accumulator is logically ORed with the mask contained in the Description: This is a 2-cycle instruction. Data on por! 'p' is logically ORed with the
residen! data memory location referenced by register "i", bits 0-5 ... digit mask contained in accumulator bits 0-3.
Operatlon: (A) - (A) OR ((Ri)) i = 0-1 Operatlon: (Pp) - (Pp) OR (Ao_3) p = 4-7
Exampie: ORDM: MOV R0,#3FH ;MOVE '3F' HEX TO REG O Example: ORP7: ORLO P7,A ;'OR' PORT 7 CONTENTS WITH ACC
ORL A,@R0 ;'OR' AC CONTENTS WITH MASK ;BITS 0-3
;IN LOCATION 63
ORL A,#data Logical OR Accumulator Wlth lmmedlate Mask OUTL BUS,A· Output Accumulator Data to BUS
Encoding: jo 1 O o ¡o o 1 1 ¡
jd7 d6 d5 d4 I d3 d2 d1 dol 43H Encodlng: 1 O O O O I O O 1 O I 02H
Description: This is a 2-cycle instruction. Data in the accumulator is logically OMed with Descrlptlon: This is a 2-cycle instruction. Data residing in the
an immediately-specified· mask. accumulator is transferred (written) to the BUS port and
Operation: (A) - (A) OR data latched. The latched data remains valid until altered by
another OUTL instruction. Any other instruction requiring
Example: ORID: ORL A,#'X' ;'OR' ACC CONTENTS WITH MASK
use of the BUS port (except INS) destroys the contents of
;01011000 (ASCII VALUE OF 'X'\
the BUS latch. This includes expanded memory operations
(such as the MOVX instruction). Logical operations on
ORL BUS,#data• Logical OR BUS Wlth lmmediate Mask BUS data (ANO, OR) as:.ume the OUTL BUS.A instruction
has been issued previously.
Encoding: !1 O O O ! 1 O O O ds ds d4 1 d3 d2 d1 do 1
1 1 d7 88H Operatlon: (BUS) - (A)
· This is a 2-cycle instruction. Data on !he BUS port is logically ORe:; with an
Descriplion: Example: OUTLBP: OUTL Bl:JS, A ;OUTPUT ACC CONTENTS TO BUS
immediately-specified mask. This instruction assumes prior specif1::ation '
J
�
RETR Return wilh PSW Restore RLC A Rotale Lefl through Carry
Encodlng: j O 1 1 1 1 O 1 1 1 j 77H
..:. Descrlption: The contents of the accumulator are rotated right one bit. Bit O is rotated
into the bit 7 position
. f -�Operatlon: (An)- (An + 1) n = 0-6
_¡.;· _1·.· (A7)- (A0)
- \·�jJfu a mple: Assume accurnulator contains 10110001.
:NEW ACC CONTENTS ARE 11011000
,. l�
:;,!;.:,_�.;_.;,• ./.. RRNC: RR A
MCS'!--48 INSTRUCTION SET MCS�-48 INSTRUCTION SET
carry bit; the carry bit is r-::::o::: into the bit 7 position. Oescrlption: PSW bit 4 is set to zero. References to working registers 0-7 address data
memory locations 0-7. This is the recommended setting for normal
Operallon: (An)- (An + 1) n = 0-6 program execution.
(A7)-(C)
(C)- (Ao) Operation: (BS)-O
Encoding: 1 O 1 1 O I O 1 O 1 J 6SH·
Descrlption: This instruction is used to stop both time accumulation and event counting.
Mcse-48 INSTRUCTION SET
MCS®-48 INSTRUCTION SET
Example: Oisable interrupt. but jump to interrupt routine after eight overflows and STRT T Slarl Tlmer
stop timer. Count overflows in register 7.
START: OIS TCNTI ;OISABLE TIMER INTERRUPT Encoding: 1 O 1 O 1 1 O 1 O 1 1 55H
CLR A ;CLEAR ACC TO ZEROS
MOV T,A ;MOVE ZEROS TO TIMER Descrlptlon: Timer accumulation is initiated in the timer register. The register is
MOV R7.A ;MOVE ZERCS TO REG 7 incremented every 32 instruction cycles. The prescaler which counts the
STRT T ;START TIMER 32 cycles is cleared but the timer register is not.
MAIN: JTF COUMT :JUMP TO ROUTINE 'COUNT' Example: lnitialize and start timer.
;IF TF = 1 ANO CLEAR TIMER FLAG
STARTT: CLR A ;CLEAR ACC TO ZEROS
JMP MAIN ;GLOSE LOOP
MOV T,A ;MO'./E ZEROS TO TIMEA
COUNT: INC R7 ;INCREMENT REG 7
EN TCNTI ;ENABLE TIMER INTERRUPT
MOV A.R7 ;MOVE REG 7 CONTENTS TO ACC
STRT T :STAAT TIMER
JB31NT :JUMP TO ROUTINE 'INT' IF ACC
;BIT 3 IS SET (REG 7 = 8)
SWAP A Swap Nlbbles wllhin Accumulator
JMP MAIN :OTHERWISE RETURN TO ROUTINE
:MAIN Encoding: j O 1 O O j O 1 1 1 1 47H
Descriplion: Bits 0-3 of the accumulator are swapped with bits 4-7_ of the accumulator.
Operation: (A4_7) = (Ao_ )
3
INT: STOP TCNT :STOP TIMER Example: Pack bits 0-3 of iocations 50-51 into location 50.
JMP 7H ;JUMP TO LOCATION 7 (TIMER)
PCKOIG: MOV RO, 1150 ;MOVE ·so· OEC TO REG O
;INTERRUPT ROUTINE
MOV A1, 1151 ;MOVE '51' OEC TO REG 1
XCHO A,@A0 :EXCHANGE BITS 0-3 OF ACC
STRT CNT Start Evenl Conter :ANO LOCATION 50
SWAP A ;SWAP BITS 0-3 ANO 4-7 OF ACC
Encoding: 1 O 1 O O I O 1 O 1 1 45H
XCHO A,@R1 :EXCHANGE BITS 0-3 OF ACC ANO
Description: The test 1 (T1) pin is enabled as the event-counter input and the counter :LOCATION 51
is started. The event-counter register is incremented with each high-to-low MOV @A0,A :MOVE CONTENTS OF ACC TO
t ransition on the T1 pin. �
, :LOCATION 50
Example: lnitialize and start event c-:,unter. Assume overflow is desired with first T1
input. XCH A,R r Exchange Accumulalor-Register Contents
STARTC: EN TCNTI :ENABLE COUNTER INTERRUPT
MOV A.#0FFH :MOVE 'FF'HEX (ONES) TO ACC Encoding: j O O 1 O ¡ 1 r r r 1 28H-2FH
MOV T.A :MOVES ONES TO COUNTER Descrlption: The contents of the accumulator and the contents of working register 'r'
STRT CNT :ENABLE T1 AS COUNTER are exchanged.
;INPUT ANO START
Operation: (A)= (Ar) r = 0-7
Example: Move PSW contents to Reg 7 without losing accumulator contents.
XCHAR7: XCH A,R7 ;EXCHANGE CONTENTS OF REG 7
;ANO ACC
MOV A, PSW ;MOVE PSW CONTENTS TO ACC
XCH A.R7 :EXCHANGE CONTENTS OF REG 7
'ANO ACC AGAIN
..J.=-. .
MCS(!;-48 INSTRUCTION SE T MCS®-48 INSTRUCTION SET
XCH A,@R¡ Exchange Accumulator and Data Memory Contents XRL A,@A¡ logical XOR Accumulator Wlth Memory Mask
Encoding: : 1 1 O 1 ¡ 1 r r r J D8H-DFH
Description: Data in the accumulator is EXCLUSIVE ORed witn the mask contained in
working register 'r'.
Operation: (A) - (A) XOR (Rr) r = 0-7
Example: XORREG: XRL A.R5 :'XOR' ACC CONTENTS WITH
:MASK IN REG 5
•• 0-5 in 8048AH 57.!SH
0-6 in 8049AH 87 �9H
0-7 in 8050AH
ANEXO D
l-l"
8748H/8035H/8749H/8039H
HMOS-E SINGLE-COMPONENT 8-BIT MICROCOMPUTER
XT.1.l 1
XTAL 2
2
3
39
38
T1
P27
V,
� '.:j::;
��
lvt a:. >< >< :e X > �
u
.. .. ..
.... "°
ou Ñ Ñ Ñ
V'I .
4 l7 37 P2'
• Compatible wlth 8080/8085 Perlpherals
RES�
• High Performance HMOS-E
4&H
SS S 36 P2S •
35 39 P2.4
iÑT 6 IClSH P24
• lnterval Timer/Event Counter • Easlly Expandable Memory and 1/0 iHT
EA 7 l70II J4 P17 8 38 Pl.7
RO • 1039H Jl PI& 37 Pl.6
• Two Single Level lnterrupts • Up to 1.35 µs lnstruction Cycle; [A
P 10 >.u: 13 33 PIJ
32 Pl.2
The lntel8749H/8039H/8748H/8035H are totally sell- sufficient, 8-bit parallel computers fabricated on single
Voo 080 14
PROC
silicon chips using lntel's advanced· N-channel silicon gata HMOS-E process.
081 15 T09 V1•w Pl.1
P23
P22 082 16 Looldng down on PC Boord PI.O
P21
The family contains 27 1/0 lines, an 8-bit timer/counter, on-chip RAM and on-board oscillator/clock circuits.
083 17
P20
For systems that require extra capability, the family can be expanded using MCS®-80/MCS®-85 peripherals. voo
18 19 20 21 22 23 24 25 26 27 28
210983-3
T hese microcomputers are designed to be efficient controllers as weli as arithmetic processors. They have OOOOODDOOOC
m Q m m � z Ñ �
o o o o > � � �
� n � � � U O � N � O
extensiva bit handling capability as weli as facilities for both binary and BCD arithmetic. E fficient use of Figure 3. Pin Conflguration N N N o
f
program memory results from an instruction set consisting mostly of single byte instructions and no instruc
tions over 2 bytes in length. 210983-15
�,l 11
874 9H
Vcc 40 Main power supply; + 5V during operation and programming. Ali
e
PROG 25 Output strobe for824 3 1/0 expander. Ali
P0 RT
W 1
1
Program pulse ( +-181/) input pin during programming. 8748H
1
XTAL{=
PROCRAM
8749H
DATA
:<'
1
MEMORY MEMORY P0 RT
f
(See Note)
&035H W
B7'3H
RESET- 2
{r
P10-P17
874PH
27-34 8-bit quasi-bidirectional port. Ali
SINGLE
STEP-
Port 1
- 8039H -REAO
EXTERNAL _
' P20-P23 21-24 8-bit quasi-bidirectional port. P20-P23 contain the tour high order program Ali
8 BIT 1 MEM
CPU -WRITE
P24-P27
fv-¡ : 35-38 counter bits during an externa! program memory fetch and serve as a 4 -bit
�t
�
TEST{=
Port 2
�t
1/0 expander bus for824 3.
1 PROCRAM
1 1
_STORE
i
1
DB0-0B7 12-19 True bidirectional port which can be written or read syrichronously using the Ali
ENA8LE
INTERRUPT -
BUS RO, WR strobes. The port can also be staticaliy latched. Contains the8 low
AOORESS
1 1- -LATCH
'BIT TIMER
order program counter bits during an externa! program memory fetch, and
I EVEl<T 1 ENABLE
110 UNES
27 receives the addressed instruction under the control o!�- Also contains
COUNTER sus<)) PORT the address and data du� an ex1emal RAM data store instruction, under
-EXPANOER
210983-1 STROBE
control of ALE, RO, and WR.
210983-2
TO 1 Input pin testable using the conditional transfer instructions JT0 and JNT0. Ali
Figure 1 . TO can be designated as a clock output using ENT0 CKL instruction.
B lock Dlagram Figure 2. Used during programming. 8748H
Loglc Symbol 8749H
T1 39 Input pin testable uslng the JT1, and JNT1 instructions. Can be designated Ali
. �
;..
the timer/counter input using the STRT CNT instruction..
ÍÑT;_ 6 lnlerrupt input. lnitiates an interrupt if interrupt is aneblad. lnterrupt is Ali
disabled afiar a reset. Also testable with conditional jurnp instruction. (Active
�OO[g!LO!MIO�ó:i00'\'7
intef 8748H/8035H/8749H/8039H �00[g!LO!i1JO�ó:i00'\'7 intef 8748H/8035H/8749H/8039H
ADDC A, # data
carry
Add immedi.ate
with cany
2 2
DAA
SWAPA
Decimal adjuslA
Swap nibbles of ,
1 1
1
SUBROUTIN E
CALLaddr Jump to subrouline 2 2
DISI
interrupt
Disable externa!
interrupl
1 1
RE T Return -1
A
ANLA, R And register loA 1 1 RLA Rolate A lell 1 1
2
SEL RBO S etecl regisler 1 1
ANLA.@R RETA Relum and reslore 1 2
And data 1 1 A LCA RotateAlelt 1 1 bankO
memoryto A status 1
lhrough Cairy SEL RB1 S etect regisler 1
AN L A, #data And írm>ediate 2 2 RRA RotateA righl 1 1 bank 1
toA ARCA Rotale A right 1 1 FLAG S SEL MBO Salee! memo;y 1 1
ORLA, R 0r registe, to A 1 1 lhrough carry .. ·CLRC Clear carry 1 1 bank O
ORL A, @R Or da:a mer.,ory 1 1 ..CPLC Complement carry 1 1 SEL M81 S elecl memory 1 1
toA INPlJT/OlJTPUT . CLRFO Cloar flagO 1 1 bank 1
ORLA, #data Orimm9diale lo 2 2 ·IN A, P Input port toA 1 2 . ·:-
CPLFO Complemenl llagO 1 1 ENTOCLK Enable clock 1 1
XRLA. R
-- --- -- -· 11
A
Excll!SN8 O< 1 1
OUT L P, A OutputA to port
ANL P, #data And immediate
..-
1
2
2
2 ?;1_: · CLRF1
...CPLF1
Ctear llag 1
Comolamenl ll�n 1
1
, ,1
,_,no
output onTO
... , ........... -.... ,:-- -- - - -
:¡
-
infef 8748H/8035H/8749H/8039H IPOO�ILOIMJOfR'.J&OOW
intef 8748H/8035H/8749H/8039H �W�U..U�U�lñl�
-
ABSOLUTE. MAXIMUM RATING
s• • Notice: Stresses above /hose
lisled under ':ilbso
Ambient Temperatura Under Bias lute Maximum Rstings" may caus A.C. CHARACTERISTICS TA o·c to 70"C; V cc = V 00 = SV ± 10%; Vss - ov
.... .. o·c to 70"C
=
e permanen/ dam.
Storage Temperatura ..•......
age lo ·1he device. This is e s/ros
. -65"C to+ 150"C s raling only and 11 MHz Condlllons
· Unlt
f(I)
Voltage On Any Pin With Aespect
funclional opera/ion ol /he dovic Symbol Parameter
o/her condilions sbove /hoso indics
o al lhese or sny (Note 3) Mln Max (Note 1)
to Ground... ............. :.... led in lho opers
.-0.5V to+ 7V lionel sections of lhis specificalion
(Nole 3)
Power Dissipalion ... .......... is no/ implied. Ex t Clock Period 1/xtal Iraq 90.9 1000 ns
........ . . 1.0 Watt posure lo sbsolute maximum rsting
150
condilions for
extended periods may effect dovic
o reliability. ILt ALE Pulse Width 3.51- 170 ns
i
8039H
80 100 mA
8048H
95 110 mA
NOTE; 8749H
"Ice + loo is moasured with ell oulpvis
disconn9 Clgd; �. liEID, end INT
4-22
OQual lo V<X,: EA equal
lo Vss-
-�i
�
ANEXO E
ESQUEMA DEL ESTABILIZADOR DE VOLTAJE
USANDO UN MICROCONTROLADOR
BIBLIOGRAFIA