Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
UNIVERSITAT ROVIRA I VIRGILI
ESCOLA TÈCNICA SUPERIOR D'ENGINYERIA
DEPARTAMENT D'ELECTRÒNICA
TRABAJO CONJUNTO FINAL DE CARRERA
COMUNICACIÓN VIA RED ELÉCTRICAPARA GRANDES DISTANCIAS
Alumno: Jose Luis Alonso BartoloméPonente: Ernest Gil Dolcet
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
ÍNDICE
1.- MEMORIA
1.1.- OBJETIVO
1.2.- CONTEXTO DEL PROYECTO
1.3.- DESCRIPCIÓN DEL PROYECTO.
1.4.- DESCRIPCIÓN DEL EQUIPO.
1.5.- RESUMEN Y ANÁLISIS DE NORMAS RELACIONADAS.
1.6.- ESTUDIO DE CIRCUITO EMISOR.1.6.1.- Funciones de transferencia1.6.2.- Diseño del circuito conforme a las especificaciones.
1.6.2.1.- Cálculo de los elementos del circuito1.6.3.- Prueba de núcleos de ferrita para transformador del emisor1.6.4.- Pruebas del emisor sin conectar a la red eléctrica ni al PC
1.7.- ESTUDIO DE CIRCUITO RECEPTOR.1.7.1.- Funciones de transferencia1.7.2.- Diseño del circuito conforme a las especificaciones.
1.7.2.1.- Cálculo de los elementos del circuito1.7.3.- Prueba del receptor sin conectar a la red
1.8.- CONEXIÓN DE LOS CIRCUITOS EMISOR Y RECEPTOR.1.8.1.- Prueba de la conexión del emisor y receptor sin conectar a la red1.8.2.- Prueba de la conexión del emisor y receptor conectando a la red1.8.3.- Unión de los circuitos al PC1.8.4.- Prueba de la conexión del emisor y receptor sin conectar a la red y
conectados a PC1.8.5.- Prueba de la conexión del emisor y receptor conectando a la red y
conectados a PC
1.9.- DISEÑO FUENTES ALIMENTACIÓN
1.10.- PROGRAMA DE APLICACIÓN
1.11.- POSIBLES MEJORAS
2.- MEDICIONES Y PRESUPUESTO
2.1.- MEDICIONES
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
2.2.- PRECIOS UNITARIOS
2.3.- PRECIOS COMPUESTOS
2.4.- PRESUPUESTO GENERAL
3.- ANEXOS
3.1.- LISTADOS DEL PROGRAMA
3.2.- NORMAS APLICADAS
3.3.- HOJAS DE CARACTERÍSTICAS DE LOS COMPONENTES UTILIZADOS
4.- PLANOS
Nº 1: CIRCUITO EMISOR. ESQUEMA CIRCUITO.
Nº 2: CIRCUITO RECEPTOR. ESQUEMA CIRCUITO.
Nº 3: FUENTE DE ALIMENTACIÓN. ESQUEMA CIRCUITO.
Nº 4: EQUIPO EMISOR-RECEPTOR. PLACA. PLANTA COMPONENTES.
Nº 5: EQUIPO EMISOR-RECEPTOR. PLACA. CARA COMPONENTES.
Nº 6: EQUIPO EMISOR-RECEPTOR. PLACA. CARA SOLDADURA.
Nº 7: FUENTE DE ALIMENTACIÓN. PLACA. PLANTA COMPONENTES.
Nº 8: FUENTE DE ALIMENTACIÓN. PLACA. CARA SOLDADURA.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
ÍNDICE DE FIGURASPág.
- Figura 1. Diagrama de bloques. 3
- Figura 2. Función salida-entrada del circuito emisor. Circuito inicial 6
- Figura 3. Función salida-entrada del circuito emisor. Circuito con resistencia de carga. 7
- Figura 4. Función salida-entrada del circuito emisor. Circuito con modelo ideal del transformador. 7
- Figura 5. Función salida-entrada del circuito emisor. Circuito desactivando fuentes. 8
- Figura 6. Función salida-entrada del circuito emisor. Circuito equivalente. 8
- Figura 7. Función salida-entrada del circuito emisor. Diagrama de Bode. 10
- Figura 8. Función intensidad-tensión de red del circuito emisor. Circuito inicial. 11
- Figura 9. Función intensidad-tensión de red del circuito emisor. Circuito emisor desactivando fuente. 11
- Figura 10. Función intensidad-tensión de red del circuito emisor. Circuito equivalente. 12
- Figura 11. Función intensidad-tensión de red del circuito emisor. Diagrama de Bode. 13
- Figura 12. Circuito de prueba con generador de funciones. 17
- Figura 13. Circuito emisor con transistor y oscilador. 20
- Figura 14. Circuito oscilador utilizando el circuito integrado LM555. 21
- Figura 15. Circuito oscilador utilizando el circuito integrado LM555 con puerta NAND conectada al pin de RESET. 23
- Figura 16. Circuito receptor con filtro paso-banda. 24
- Figura 17. Función salida-entrada del circuito receptor. Circuito inicial. 24
- Figura 18. Función salida-entrada del circuito receptor. Circuito con modelo ideal del transformador. 25
- Figura 19. Función salida-entrada del circuito receptor. Circuito equivalente. 25
- Figura 20. Función salida-entrada del filtro paso-banda. Circuito. 26
- Figura 21. Función salida-entrada del receptor. Diagrama de Bode. 28
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
- Figura 22. Función intensida-tensión de red del receptor. Diagrama de Bode. 29
- Figura 23. Circuito receptor con filtro paso-banda. 32
- Figura 24. Conjunto circuitos emisor y receptor de prueba. 34
- Figura 25. Tensión colector-emisor del transistor del circuito emisor. 34
- Figura 26. Tensión en la resistencia de salida del emisor (Rprueba). 35
- Figura 27. Tensión en la entrada del filtro paso-banda del receptor. 35
- Figura 28. Tensión en la salida del filtro paso-banda del receptor. 36
- Figura 29. Esquema de la comunicación. 36
- Figura 30. Configuración básica del detector de frecuencia basado en el circuito integrado LM567. 37
- Figura 31. Configuración detector de frecuencia basado en el circuito integrado LM567 de cara a mejorar la velocidad de respuesta. 39
- Figura 32. Configuración del detector de frecuencia basado en el circuito integrado LM567 con condensador en la salida. 40
- Figura 33. Configuración del detector de frecuencia basado en el circuito integrado LM567 con adecuación de señal a CMOS. 41
- Figura 34. Fuente de alimentación. 41
- Figura 35. Diagrama de flujo de la rutina de atención a la interrupción serie del programa MASTER. 46
- Figura 36. Diagrama de flujo del programa MASTER. 47
- Figura 37. Diagrama de flujo de la rutina de atención a la interrupción serie del programa ESCLAVO. 48
- Figura 38. Diagrama de flujo del programa ESCLAVO. 49
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
INDICE DE TABLASPág.
- Tabla 1. Comparación de núcleos de ferrita. 17
- Tabla 2. Circuito de prueba. Frecuencias de corte. 18
- Tabla 3. Circuito de prueba. Comparación entre valores teóricos y valores reales. (I) 19
- Tabla 4. Circuito de prueba. Comparación entre valores teóricos y valores reales.(II) 19
- Tabla 5. Circuito emisor. Evolución de la frecuencia de corte. 20
- Tabla 6. Circuito paso-banda.. Valores reales. 33
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
1.- MEMORIA
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 1
1.1 .- OBJETIVO
El objetivo final de este proyecto fin de carrera es el montaje y prueba de un prototipo de comunicacióna través de la red eléctrica pública de baja tensión compuesto por dos equipos emisor-receptor.Los resultados de esta comunicación serán estudiados de tal modo que la comunicación se puedacaracterizar por la distancia máxima a la que se puede comunicar, la velocidad máxima decomunicación, la frecuencia idónea a transmitir, etc.Por otro lado, el proyecto intentará dar una visión de lo que es la red eléctrica como medio para lascomunicaciones y las normas que regulan estas comunicaciones.Para poner en práctica todo lo anteriormente dicho, se implementará un aplicación en la cual seconecten ambos equipos emisor-receptor a un PC, y con de un programa “chat” se emitirán y recibirándatos a través de la red con un sencillo protocolo de comunicación.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 2
1.2.- CONTEXTO DEL PROYECTO
Este proyecto tiene la peculiaridad que debe desarrollarse en un ambiente no demasiado usual para latransmisión de señal como es la red eléctrica de baja tensión. De tal modo que el proyecto debasuperar toda una serie de peculiaridades de la red, como pueden ser:
- el elevado nivel de tensión que obliga a que la primera necesidad sea proteger el circuito deésta.
- la falta de una modelización frecuencial de la red debido a su complejidad, diversidad y cambioen el tiempo.
- falta de homogeneización de la red, por ejemplo, no es igual la influencia de motores (cargainductiva) que la de fluorescentes (carga capacitiva).
- perturbaciones, fluctuaciones de tensión y ruidos intrínsecos de la propia red.
Además, al ser una transmisión a través de dos hilos podremos realizar unas comunicacionesbidireccionales pero no simultáneamente. Así dos equipos no podrán emitir al mismo tiempo. Por otraparte a la red podrán acceder varios equipos de tal modo que la red eléctrica funcione como si fuera un“bus” de datos.Por otro lado el equipo deberá ajustarse a la norma UNE EN 50065 (Transmisión de señales por lared eléctrica de baja tensión en la banda de frecuencias de 3 kHz a 148,5 kHz) (véase anexo 3.2), quedicta los niveles de señal y las frecuencias a las que se puede emitir señales a través de la red.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 3
1.3.- DESCRIPCION DEL PROYECTO
En este proyecto, se ha estudiado la realización de un dispositivo emisor-receptor que adecúe lasseñales que le son enviadas a través del puerto serie de un PC, con los niveles de tensión que especificael protocolo de comunicación RS-232, para poder ser transmitidas a través de la red eléctrica. Laprincipal característica de este aparato es que la transmisión pueda llegar a la mayor distancia posible.Esta transmisión se ajustará a la norma UNE EN 50065 (Transmisión de señales por la red eléctrica debaja tensión en la banda de frecuencias de 3 kHz a 148,5 kHz) (véase anexo 3.2). También se haimplementado una aplicación a este equipo. Se ha realizado un programa que comunica dos PC’s através de la red eléctrica de baja tensión.
1.4.- DESCRIPCION DEL EQUIPO
El equipo como ya se ha dicho es emisor-receptor por tanto tenemos dos partes: el emisor y elreceptor. Su diagrama de bloques sería el siguiente:
Figura 1. Diagrama de bloques.
En el emisor podemos diferenciar los siguientes bloques:
- CONVERSOR DE NIVELES DE SEÑAL. En este bloque convertiremos las señales con losniveles de señal que dice la norma RS-232, a los niveles de señal CMOS/TTL.
- CIRCUITO OSCILADOR. En este bloque lo que se hace principalmente es adecuar lasseñales para que puedan ser emitidas por la red. Así cada bit que se envíe a través del puertoserie se transformará en señal cuadrada a 6 kHz (si el bit es un “1” lógico) o bien en ausenciade señal (si el bit es un “0” lógico). Esto se consigue con un circuito oscilador que estácontrolado por la señal del puerto serie (si la señal es “1” el circuito oscila y si es “0” no lohace).
PUERTOSERIE
PC
NIVELES
DE
CONVERSOR
SEÑAL
DEFRECUENCIA
DETECTOR
OSCILADOR
CIRCUITO
FILTRO RECEPTOR
EMISOR
RED
DE
BAJA
TENSIÓN
CIRCUITO RECEPTOR
CIRCUITO EMISOR
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 4
- EMISOR. Este bloque hace que a la red eléctrica llegue la señal a enviar en las mejorescondiciones posibles tanto de nivel como de forma. Además el bloque sirve para proteger alresto del circuito del efecto que la tensión de red podría producir sobre los elementos delcircuito.
En el emisor podemos diferenciar varios bloques:
- RECEPTOR. Este bloque hace que de la red eléctrica llegue la señal en las mejorescondiciones posibles tanto de nivel como de forma. Además el bloque sirve para proteger alresto del circuito del efecto que la tensión de red podría producir sobre los elementos delcircuito.
- FILTRO. En este bloque lo que se intenta es eliminar todas las señales que no sean la de lafrecuencia que se envía
- DETECTOR DE FRECUENCIA. En este bloque lo que se hace es transformar la señal que serecibe. Así de esa señal de 6 kHz se debe pasar a señal con niveles de tensión CMOS.
- CONVERSOR DE NIVELES DE SEÑAL. En este bloque convertiremos las señales con losniveles de señal que dice la norma RS-232, a los niveles de señal CMOS/TTL.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 5
1.5.- RESUMEN Y ANÁLISIS DE LAS NORMAS RELACIONADAS
Como ya se ha dicho, la norma que regula las comunicaciones a través de la red eléctrica pública debaja tensión es la UNE EN 50065 “Transmisión de señales por la red de baja tensión en la banda defrecuencias de 3 kHz a 148,5 kHz. Reglas generales, bandas de frecuencia y perturbacioneselectromagnéticas” (véase anexo 3.2). En esta norma como su nombre indica se dan las directrices para la transmisión por la red de bajatensión. Así, primeramente se determinan las diferentes bandas frecuenciales en las que es posible emitiry, los usos y limitaciones de cada una. Posteriormente la norma describe cómo debe ser y cómo se debe medir la tensión de salida de losemisores. De este modo, en primer lugar se describe el circuito de medida que se debe utilizar, despuésnos dice el procedimiento de medida, para concluir con los niveles máximos de salida para cada bandade frecuencias. Después se habla de las perturbaciones que la transmisión puede introducir en la red. Así se habla desus límites y frecuencias. Finalmente se describen las condiciones que deben tener los ensayos. Dicho esto, nos centraremos específicamente en la aplicación que nos ocupa, así lo principal que afectaa este proyecto se puede resumir de la forma siguiente:
• TENSIÓN DE SALIDA DE LOS EMISORES
- CIRCUITO DE MEDIDA: Para la banda de 3 kHz a 9 kHz debe usarse una modificacióna la red de la Norma CISPR 16 (50 Ω // 50 µH + 5 Ω ).
- MEDIDA DE LAS SEÑALES DE SALIDA- Determinación del ancho de banda: El espectro de la señal de salida se determina
utilizando un analizador de espectros que tenga un detector de pico y con un filtro deanálisis de 100 Hz de ancho de banda. El transmisor debe operar de tal forma que, elancho de banda y la magnitud de la señal de salida, tengan los mayores valorespermitidos, de acuerdo con las especificaciones del fabricante. El ancho espectral estádefinido por la medida del intervalo de frecuencia para el cual la señal está en un nivel amenos de 20 dB por debajo de la línea espectral máxima.
- Determinación del nivel de salida: El nivel de salida se mide durante un período de 1min., utilizando un detector de pico. Esta medida se puede realizar con la ayuda de unanalizador de espectros con una banda del espectro de la salida del emisor.
- NIVELES MÁXIMOS DE SALIDA
- Banda mayor de 3 kHz hasta 9 kHz: Con el dispositivo conectado según dice la norma,el nivel de salida no deberá exceder 134 dB(µV) con relación a tierra, con lo cual laseñal de salida no podrá ser mayor que 5 V.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 6
1.6.- ESTUDIO DEL CIRCUITO EMISOR
De cara a tener una visión previa del circuito emisor se estudiarán las funciones de transferencia de éstepara ver qué elementos son los más críticos y qué comportamiento frecuencial tienen. Dos funciones de transferencia son las más interesantes “a priori”, por un lado la que indica la relaciónentre la señal que queremos emitir y la señal que realmente llega a la red. De otro lado, es interesanteconocer si la red eléctrica va a tener un efecto sobre los elementos del circuito, o lo que es lo mismo sila red, con esa tensión tan elevada, puede llegar a proporcionar una intensidad grande de modo que elcircuito se vea afectado o destruido. Por supuesto el comportamiento real no será exactamente igual al previsto debido a que loscomponentes se consideran ideales y, en la realidad tendrán efectos parásitos. Sin embargo este estudioservirá para hacer una primera aproximación al circuito emisor.
1.6.1.- FUNCIONES DE TRANSFERENCIA
El circuito a estudiar es el siguiente:
Figura 2. Función salida-entrada del circuito emisor. Circuito inicial.
En este punto encontraremos la función de transferencia de la salida a la red en función de la tensióncolector-emisor del transistor. Esta tensión se puede tratar como si fuese una fuente independiente. Lared eléctrica se sustituye por una resistencia de carga cuyo valor se tomará de la figura F.2 del anexo Fdel la norma UNE EN 50065-1/A3. De tal modo que el circuito será:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 7
Figura 3. Función salida-entrada del circuito emisor. Circuito con resistencia de carga.
El transformador se sustituye por su modelo sin pérdidas, o lo que es lo mismo, dos inductancias ( la delprimario y la del secundario ) y dos fuentes de tensión dependientes de las intensidades y del coeficientede inducción mutua. Tendremos por tanto el siguiente circuito a estudiar:
Figura 4. Función salida-entrada del circuito emisor. Circuito con modelo ideal deltransformador.
De cara a conseguir la función de transferencia con la fuente Vine como entrada debemos desactivar elresto de fuentes independientes del circuito. Con lo cual la tensión de alimentación +V decortocircuitará. De tal manera que tendremos el siguiente circuito:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 8
Figura 5. Función salida-entrada del circuito emisor. Circuito desactivando fuentes.
Los dos diodos zener son dos elementos supérfluos al encontrarse en paralelo con una fuenteindependiente con lo cual podemos eliminarlos. El circuito quedará por tanto de la forma siguiente:
Figura 6. Función salida-entrada del circuito emisor. Circuito equivalente.
Del circuito resultante, analizando la malla “B” se obtiene la ecuación:
ineeeee VLsMsLI −=⋅⋅+⋅⋅ 122
De donde I2e tendrá un valor de:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 9
sL
LsMVI
e
eeinee ⋅
⋅⋅−−=
2
12
Si se estudia la malla “A” se obtiene la ecuación:
oe
e
eeeee
e
e VsC
IIsMsLIsC
I =⋅
⋅+⋅⋅+⋅⋅+⋅
⋅ 1112111
Sustituyendo la expresión de I2e tenemos que
( )
oee
ee
eeineeee
ee V
sCI
sL
IsMVsMsLI
sCI =
⋅⋅+
⋅
⋅⋅+−⋅⋅+⋅⋅+
⋅⋅
111
2
1111
Desarrollando la expresión:
( ) oeeeinee
ee
ee VIsMV
L
MsL
sCI =⋅⋅+⋅−
⋅+
⋅⋅ 1
211
2
Teniendo en cuenta que RIV eoe ⋅= 1 obtenemos que:
oeoe
einee
ee
e
oe VR
VsMV
L
MsL
sCR
V=
−⋅⋅+⋅−
⋅+
⋅⋅−
21
2
oeoe
einee
ee
e
oe VR
VsMV
L
MsL
sCR
V=
⋅⋅+⋅−
⋅+
⋅⋅− 2
21
2
⋅⋅−
⋅+
⋅⋅+=⋅−
R
VsMsL
sCR
VVV
L
M oeee
e
oeoeine
e
e 2
12
2
⋅⋅−
⋅+
⋅⋅+⋅=⋅−
RsMsL
sCRVV
L
Mee
e
oeine
e
e 1211 2
1
2
De tal modo que la función de transferencia será:
( ) ( )( )
⋅⋅−
⋅+
⋅⋅+
−==
RsMsL
sCR
L
M
sV
sVsH
ee
e
e
e
ine
oe
1211 2
1
2
Desarrollando la expresión de cara a conseguir una normalización de la función de red.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 10
( ) ( ) eeeeeeee
ee
LCRLsCMLCLs
sCRMsH
22
2
212 2 ⋅+⋅⋅⋅+⋅−⋅⋅
⋅⋅⋅−=
( )
eeee
e
eeee
ee
eeeee
ee
CMLCL
L
CMLCL
CRLss
CMLCL
sCRM
sH
⋅−⋅⋅⋅
+⋅−⋅⋅
⋅⋅⋅+
⋅−⋅⋅⋅⋅⋅
−=
221
2
221
22
221
2
Si normalizamos el coeficiente de inducción mutua del transformador
⋅=
ee
ee
LL
MK
21
, tenemos que
( ) ( )
( ) ( )21
21
2
2
21
21
1
2
1
1
eeeee
eee
ee
KCLKL
Rss
sKLL
LLRK
sH
−⋅⋅+
−⋅⋅+
⋅−⋅⋅
⋅⋅⋅−
=
Así pues, el circuito se comporta como un filtro pasa-banda, con una frecuencia central de:
( )21 1
2
2
1
eee
oeKCL
f−⋅⋅Π⋅
=
La ganancia de esta función de transferencia se representa en el siguiente diagrama de Bode. En él sepuede ver como el circuito se comporta de modo paso-banda.
Figura 7. Función salida-entrada del circuito emisor. Diagrama de Bode.
Del mismo modo que se calcula la función entrada-salida, podemos calcular la función intensidad deentrada-tensión de red. De este modo se puede saber la importancia que tienen los elementos del
FRECUENCIA
GA
NA
NC
IA
ωo
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 11
circuito en relación a la atenuación de la corriente a 50 Hz que puede llegar a través de la red. Elcircuito a estudiar será el siguiente:
Figura 8. Función intensidad-tensión de red del circuito emisor. Circuito inicial.
Al igual que se hizo anteriormente se desactivan las fuentes independientes excepto la de estudio, eneste caso la tensión de la red eléctrica. Con lo cual obtendremos el circuito:
Figura 9. Función intensidad-tensión de red del circuito emisor. Circuito emisor desactivandofuente.
De nuevo se pueden eliminar los diodos zener ya que se encuentran cortocircuitados. De tal manera quetendremos el siguiente circuito:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 12
Figura 10. Función intensidad-tensión de red del circuito emisor. Circuito equivalente.
Del circuito resultante, analizando la malla “B” se obtiene la ecuación:
sLILsM eeee ⋅⋅=⋅⋅ 221
De donde I2e tendrá un valor de:
e
ee L
sMI
22
⋅−=
Si se estudia la malla “A” se obtiene la ecuación:
REDeeee
e VIsMsLsC
I =⋅⋅+
⋅+
⋅⋅ 211
2
Sustituyendo la expresión de I2e tendremos que
REDVL
sMsL
sCI =
⋅−⋅+
⋅⋅
2
2
11
2
De tal modo que desarrollando la expresión la función de transferencia será:
( ) ( )
( )21
2
211
1
21
1
)(
)(
eee
ee
RED
e
KCLs
sKL
sV
sIsG
−⋅⋅+
⋅−⋅
−==
La ganancia de esta función de transferencia se representa en el siguiente diagrama de Bode. En él sepuede ver como el circuito se comporta de modo paso-banda.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 13
Figura 11. Función intensidad-tensión de red del circuito emisor. Diagrama de Bode.
1.6.2.- DISEÑO DEL CIRCUITO CONFORME A LAS ESPECIFICACIONES.
A la hora de hacer este apartado en primer lugar se diseñó el circuito de transmisión de señal yprotección de la señal de red a 50 Hz. que, es el circuito que supone más complejidad, no por elnúmero de componentes sino por las interacciones entre ellos y sobretodo por el diseño deltransformador. Éste al ser un elemento en su conjunto no estandarizado tendrá un cálculo máscomplejo. Así mediante las funciones de transferencia se diseñará el circuito. Los condensadores de entradadeben mantener un compromiso, la intensidad a 50 Hz debe atenuarse de cara a que no cree problemasal circuito y por otro lado, debe permitir un nivel de señal aceptable en la red a 6 kHz. El transistor unido al secundario del transformador ejerce de interruptor, ya que debe trabajar ensaturación y corte. Por tanto, la intensidad que debe circular es la debida a la intensidad de saturacióndel transistor . Los diodos zener en paralelo con la bobina del transformador son para que la corrientede descarga de la bobina circule mientras el transistor está en corte. El transformador debe tener capítulo aparte. La particularidad del transformador hace que tenga queconstruirse por completo. De cara a diseñar el transformador de aislamiento del emisor lo esencial es la elección del núcleo deéste. En primer lugar se elegirá el tipo de material a emplear, al trabajar el equipo a una frecuencia de 6kHz se utilizará un núcleo de ferrita con lo que las pérdidas en el núcleo serán despreciables. Ademásdeberá tener las características magnéticas que permitan un número de espiras razonable de cara a unafabricación manual llevadera. Los valores de inductancia de cada bobinado se justificaránposteriormente. De este modo la inducción mutua entre primario y secundario (k) será grande, cercana a 1. Por otro lado, el hilo esmaltado que se utilice para realizar los bobinado tiene que poder soportar lacorriente a la que va a ser sometida. Siguiendo con los bloques que se han indicado anteriormente, tenemos el circuito de transformación deseñal CMOS a señal a transmitir. Esto se hace con un circuito basado en el circuito integrado LM555,la salida de éste ataca la base del transistor. El circuito tiene una configuración que permite obtener unoscilador de 50 % de ciclo de trabajo, con la peculiaridad de que esta oscilación viene gobernada por
GA
NA
NC
IA
FRECUENCIA
ωo
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 14
una señal que permite o no permite la oscilación. Esta señal de gobierno es la que proviene del PCdebidamente adaptados los niveles de tensión.
1.6.2.1.- CÁLCULO DE LOS ELEMENTOS DEL CIRCUITO
Para calcular numéricamente los elementos de los que van a formar parte el circuito partiremos de lasfunciones de transferencia del circuito. Así las especificaciones más importantes del circuito será:- la frecuencia de corte. Al comportarse el circuito de un modo paso-banda, tendremos que la
máxima transferencia de señal se dará en la frecuencia de corte. Por tanto intentaremos que éstasea la frecuencia de transmisión (6 kHz). La expresión de la frecuencia de corte es:
( )21 1
2
2
1
eee
oeKCL
f−⋅⋅Π⋅
=
- la atenuación de la corriente de la red (corriente a 50 Hz). Por otro lado la atenuación de la tensiónde red es importante ya que de ella depende la protección de los componentes del circuito. Unagran corriente de 50 Hz podría destruir los componentes del circuito. Si como hemos dicho lafrecuencia de corte está situada en la frecuencia de transmisión podemos simplificar la función detransferencia anteriormente calculada diciendo que para las frecuencias alejadas de la frecuencia decorte (ω << ω0) como podría ser el caso de la frecuencia de red (50 Hz << 6kHz) la función detransferencia se puede simplificar por:
( ) ( )
( )21
211
1
21
1
)(
)(
eee
ee
RED
e
KCL
sKL
sV
sIsG
−⋅⋅
⋅−⋅
−==
con lo cual podemos decir
( )2)(
)(1 sC
sV
sIsG e
RED
e ⋅−==
que es la función de transferencia equivalente a la de un circuito serie compuesto de doscondensadores y una fuente (VRED).
Dicho esto, en primer lugar se calculará C. En este punto, tenemos que introducir la primeraespecificación de cara a escoger los condensadores, así aceptaremos una intensidad de red comomucho de 25 mA de pico (≈18 mArms), con lo cual si :
( )2
ωω
⋅= eC
jG
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 15
Como VRED es una señal senoidal podemos decir que en régimen permanente la intensidad de entradaserá una senoidal de amplitud igual a la de entrada atenuada por el módulo de la función detransferencia a la frecuencia de red. Por tanto:
22202
502)(1 ⋅⋅
⋅Π⋅⋅= e
MAXe
CtI
Así si queremos que 31 1025)( −⋅=MAXe tI
22202
5021025 3 ⋅⋅
⋅Π⋅⋅=⋅ − eC
Con lo que
nFCe 511=
Tomando un valor normalizado finalmente nFCe 470= con lo que la intensidad de red será como
mucho del orden de 23 mV de pico.
Una vez calculado el valor de los condensadores de entrada se deberá calcular L1. De la expresión dela frecuencia de corte tenemos que:
( ) ( )21
21 1470
2
2
1
1
2
2
16000
eeeee
oeKnFLKCL
f−⋅⋅Π⋅
=−⋅⋅Π⋅
==
con lo cual
( ) 32
1 109941248,21 −⋅=−⋅ ee KL
A priori se sabe que la inducción mutua, al ser dos bobinados en un núcleo de ferrita, será casi unacoplamiento perfecto ( k = 1 ). Con lo cual tendremos un L1 elevada. Para construir esta bobina primero hemos de elegir el núcleo. Como ya se ha dicho el núcleo será deferrita. De las ferritas se ha elegido de forma toroidal y calidad (grado FERROXCUBE) 3E25, estacalidad se utiliza principalmente para transformadores de pulsos y transformadores de propósitogeneral. Se caracteriza por su alta permeabilidad, su baja distorsión y su baja sensibilidad en DC. Eneste caso la permeabilidad relativa (µ) es mayor que 6000. Esta alta permeabilidad, unida a que el núcleo elegido es el de mayor dimensión de la serie(36x23x15) hace que el número de espiras sea menor y, de cara a una fabricación manual, ésta seamás llevadera. Por otro lado, el hilo esmaltado que se ha utilizado para realizar el transformador ha sido de 0,5 mm. dediámetro, que permite 0,491 Arms con una densidad de corriente de 2,5 A/mm2. Este hilo es suficientepara las necesidades del circuito. Como la inducción mutua depende en gran manera de la fabricación del transformador y, en este caso,
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 16
el circuito es bastante sensible a este parámetro, para la determinación de las inductancias del primarioy del secundario se hará empíricamente. En el laboratorio con el circuito montado se irá cambiando elvalor de L1 y de L2 de cara a tener la mejor salida posible tanto en amplitud como en forma de onda. El transistor elegido es el BD139 ya que cumple con las especificaciones marcadas ya que es uncomponente muy extendido, de bajo precio y con unas características eléctricas adecuadas. Así puedesoportar una tensión colector-emisor alta (100 V) algo deseable ya que cuando está en corte entre elcolector y el emisor existirá bastante tensión (unos 20 V). El transistor como ya se ha dicho trabajará encorte y en saturación.
1.6.3.- PRUEBA DE NÚCLEOS DE FERRITA PARA EL TRANSFORMADOR DELEMISOR
El primer paso seguido en el montaje fue la elección del núcleo que serviría para fabricar eltransformador de entrada del emisor.En este punto se debe introducir una fórmula que se utilizará para ver qué núcleo nos interesa más.
LN s
ln=
⋅ ⋅2 µ
Donde L = inductanciaN = nº de espirasµn = permeabilidads = secciónl = longitud
Como la permeabilidad, la sección y la longitud son constantes para cada núcleo, podemos simplificarla fórmula diciendo que
L a N= ⋅ 2
Donde L = inductanciaN = nº de espirasa = constante
Partiremos de dos núcleos toroidales de dimensiones 36x22x15 ya que la inductancia que se busca apriori debe ser alta con lo que un núcleo de mayores dimensiones nos proporcionará unos valoresmayores con menos espiras. Tenemos dos núcleos de diferentes grados FERROXCUBE, con hilo dediámetro 0,5 mm se hacen las mismas espiras a ambos núcleos. Con el medidor LCR se medirá lainductancia que se consigue. La siguiente tabla recoge los datos obtenidos de estas mediciones, con ellapodremos comparar ambos núcleos:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 17
NUCLEO 1 NUCLEO 2
N L (µH) a (µH) L (µH) a (µH)
10 13,8 0,138 750 7,500
20 46 0,115 3200 8,000
30 90 0,100 6698 7,442
40 195,2 0,122 11880 7,425
50 309,5 0,124 22000 8,800
MEDIA 0,120 7,833
Tabla 1. Comparación de núcleos de ferrita.
Dada esta tabla se elegirá el núcleo 2 ya que con menos espiras conseguiremos una mayor inductancia.Este núcleo tiene las siguientes características:
GRADO FERROXCUBE: 3E25DIMENSIONES: 36x22x15µn (permeabilidad) : 6000.s (sección) : 0,924 cm2.l (longitud) : 9.20 cm.
1.6.4.- PRUEBA DEL EMISOR SIN CONECTAR A LA RED ELÉCTRICA NI AL PC
Una vez escogido el núcleo de ferrita con el que se fabricará el transformador completaremos el circuitoemisor. Así se irán añadiendo componentes al emisor hasta que cumpla todas las especificaciones.Partiremos de un circuito compuesto por dos condensadores, una resistencia, el transformador y ungenerador de funciones. La forma del circuito sería:
Figura 12. Circuito de prueba con generador de funciones.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 18
Con este circuito se demostrará que el circuito se rige por las funciones de transferencia que se hancalculado a priori. Además se hará un cálculo aproximado del coeficiente de inducción mutua (k).Así en primer lugar intentaremos determinar cuánto vale k, en el planteamiento teórico del circuitohemos partido de la base que k es elevada y muy cercana a 1.Para determinar la k del transformador partiremos de la expresión teórica de la frecuencia de corte dela función de transferencia.
( )21 1
2
2
1
eee
oeKCL
f−⋅⋅Π⋅
=
( ) eeoee LCf
K12
21
⋅⋅⋅Π⋅−=
Cambiando los valores de los componentes del circuito que intervienen en esta fórmula y tomando encada caso la frecuencia de corte obtenemos la siguiente tabla:
L1e (mH) L2e (mH) Ce (nF) Foe (kHz) Ke
180 37,7 50 24,5 0,9948180 37,7 100 17,5 0,9954180 37,7 150 11,7 0,9953180 37,7 388 9 0,9955
Tabla 2. Circuito de prueba. Frecuencias de corte.
Así para estos valores de bobinado en el primario y en el secundario tenemos un coeficiente deinducción mutua (k) del orden de 0,995.
Una vez obtenido el valor de k compararemos los valores de ganancia a la salida del circuito calculadosa partir de la función de transferencia con los obtenidos empíricamente en el laboratorio con el circuitoreal.
Los valores teóricos serán el resultado de calcular el módulo de la función de transferencia:
( ) ( )
( ) ( )21
21
2
2
21
21
1
2
1
1
eeeee
eee
eee
KCLKL
Rss
sKLL
LLRK
sH
−⋅⋅+
−⋅⋅+
⋅−⋅⋅
⋅⋅⋅−
=
o lo que es lo mismo
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 19
( )
( ) ( )2
2
21
2
21
221
21
1
2
1
1)(
−
−⋅⋅+
−⋅⋅
⋅−⋅⋅
⋅⋅⋅
=
ωω
ωω
eeeee
eee
eee
KCLKL
R
KLL
LLRK
jH
En la siguiente tabla podemos ver la comparación entre los valores obtenidos:
L1e = 180 mHL2e = 37,7 mHR = 5 Ωfine = 6 kHzKe = 0,995 ( en valores teóricos)
VALORES TEÓRICOS VALORES REALESCe (nF) Vine (V) Vo (mV) H (Vo / Vin) Vine (V) Voe (mV) H (Vo / Vin)
50 12 140 0,011 11,8 120 0,010100 12 290 0,024 10,8 250 0,023200 12 700 0,058 8 420 0,052268 12 1000 0,083 6,3 480 0,076
Tabla 3. Circuito de prueba. Comparación entre valores teóricos y valores reales. (I)
L1e = 180 mHL2e = 13 mHR = 5 Ωfine = 6 kHzKe = 0,995 ( en valores teóricos)
VALORES TEÓRICOS VALORES REALESCe (nF) Vine (V) Vo (mV) G (Vo / Vin) Vin (V) Vo (mV) G (Vo / Vin)
50 12 240 0,020 9,5 200 0,021100 12 500 0,046 5,6 250 0,044200 12 1200 0,100 3,8 330 0,087
Tabla 4. Circuito de prueba. Comparación entre valores teóricos y valores reales.(II)
Con estas tablas comprobamos que el circuito real se ajusta a la función de transferencia calculada:
( ) ( )
( ) ( )21
21
2
2
21
21
1
2
1
1
eeeee
eee
eee
KCLKL
Rss
sKLL
LLRK
sH
−⋅⋅+
−⋅⋅+
⋅−⋅⋅
⋅⋅⋅−
=
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 20
El siguiente punto fue ajustar en el laboratorio el transformador de cara a que el circuito tenga una salidaóptima a una frecuencia de emisión de 6 kHz.Así mediante la siguiente tabla se puede ver la evolución de la frecuencia de corte del circuito conrespecto a las variaciones de las inductancias del transformador.
L1e (mH) L2e (mH) f0e (kHz)59,9 52,6 15124,8 124,2 12431,4 192,5 8,41238 280 6
Tabla 5. Circuito emisor. Evolución de la frecuencia de corte.
Seguidamente, y una vez comprobado que la función de red propuesta es la correcta, se sustituyó elgenerador de funciones por una entrada al circuito más acorde a las necesidades de éste, así utilizandoun transistor ,dos diodos zener y un circuito oscilador basado en el circuito integrado LM555. De formaque el circuito quedará del siguiente modo:
Figura 13. Circuito emisor con transistor y oscilador.
A la hora de elegir un transistor se eligió el BD139 ya que es un componente muy usual, de bajo coste yque tiene unas prestaciones aceptables para el circuito que nos ocupa. De todas sus características lasque más interesan son su tensión de pico (2 A) y su tensión colector-emisor máxima (80 V).La base del transistor será atacada por un circuito oscilador basado en el LM555, que será de la formasiguiente:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 21
Figura 14. Circuito oscilador utilizando el circuito integrado LM555.
Este circuito genera una señal periódica cuadrada que permite un ciclo de trabajo del 50 %. Así, eltiempo en que la salida está a nivel alto será igual a:
61 693.0 CRt HJ ⋅⋅=
El tiempo de salida a nivel bajo será:
−⋅⋅−
⋅⋅
+⋅
=HJEG
HJEG
EGHJ
EGHJ
RR
RRC
RR
RRt
2
2ln62
Teniendo en cuenta que queremos una señal de 6 kHz, por tanto t1 = t2 = 83.333 µs, resolviendo lasanteriores expresiones y, tomando C6 = 10 nF, obtenemos que
Ω≈Ω≈ kRkR EGHJ 512
En la práctica se utilizarán resistencias en serie con un potenciómetro de cara a ajustar con mayorexactitud el período de la señal de salida. Con lo que REG que dará lugar a una resistencia fija:
Ω= kRE 1
Y a una regulable:
Ω= kRG 10
Por otro lado RHJ dará lugar a dos resistencias fijas en paralelo:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 22
Ω=Ω= kRkR HH 1027 21
Y a una regulable:
Ω= kRJ 5
Este circuito oscilador se unirá a la base del transistor a través de una resistencia (RD). Ésta tendrá unvalor suficiente como para que el transistor esté saturado mientras no esté en corte. De este modotendremos que:
555LMBDBE VIRV =⋅+
Teniendo en cuenta que la tensión base-emisor del BD139 es como máximo de 1 V y la salida delLM555 será de 5 V. Por otra parte, la intensidad de saturación del BD139 es de 1,5 A y su gananciaen DC (β) está comprendida entre 40 y 250. Además teniendo en cuenta que la intensidad del colectores igual a la ganancia en DC por la intensidad de la base tendríamos que:
555LMC
DBE VI
RV =⋅+β
Sustituyendo por los valores anteriores:
540
5.11 =⋅+ DR
Con lo que
( ) Ω=⋅−= 6666.1065.1
4015DR
Escogeremos un valor normalizado de RD , así será igual a 100 Ω.
Una vez conseguido esto tenemos un circuito emisor que será capaz de transmitir de formaininterrumpida, pero lo que es necesario en este circuito es que sea capaz de emitir unos y ceros, o loque es lo mismo señal transmitida a 6 kHz y ausencia de esta señal.La solución para esto será introducir una puerta lógica NAND mediante la cual se controle la entrada alpin RESET del LM555. Así cuando este pin tenga cero voltios el circuito tendrá su salida a nivel bajo ycuando en el pin de RESET haya la tensión de alimentación (Vcc) el circuito tendrá a su salida la señalperiódica a 6 kHz.Para conseguir que el circuito se comporte así en una entrada de la puerta NAND estará conectada ala alimentación y la otra a la señal digital a emitir.El circuito resultante será:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 23
Figura 15. Circuito oscilador utilizando el circuito integrado LM555 con puerta NANDconectada al pin de RESET.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 24
1.7.- ESTUDIO DEL CIRCUITO RECEPTOR
Al igual que pasa en el circuito emisor, tendremos dos funciones de transferencia a tener en cuenta. Unade ellas refleja el aislamiento del circuito respecto a la tensión de red y la otra nos indica la atenuaciónque tendrá la señal recibida antes de llegar al detector de señal.
1.7.1.- FUNCIONES DE TRANSFERENCIA
De tal modo que para conseguir estos requisitos se utilizará un circuito de la forma siguiente:
Figura 16. Circuito receptor con filtro paso-banda.
Como analizar el circuito receptor entero sería bastante complejo, de cara a analizar el circuito receptorpodemos hacer una aproximación dividiéndolo en dos funciones de transferencia, la de entrada de laseñal proveniente de la red y la del filtro paso-banda. En este caso, podemos decir que la función detransferencia del circuito será el producto entre la función de transferencia entrada red-salidatransformador y la función salida transfromador-salida filtro. Así en primer lugar se calculará la función de transferencia entrada red-salida transformador. El circuitoa estudiar será:
Figura 17. Función salida-entrada del circuito receptor. Circuito inicial.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 25
Sustituyendo el transformador por su modelo sin pérdidas tenemos:
Figura 18. Función salida-entrada del circuito receptor. Circuito con modelo ideal deltransformador.
Analizando el circuito podemos decir que el transformador en la salida estará en circuito abierto con loque I2r=0. Quedando el circuito de la siguiente forma:
Figura 19. Función salida-entrada del circuito receptor. Circuito equivalente.
Con lo que
rror IsMV 1⋅⋅=
Así mismo, se obtiene la ecuación:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 26
inr
r
rrr
r
r VsC
IsLIsC
I =⋅
⋅+⋅⋅+⋅
⋅ 111111
De donde I1 será igual a
sLsC
VI
rr
inrr
⋅+⋅
=1
1 2
Con lo cual
sLsC
VsMV
rr
inrrtrafo
⋅+⋅
⋅⋅=1
2
Así la función de transferencia será
( ) ( )( ) sL
sC
sMsV
sVsH
rr
r
inr
trafo
⋅+⋅
⋅⋅==1
21
Simplificando tenemos que
( ) ( )( )
rr
r
rr
inr
trafo
CLs
sL
Lk
sV
sVsH
⋅+
⋅⋅==
1
2
2
1
2
2
Por otro lado tenemos la función salida transfromador-salida filtro, cuyo circuito será de la formasiguiente:
Figura 20. Función salida-entrada del filtro paso-banda. Circuito.
En primer lugar se calculará la impedancia de la bobina y el condensador en paralelo.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 27
( )211 sLC
sL
sLsC
sC
sL
sZff
f
f
f
f
f
f ⋅⋅+⋅
=⋅+
⋅
⋅⋅
=
Con lo cual la función de transferencia será
( ) ( )( ) ff
f
trafo
o
ZR
Z
sV
sVsG
+==
Con lo cual la función de transferencia será
( )2
2
1
1
sLC
sLR
sLC
sL
sG
ff
f
f
ff
f
⋅⋅+
⋅+
⋅⋅+⋅
=
Simplificando
( )
ffff
ff
LCs
RCs
sRC
sG
⋅+⋅
⋅+
⋅⋅
=11
1
2
Así la función de transferencia entrada red-salida filtro será
( ) ( ) ( )
ffff
ff
rr
r
rr
LCs
RCs
sRC
CLs
sL
Lk
sGsHsF
⋅+⋅
⋅+
⋅⋅
⋅
⋅+
⋅⋅=⋅=
11
1
2 2
1
2
2
1
2
Con lo cual
( )
⋅+⋅
⋅+⋅
⋅
+
⋅⋅⋅
=
ffffrr
r
r
ff
r
LCs
RCs
CLs
sL
L
RC
k
sF112 2
1
2
3
1
2
La ganancia de esta función de transferencia se representa en el siguiente diagrama de Bode. En él sepuede ver como el circuito se comporta de modo paso-banda.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 28
Figura 21. Función salida-entrada del receptor. Diagrama de Bode.
También interesa saber la función de transferencia intensidad entrada-tensión de red. Así si
rr
r
r
in
trafo
CLs
sL
Lk
sV
sVsH
⋅+
⋅⋅==
1
2
2
1
2
2)(
)()(
Como
rrtrafo IsMV 1⋅⋅=
Podemos decir que
sMCL
s
sL
Lk
sV
sIsJ
rrr
r
rr
inr
r
⋅⋅
⋅
+
⋅⋅==
1
2
2
1
2
1
2)(
)()(
rr
r
inr
r
CLs
sL
sV
sIsJ
⋅+
⋅==
1
2
11
2
1
)(
)()(
La ganancia de esta función de transferencia se representa en el siguiente diagrama de Bode. En él sepuede ver como el circuito se comporta de modo paso-banda.
GA
NA
NC
IA
FRECUENCIA
ωo
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 29
Figura 22. Función intensida-tensión de red del receptor. Diagrama de Bode.
1.7.2.- DISEÑO DEL CIRCUITO CONFORME A LAS ESPECIFICACIONES.
Mediante las funciones de transferencia se diseñará el circuito. Los condensadores de entrada debenmantener un compromiso, la intensidad a 50 Hz debe atenuarse de cara a que no cree problemas alcircuito y por otro lado, debe permitir un nivel de señal aceptable a 6 kHz procedente de la red. Estoscondensadores junto con las inductancias del transformador formarán un filtro paso altos. Para normalizar las señales de entrada tendremos dos diodos en antiparalelo a fin de recortar la señalde entrada si fuera necesario. Después de estos diodos habrá un filtro paso-banda que evitará frecuencias distintas a la detransmisión. La señal debidamente filtrada pasará al circuito decodificador de frecuencia, que detectará si la señal esde la frecuencia de transmisión (6 kHz) o no. Así transformaremos la señal analógica codificada a señaldigital. Este circuito tendrá como principal componente el circuito integrado LM567, que con toda unaserie de componentes externos se ajustará la frecuencia a detectar. Así si la frecuencia detectada es lade transmisión a la salida del LM567 tendremos 0 Voltios mientras dure la señal, y cuando la frecuenciano sea la de transmisión la salida será de 5 Voltios. Entre la salida del LM567 y GND se situará un condensador para minimizar el efecto que puedanprovocar posibles salidas erróneas. Para minimizar aún más estas salidas erróneas la salida del LM567pasará a través de dos inversores con histéresis CMOS. Para posteriormente adecuar los niveles detensión para poder ser transmitidos a través del puerto serie del PC.
1.7.2.1.- CÁLCULO DE LOS ELEMENTOS DEL CIRCUITO
Para calcular numéricamente los elementos de los que van a formar parte el circuito partiremos de lasfunciones de transferencia del circuito. Así las especificaciones más importantes del circuito será:- la frecuencia de corte. Al comportarse el circuito de un modo paso-banda, tendremos que en la
máxima transferencia de señal se dará en la frecuencia de corte. Por tanto intentaremos que éstassean la frecuencia de transmisión (6 kHz). Las expresiones de las frecuencias de corte son:
GA
NA
NC
IA
ωo
FRECUENCIA
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 30
rr
o CLf
⋅⋅
Π⋅=
11
2
2
1
fC Lo
f f2
1
2
1=
⋅⋅
⋅Π
- la atenuación de la corriente de la red (corriente a 50 Hz). Por otro lado la atenuación de la tensiónde red es importante ya que de ella depende la protección de los componentes del circuito. Unagran corriente de 50 Hz podría destruir los componentes del circuito. Si como hemos dicho lafrecuencia de corte está situada en la frecuencia de transmisión podemos simplificar la función detransferencia anteriormente calculada diciendo que para las frecuencias alejadas de las frecuenciasde corte (ω << ω0) como podría ser el caso de la frecuencia de red (50 Hz << 6kHz) la función detransferencia se puede simplificar por:
rr
r
in
r
CL
sL
sV
sIsJ
⋅
⋅==
1
11
2
1
)(
)()(
Simplificando obtenemos:
sC
sV
sIsJ r
inr
r ⋅==2)(
)()( 1
Por otro lado tenemos que las frecuencias de corte serán iguales a la frecuencia de emisión (6 kHz).con lo cual:
kHzCL
frr
o 62
2
1
11 =
⋅⋅
Π⋅=
fC L
kHzof f
2
1
2
16=
⋅⋅
⋅=
Π
Con lo cual podemos calcular L1 , C, Lf y Cf . Así pues:
mHLnFC rr 14100 1 ==
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 31
C nF L mHf f= =470 1 470,
En la práctica se utilizarán dos inductancias en serie para obtener ese valor de 1,470 mH:
HLmHL ff µ4701 21 ==
Asimismo se elegirá un transformador con una relación de transformación 1:1 por lo tanto L1r = L2 r.
Para calcular R se hará a través del ancho de banda de la función de transferencia del filtro, así
ffo CR
BW⋅
=⋅⋅=1
2 ωζ
De cara a tener un ancho de banda no muy grande elegiremos
Ω= 900fR
De cara a obtener este valor en la práctica utilizaremos dos resistencias en paralelo de valores:
Ω=Ω= 1001 21 ff RkR
Con lo que
BW Hz≈ 375
En este punto, tenemos que introducir otra especificación, así aceptaremos una intensidad de red comomucho de 25 mA de pico (≈18 mArms), con lo cual si :
ωω ⋅=2
)( rCjJ
Esta función es la misma que en el circuito emisor, algo se podía ser previsible ya que desde la entradade la red, el circuito es el mismo.Ahora se comprobará si se cumple la otra especificación. Como VRED es una señal senoidal podemosdecir que en régimen permanente la intensidad de entrada será una senoidal de amplitud igual a la deentrada atenuada por el módulo de la función de transferencia a la frecuencia de red. Por tanto si:
22202
502)(1 ⋅⋅
⋅Π⋅⋅= e
MAXr
CtI
Así sustituyendo valores :
mAtI MAXr 88,422202
50210100)(
9
1 =⋅⋅⋅Π⋅⋅⋅=−
De tal manera cumpliremos la especificación marcada.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 32
1.7.3.- PRUEBA DEL RECEPTOR SIN CONECTAR A LA RED
Una vez está montado el circuito emisor, el siguiente paso es el montaje del circuito receptor. Para ellose utilizó un circuito de la forma:
Figura 23. Circuito receptor con filtro paso-banda.
Así el circuito receptor tendrá dos condensadores de entrada que junto con el transformador deentrada filtrarán la señal que entra de la red. De tal forma que la señal a 50 Hz se atenúe lo máximoposible y que la señal de 6 kHz puede llegar con la máxima amplitud posible.Además después del transformador se situará un filtro RLC de forma que se atenúen lo máximo posiblelas frecuencias que no sean la frecuencia 6 kHz. Así se utilizarán los valores calculados anteriormente apartir de la función de transferencia
mHLnFC rr 14100 1 ==
C nF L mHf f= =470 1 470,
Ω= 900fR
Una vez montado el circuito, se hizo una prueba para comprobar que el circuito realmente secomportaba como un filtro paso banda con una frecuencia de corte de 6 kHz. Así se utilizó como señalde entrada una tensión senoidal producida por un generador de funciones. Las tensiones de salidamedidas (en mV) se pueden ver reflejadas en la siguiente tabla:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 33
AMPLITUD Vin (V)
0,5 1 5
1 1 mV 1 mV 1 mV
5 30 mV 60 mV 100 mV
5,8 60 mV 100 mV 140 mV
6 60 mV 100 mV 140 mV
6,4 60 mV 95 mV 130 mV
7 50 mV 75 mV 100 mV
9 24 mV 40 mV 60 mV
14 10 mV 18 mV 30 mV
18 8 mV 12 mV 22 mV
FRE
CU
EN
CIA
(kH
z)
45 4 mV 6 mV 9 mV
Tabla 6. Circuito paso-banda.. Valores reales.
Como se puede ver en la tabla el circuito efectivamente se comporta como un filtro paso-banda conuna frecuencia de corte del orden de 6 kHz y un ancho de banda de 2 kHz.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 34
1.8.- CONEXIÓN DE LOS CIRCUITOS EMISOR Y RECEPTOR
1.8.1.- PRUEBA DE LA CONEXIÓN DEL EMISOR Y RECEPTOR SIN CONECTAR ALA
RED
Una vez diseñado tanto el circuito emisor como el circuito receptor el siguiente paso es unir ambos demodo que lo transmitido por uno sea recibido por el otro. Así a la salida del emisor en lugar de la redde baja tensión, colocaremos una resistencia de 3,5 Ω que es el valor tomado de la figura F.2 delanexo F del la norma UNE EN 50065-1/A3, a la frecuencia de 6 kHz. El emisor estará igualmenteunido a la resistencia tal y como muestra la figura:
Figura 24. Conjunto circuitos emisor y receptor de prueba.
Del circuito anterior se pueden tomar toda una serie de señales que nos dicen cómo funciona realmenteel circuito y si éstas se parecen a las señales que a priori deberíamos tener.Así empezaremos por la tensión que hay entre el colector y el emisor del transistor del circuito emisor.La forma de onda obtenida es la siguiente:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 35
Figura 25. Tensión colector-emisor del transistor del circuito emisor.Podemos observar que la señal no es todo lo buena que quisiéramos ya que el efecto de la graninductancia del transformador hace que el transistor únicamente llegue a saturarse en un pequeñoperíodo de tiempo.Como consecuencia , la señal de salida ( señal en la resistencia) es asimétrica tanto en amplitud comoen duración entre el ciclo positivo y el ciclo negativo.
Figura 26. Tensión en la resistencia de salida del emisor (Rprueba).
La señal a la entrada del filtro del receptor debido al filtraje que se hace en el receptor pierdecomponentes y aunque pierde algo de forma también la asimetría de amplitud disminuye. La señal es lasiguiente:
50 100 150 200 250 300
5
10
15
20
TIEMPO ( µs )
TE
NS
IÓ
N
(V
)
50 100 150 200 250 300
- 1
- 0,5
0
0,5
TIEMPO ( µs )
TE
NS
IÓ
N
(V
)
1
- 1,5
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 36
Figura 27. Tensión en la entrada del filtro paso-banda del receptor.
Así esta señal sirve de entrada para el filtro pasa-banda que hay en el receptor. La salida de este filtroes la siguiente señal:
Figura 28. Tensión en la salida del filtro paso-banda del receptor.
La señal resultante tiene una forma mucho más senoidal aunque sigue siendo algo asimétrica conrespecto a los ciclos positivos y negativos.
1.8.2.- PRUEBA DE LA CONEXIÓN DEL EMISOR Y RECEPTOR CONECTANDO A LARED
Una vez comprobado que el circuito satisface en gran medida las expectativas que se tenían, quedacomprobar que estos resultados también se dan cuando en lugar de una resistencia el nexo entre amboscircuitos es la red pública de baja tensión.Así eliminando la resistencia tenemos el siguiente esquema:
50 100 150 200 250 300- 0,6
- 0,3
0
0,3
TIEMPO ( µs )
TE
NS
IÓ
N
(V
)0,6
50 100 150 200 250 300- 0,4
- 0,2
0
0,2
TIEMPO ( µs )
TE
NS
IÓ
N
(V
)
0,4
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 37
Figura 29. Esquema de la comunicación.
El resultado de este montaje es más o menos el mismo con la salvedad que la señal antes del filtro RLCtiene más distorsión debido a perturbaciones introducidas por la red. Sin embargo la señal a la salidadel filtro es la misma que cuando estaba la resistencia, ya que éste atenúa las frecuencias de estasperturbaciones.
1.8.3.- UNIÓN DE LOS CIRCUITOS AL PC
Después de comprobar que tanto el emisor como el receptor cumplen con lo previsto, necesitaremosun elemento que canalice esta información transmitida y recibida. Para esto utilizaremos un PC, el cual através de su puerto serie mantendrá la unión con el circuito emisor-receptor.Por lo que respecta al emisor la misión del PC será decir cuando debe y cuando no debe emitir señal.Esto se hará a través de la puerta NAND del circuito oscilador, cuya salida sirve de excitación altransistor del emisor. Aquí nos encontramos con un problema, el puerto serie se rige por la norma RS-232, y tiene unos niveles de salida de +12 V para un cero lógico y -12 V para un uno lógico, mientrasque las puertas lógicas NAND utilizadas tienen tecnología CMOS y utilizan unos niveles de señal de +5V para un uno lógico y 0 V para un cero lógico. Este obstáculo se salvará utilizando el circuitointegrado MAX232 cuya misión es transformar las señales con niveles RS-232 a señales con nivelesCMOS y TTL.En el receptor, el primer problema que encontramos es que la señal que obtenemos a la salida del filtroes analógica y el MAX232 tiene entradas digitales. Así si lo que queremos es que lo recibido pase alPC tendremos que transformar esta señal analógica por una señal digital. Este paso se realizará con elintegrado LM567, cuya misión es detectar que en su entrada existe una señal de una frecuenciadeterminada. De tal modo que en este caso si la señal a la entrada del LM567 es una señal de 6 kHz asu salida tendremos 0 V y si a su entrada tiene una señal distinta a 6 kHz tendrá una salida de 5 V. Conesto tendremos ya una señal digital que se podrá utilizar como entrada del MAX232.La configuración del LM567 que en principio se montó fue:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 38
Figura 30. Configuración básica del detector de frecuencia basado en el circuito integradoLM567.
Los valores de los componentes utilizados se diseñaron de acuerdo a las expresiones siguientes:
fR Co =
⋅ ⋅1
11 1 1,
BWv
f Cde fi
oo= ⋅
⋅1070
2
%
C C3 22≥ ⋅
Teniendo en cuenta que vi = 0.4 VRMS y que se elegirá un ancho de banda grande ya que la señal noserá exactamente 6 kHz, con lo cual, BW = 14 %, obtendremos los valores de los componentes de talmodo que:
C nF
C nF
C F
R
1
2
3
1
47
470
1
3224
====
µΩ
De cara a una corriente de salida pequeña se elegirá
R KL = 100 Ω
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 39
Con esta configuración el circuito tiene una respuesta buena ya que no tiene salidas erróneas (detectacorrectamente la señal a 6 kHz), pero tiene el inconveniente que tiene una respuesta muy lenta ya quenecesita 50 ms ( 300 ciclos de señal a 6kHz) para que la salida sea correcta.Este montaje tiene una respuesta demasiado lenta (20 bits por segundo), por eso después el montaje semodificó a fin de mejorar la velocidad y el número de ciclos para detectar la señal. Los principalescausantes de esta pobre respuesta son C2 y C3 , que tienen un valor demasiado grande, ya que estoscondensadores para que el circuito tenga la mayor velocidad posible (10 ciclos de fo) tendrían que tenerlos siguientes valores:
( )
( )
Cf
F F nF
Cf
F nF
o
o
2
3
130 130
600021 6
26043 3
= = =
= =
µ µ
µ
,
,
Así que para resolver este problema se utilizó el siguiente montaje:
Figura 31. Configuración detector de frecuencia basado en el circuito integrado LM567 de caraa mejorar la velocidad de respuesta.
En este caso :
R RR R
R RAB C
B C
= +⋅+
130 10 1300 102f
K R
RC
f
K R
RO O
⋅+
< < ⋅
+
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 40
Vistos los valores de C2 que hacen que el circuito funcione a mayor velocidad, se escogerá
C nF2 47=
Para que se cumpla la segunda expresión tomaremos los siguientes valores
R K
R
R K
A
B
C
===
270
500
1
ΩΩ
Ω
Finalmente de cara a mejorar la señal de salida y evitar por completo las salidas erróneas se introduciráun condensador de 10 nF entre la salida del LM567 y masa. De este modo se atenuarán las posiblessalidas erróneas evitando los errores de transmisión y además conservando una velocidad buena. Elcircuito quedaría finalmente:
Figura 32. Configuración del detector de frecuencia basado en el circuito integrado LM567 concondensador en la salida.
1.8.4.- PRUEBA DE LA CONEXIÓN DEL EMISOR Y RECEPTOR SIN CONECTAR ALA RED
RED Y CONECTADOS A PC
Una vez está resuelto el problema de cómo comunicar el emisor-receptor con el PC, nos encontramoscon el problema de si tal y como está el circuito, la comunicación es posible. O más correctamente silas especificaciones de emisión y recepción se cumplen.Así, el emisor sólo deberá consumir cuando emita, con lo que el oscilador no deberá generar señal, y
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 41
por otra parte, el receptor tendrá a su salida el nivel alto ya que en la norma RS-232 cuando no se estáemitiendo la línea está a nivel alto.Dicho esto, y teniendo en cuenta que la señal de salida del LM567 es cero si la señal es de 6 kHz yuno para cualquier otra entrada, a la salida del MAX232 se pondrán dos inversores en serie de cara aasegurar unos niveles de señal CMOS. La señal de salida de éstos será la entrada de la puerta NANDque controla el circuito oscilador del LM555. Esta puerta NAND tiene una entrada puesta a uno conlo cual a su salida tendrá la señal de los inversores negada. Así si no hay nada que emitir (línea a uno) elcircuito no oscilará con lo cual no habrá consumo.Por otra parte, en el receptor tendremos el mismo caso, a la salida del LM567 habrá dos inversores enserie para asegurar niveles de señal CMOS. Además como el LM567 también tiene la salida negada, sino hay señal de 6 kHz (o lo que es lo mismo si no hay un uno), la señal de salida será uno. Con lo cualsi no se emite nada (cero a la entrada), a la salida del LM567 tendremos un uno con lo cual estamosdiciendo al PC que mientras no se indique lo contrario, no se está emitiendo nada.De tal modo el circuito detector de frecuencia del receptor quedará de la siguiente manera:
Figura 33. Configuración del detector de frecuencia basado en el circuito integrado LM567 conadecuación de señal a CMOS.
1.8.5.- PRUEBA DE LA CONEXIÓN DEL EMISOR Y RECEPTOR CONECTANDO A LA RED Y CONECTADOS A PC
Una vez hechas todas las configuraciones y mejoras descritas anteriormente, por último se harán laspruebas definitivas. En éstas se intentarán conseguir las pretensiones que tenía el proyecto en unprincipio.Las pruebas se hicieron en los laboratorios de la primera planta del edificio de la ETSE en el ComplexEducatiu de Tarragona. Así todas las pruebas se llevaron a cabo en los citados laboratorios, éstosdisponen de una red eléctrica trifásica con una tensión entre fases de 220 voltios. Mientras se realizabanlos ensayos en esta planta se hacían los trabajos habituales, con lo cual estaban en funcionamiento los
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 42
elementos usuales del laboratorio de electrónica, como podían ser ordenadores, fuentes dealimentación, osciloscopios, electroválvulas, taladros, máquinas de fabricación de circuitos impresos,luminarias fluorescentes, etc. Además, la instalación tendrá sus interruptores magnetotérmicos einterruptores diferenciales.Así, se realizaron varias pruebas aumentando cada vez la distancia entre los prototipos. En todas laspruebas la velocidad de transmisión era de 50 bits por segundo. De este modo, la primera prueba sellevó a cabo dentro del mismo laboratorio con una distancia aproximada de 10 metros de cable. Losresultados fueron satisfactorios con una tasa de error del 1 % aproximadamente. Posteriormente se hizouna segunda prueba entre dos laboratorios con una distancia de cabe de unos 85 metros. Al igual queen la anterior prueba el porcentaje de errores está alrededor del 1 %. La tercera prueba se realizo entredos laboratorios al igual que la anterior , sin embargo en este caso la longitud aproximada de cableentre ambos era de 150 metros. La tasa de error en este caso era la misma que en las pruebasanteriores, el 1 %.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 43
1.9.- DISEÑO FUENTE ALIMENTACIÓN
Una vez diseñado el equipo emisor-receptor necesitamos una fuente de alimentación para dar servicio alos circuitos integrados y al propio circuito emisor. Así se construirá una fuente cuya entrada sea laseñal de la red y tenga dos salidas en continua a 12 y a 5 voltios. Además la fuente debe tener sercapaz de suministrar 1 amperio de intensidad. Para esto se utilizará un circuito que tendrá la formasiguiente:
Figura 34. Fuente de alimentación.
El transformador utilizado es 220/15 de 3 A. Después se utilizará un puente de diodos con uncondensador en paralelo para rectificar la tensión. El valor del condensador será:
r
o
VF
IC
⋅⋅⋅=
221
Donde:- F = 2*fred (en este caso).- Io = intensidad de salida.- Vr = tensión de rizado. De modo que Vo = Emax - Vr.
Como la diferencia de tensión entre la entrada y la salida del regulador de tensión interesa que sea del 7V. Así:
7=− oin VV
712 =−inV
VVin 19=
Como el transformador a utilizar tiene una salida de 15 V, y la tensión a la entrada del reguladorinteresa que sea de 19 V podemos calcular la tensión de rizado que podemos admitir:
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 44
rmaxo VEV −=
rV−⋅= 21519
.21,2 VVr =
De tal modo que:
mFC 221,260222
5,11 =
⋅⋅⋅⋅=
Así que se escogerá el valor comercial de 2.200 µF, que corresponderá una tensión de rizado de
VVr 2102,260222
5,13
=⋅⋅⋅⋅⋅
=−
Que es una tensión aceptable.El siguiente paso es calcular la resistencia a utilizar junto con el transistor y el regulador de cara a quesea capaz de mantener una intensidad más o menos alta.El valor de la resistencia será:
RV
II
EB
REG
Q
=−
β
Y el de la intensidad de salida del regulador será:
−⋅+=
R
VIII EB
REGREGO β
Sabiendo que se utilizará como transistor un BD136, cuyas características son:
β = 40÷250
VEB = 1 V
Ipeak = 2 A
Si escogemos que en la salida a 12 V dispongamos de 1,5 A y que la intensidad que pase por elregulador sea de 100 mA tenemos que:
I I IV
RO REG REGEB= + ⋅ −
β
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 45
1 5 401
, = + ⋅ −
I I
RREG REG
Eligiendo R = 10 Ω, tendremos que
1 5 401
10, = + ⋅ −
I IREG REG
Con lo que:
I AREG = 0,134
Como
RV
II I
EB
REG
Q Q
=−
=−
=
β
1
0,13440
10
Así que
I AQ = 1 36,
Con lo cual vemos que tanto la intensidad del regulador como la del transistor es admisible.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 46
1.10.- PROGRAMA DE APLICACIÓN
Como ya se ha dicho, la aplicación que se va a implementar utilizando los equipos emisor-receptor esun programa “chat”. La particularidad que tiene es que la red eléctrica no permite una comunicaciónbidireccional simultánea. Así un equipo actuará como “master” y el otro como esclavo, de tal modoque el “master” será quien diga cuándo debe emitir el esclavo.De esta manera, tendremos dos programas, uno en cada equipo: “master” y “slave”.El modo de emitir datos será por paquetes de datos que siempre comenzarán con un byte cuyo valorserá 128 y acabará con un byte con valor 129. El equipo “master” emitirá cuando se hayan escrito 100caracteres desde la última emisión o cuando se pulse F1. Por su parte el equipo esclavo emitirá cuandoel “master” se lo indique, o lo que es lo mismo cuando le envíen el carácter 130, consecuencia de haberpulsado en el “master” la tecla F2.Los caracteres recibidos provocarán una interrupción, con su correspondiente rutina de atención a lainterrupción.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 47
A continuación se presentan los diagramas de flujo de las rutinas de atención a las interrupciones y delprograma .
INTERRUPCIÓN MASTER
Figura 35.Diagrama de flujo de la rutina de atención a la interrupción serie del programaMASTER.
IRQ ESPERANDO?
INICIO INTERRUPCIÓN
EMISIÓN?LEER
STATUS?RECEPCIÓN?
LEER BYTE RECIBIDO
FIN INTERRUPCIÓN
NO
SI
NONO
SI SI SI
NO
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 48
PROGRAMA MASTER
Figura 36. Diagrama de flujo del programa MASTER.
LETRA=F2?
ELEMENTOS =100?
INICIALIZACIÓN REGISTROS
INICO PROGRAMA
LEER DE TECLADO
ENVIAR PAQUETE
LETRA=F1?
ENVIAR PAQUETE
ENVIAR 130
HABILITAR RECEPCIÓN
RECIBIR DATOS
DESHABILITAR RECEPCIÓN
ESCRIBIR E INSERTAR EN PAQUETE
LETRA=ESC?
FIN PROGRAMA
NO
SI
NO NO
SI SI
NO
SI
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 49
INTERRUPCIÓN ESCLAVO
Figura 37. Diagrama de flujo de la rutina de atención a la interrupción serie del programaESCLAVO.
IRQ ESPERANDO?
INICIO INTERRUPCIÓN
EMISIÓN?LEER
STATUS?RECEPCIÓN?
LEER BYTE RECIBIDO
BYTE=FIN PAQUETE?
RECIBIR=1
BYTE=130
ENVIAR=1
FIN INTERRUPCIÓN
NO
SI
NONO
SI SI SI
NO
NO
SI
NO
SI
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 50
PROGRAMA ESCLAVO
Figura 38. Diagrama de flujo del programa ESCLAVO.
RECIBIR=1?
INICIALIZACIÓN REGISTROS
LEER Y PRESENTAR RECEPCIÓN
DESHABILITAR RECEPCIÓN
ENVIAR LISTA
FIN PAQUETE?
ENVIAR=1?
HABILITAR RECEPCIÓN
TECLA PULSADA?
ESCRIBIR EN PANTALLA E INSERTAR EN LISTA
TECLA PULSADA=ESC?
FIN PROGRAMA
INICO PROGRAMA
NO
SI
NO
SI
NO
SI
NO
SI
NO
SI
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 51
1.11.- POSIBLES MEJORAS
En este punto se tratarán las reformas necesarias de cara a poder mejoras el funcionamiento,modificando las especificaciones del equipo. Así el equipo podría emitir a una diferente frecuencia ocon algún cambio podría tener otra aplicación ( no estar unido a un PC ). Estos cambios podríamosresumirlos en:
- Emisión a menor frecuencia: La frecuencia actual de 6 kHz se podría llegar a reducir hasta los 3kHz que es lo mínimo que especifica la norma. Con esto se podría llegar a emitir a una mayordistancia. Para ello se debería rediseñar los transformadores tanto del emisor como del receptor. Elmás crítico sería el transformador del emisor que debería aumentar su inductancia ya que, como seha dicho, la frecuencia de corte del emisor es:
( )21 1
2
2
1
eee
oeKCL
f−⋅⋅Π⋅
=
con lo que si se quiere tener una frecuencia de corte igual a 3 kHz, tendremos que:
( ) 30001
2
2
12
1
=−⋅⋅Π⋅
=eee
oeKCL
f
Con lo cual obtendremos que
( ) 012,01 2
1 =−⋅ ee KL
Teniendo en cuenta que esta misma relación cuando la frecuencia de emisión es de 6 kHz es:
( ) 32
1 109941248,21 −⋅=−⋅ ee KL
Comparando ambos valores y suponiendo que la inducción mutua será igual en ambos casostenemos que:
( )( ) 4
109941248,2
012,0
109941248,2
012,0
1
13
)6(1
)3(1
32)6(1
2)3(1 ≈
⋅=⇒
⋅=
−⋅
−⋅−−
kHze
kHze
ekHze
ekHze
L
L
KL
KL
O lo que es mismo, que la inductancia será cuatro veces mayor, con lo cual, el número de espirasserá el doble si se utilizara el mismo núcleo que en este proyecto. Así pues es muy probable que sedebiera utilizar un hilo de 0,2 ó 0,3 mm2 para realizar el transformador en lugar del hilo de 0,5 mm2que se ha utilizado.Por otro lado si se utilizara un núcleo distinto al que se ha utilizado en este proyecto, debería ser unnúcleo con mayor permeabilidad ( la del núcleo utilizado es igual a 6000). Para tener el mismonúmero de espiras debería tener una permeabilidad cuatro veces mayor, respetando las mismasdimensiones.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 52
Además se debería volver a calcular el filtro de entrada del receptor, adecuándolo a la frecuenciade corte que corresponda, y el oscilador del emisor, ya que la frecuencia de emisión sería distinta.Por otro lado es posible que se tuviera que encontrar un detector de frecuencia más rápido que elLM567 de cara a tener una comunicación más veloz.
- Emisión a mayor velocidad: La velocidad del diseño actual sin cambiar la frecuencia de transmisiónpodría aumentarse mejorando el filtro que tiene el receptor y posteriormente amplificando la señalde cara a que a la entrada del detector de frecuencia tuviéramos una señal con mejor forma ymayor amplitud a la frecuencia de comunicación. Esto podría hacerse con algún filtro activo basadoen amplificadores operacionales que se pudiera ajustar la frecuencia de corte.Otro modo de mejorar la velocidad sería aumentar la frecuencia de transmisión, esto empeoraría ladistancia a la que se quiere transmitir pero mejoraría la velocidad de transmisión. De este modo loscomponentes del circuito debería rediseñarse, así, el transformador del emisor disminuiría suinductancia de modo que podría incluso elegir un núcleo de menores dimensiones, o bien, loscondensadores de entrada podrían ser más pequeños con lo que la influencia de la tensión de redsería mucho menor.También se podría mejorar la velocidad si se pudiera encontrar un detector de frecuencia quenecesitara menos ciclos de señal para detectar la frecuencia a la que realizamos la transmisión.
- Otro aspecto a tener en cuenta es que el equipo podría no estar unido al PC, de modo que la señalque tendría el emisor que comunicar podría proceder de un pulsador, un sensor todo-nada ocualquier otro componente que pueda generar una señal y por otra parte unido al receptor podríaestar unido un led, una electro-válvula o bien podría servir como una entrada a unmicrocontrolador. Todas estas otras aplicaciones obviamente necesitarán circuitos adicionales paraadecuar las señales. En algunas de estas aplicaciones la velocidad de transmisión quizá no sería lomás importante ya que la utilidad podría no tener una frecuencia muy grande.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
2.- MEDICIONES Y PRESUPUESTO
2.1.- MEDICIONES
NOMBRECOMPONENTE
CONCEPTO UND
C4 - C5 - C6 - CL Condensador. 10 nF. 63 V. Cerámico 4C1 - C2 Condensador. 47 nF. 63 V. Cerámico 2C4 - C5 (FUENTE) Condensador. 100 nF. 35 V. Cerámico. 2C3 Condensador. 100 nF. 63 V. Cerámico 1Cr1 - Cr2 Condensador. 100 nF 400 V. Cerámico 2Cf Condensador. 470 nF. 63 V. Cerámico 1Ce1 - Ce2 Condensador. 470 nF 400 V. Cerámico 2C3 - C6 (FUENTE) Condensador. 1 µF. 35 V. Electrolítico 2C7 - C8 - C9 - C10 Condensador. 1 µF. 63 V. Electrolítico 4C2 (FUENTE) Condensador. 100 µF. 35 V. Electrolítico. 1C1 (FUENTE) Condensador. 2200 µF. 35 V. Electrolítico. 1R Resistencia. 10 Ω - 1W 1RD Resistencia. 100 Ω - 1/4 W 2RC - RE - Rf1 Resistencia. 1 kΩ - 1/4 W 3RH2 Resistencia. 10 kΩ - 1/4 W 1RH1 Resistencia. 27 kΩ - 1/4 W 1RL Resistencia. 100 kΩ - 1/4 W 1RA Resistencia. 270 KΩ - 1/4 W 1RB Potenciómetro multivuelta. 500 Ω 1RJ - R1 Potenciómetro multivuelta. 5 kΩ 2RG Potenciómetro multivuelta. 10 kΩ 1D1 - D2 Diodo 1N4007 2DZ2 Diodo zener 7V5 1 W 1DZ1 Diodo zener 13V 1 W 1Lf1 Inductancia 1 mH 1Lf2 Inductancia 470 µH 1Q1 Transistor BD139 1Q1 (FUENTE) Transistor BD536 1BR1 Puente rectificador B40C2300-1500 1U1 (FUENTE) Regulador LM7812 1U2 (FUENTE) Regulador LM7805 1U1 Circuito integrado LM555 1U2 Circuito integrado 74HC00 1U3 Circuito integrado 74HC14 1U4 Circuito integrado MAX232 1U5 Circuito integrado LM567 1TR1 Transformador 220 V/15 V 3 A 1
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 54
NOMBRECOMPONENTE
CONCEPTO UND
Regleta dos bornes 2Regleta tres bornes 2Zócalo IC DIL-8 2Zócalo IC DIL-14 2Zócalo IC DIL-16 1Núcleo toroidal de ferrita dim. 36x23x15 mm 2Carrete hilo cobre esmaltado φ = 0,5 mm 1Disipador 2Conector para CI macho DIN 41651 de 26 pins 1Cable plano de 25 hilos 0,3Conector aéreo hembra DIN 41651 de 26 pins 1Conector aéreo hembra DB-25 para cable plano 1Caja metálica de dimensiones 205x205x110 (mm) 1Placa circuito impreso de fibra de vidrio doble cara 1Placa circuito impreso de fibra de vidrio cara simple 1
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 55
2.2.- PRECIOS UNITARIOS
CONCEPTO PRECIOUNITARIO
Condensador. 10 nF. 63 V. Cerámico 15Condensador. 47 nF. 63 V. Cerámico 15Condensador. 100 nF. 35 V. Cerámico. 15Condensador. 100 nF. 63 V. Cerámico 15Condensador. 100 nF 400 V. Cerámico 28Condensador. 470 nF. 63 V. Cerámico 15Condensador. 470 nF 400 V. Cerámico 105Condensador. 1 µF. 35 V. Electrolítico 13Condensador. 1 µF. 63 V. Electrolítico 13Condensador. 100 µF. 35 V. Electrolítico. 14Condensador. 2200 µF. 35 V. Electrolítico. 137Resistencia. 10 Ω - 1W 10Resistencia. 100 Ω - 1/4 W 4Resistencia. 1 kΩ - 1/4 W 4Resistencia. 10 kΩ - 1/4 W 4Resistencia. 27 kΩ - 1/4 W 4Resistencia. 100 kΩ - 1/4 W 4Resistencia. 270 KΩ - 1/4 W 4Potenciómetro multivuelta. 500 Ω 240Potenciómetro multivuelta. 5 kΩ 240Potenciómetro multivuelta. 10 kΩ 240Diodo 1N4007 10Diodo zener 7V5 1 W 20Diodo zener 13V 1 W 20Inductancia 1 mH 76Inductancia 470 µH 76Transistor BD139 45Transistor BD536 102Puente rectificador B40C2300-1500 79Regulador LM7812 80Regulador LM7805 77Circuito integrado LM555 63Circuito integrado 74HC00 53Circuito integrado 74HC14 127Circuito integrado MAX232 259Circuito integrado LM567 132Transformador 220 V/15 V 3 A 2.741
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 56
CONCEPTO PRECIOUNITARIO
Regleta dos bornes 70Regleta tres bornes 104Zócalo IC DIL-8 20Zócalo IC DIL-14 35Zócalo IC DIL-16 40Núcleo toroidal de ferrita 36x23x15 mm 667Carrete hilo cobre esmaltado φ = 0,5 mm 410Disipador 63Conector para CI macho DIN 41651 de 26 pins 81Cable plano de 25 hilos 8Conector aéreo hembra DIN 41651 de 26 pins 137Conector aéreo hembra DB-25 para cable plano 364Caja metálica de dimensiones 205x205x110 (mm) 1.852Placa circuito impreso de fibra de vidrio doble cara 1.657Placa circuito impreso de fibra de vidrio cara simple 510
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 57
2.3.- PRECIOS COMPUESTOS
A.- COMPONENTES
CONCEPTO UND PRECIOUNITARIO
TOTAL
Condensador. 10 nF. 63 V. Cerámico 4 15 60Condensador. 47 nF. 63 V. Cerámico 2 15 30Condensador. 100 nF. 35 V. Cerámico. 2 15 30Condensador. 100 nF. 63 V. Cerámico 1 15 15Condensador. 100 nF 400 V. Cerámico 2 28 56Condensador. 470 nF. 63 V. Cerámico 1 15 15Condensador. 470 nF 400 V. Cerámico 2 105 210Condensador. 1 µF. 35 V. Electrolítico 2 13 26Condensador. 1 µF. 63 V. Electrolítico 4 13 52Condensador. 100 µF. 35 V. Electrolítico. 1 14 14Condensador. 2200 µF. 35 V. Electrolítico. 1 137 137Resistencia. 10 Ω - 1W 1 10 10Resistencia. 100 Ω - 1/4 W 2 4 8Resistencia. 1 kΩ - 1/4 W 3 4 12Resistencia. 10 kΩ - 1/4 W 1 4 4Resistencia. 27 kΩ - 1/4 W 1 4 4Resistencia. 100 kΩ - 1/4 W 1 4 4Resistencia. 270 KΩ - 1/4 W 1 4 4Potenciómetro multivuelta. 500 Ω 1 240 240Potenciómetro multivuelta. 5 kΩ 2 240 480Potenciómetro multivuelta. 10 kΩ 1 240 240Diodo 1N4007 2 10 20Diodo zener 7V5 1 W 1 20 20Diodo zener 13V 1 W 1 20 20Inductancia 1 mH 1 76 76Inductancia 470 µH 1 76 76Transistor BD139 1 45 45Transistor BD536 1 102 102Puente rectificador B40C2300-1500 1 79 79Regulador LM7812 1 80 80Regulador LM7805 1 77 77Circuito integrado LM555 1 63 63Circuito integrado 74HC00 1 53 53Circuito integrado 74HC14 1 127 127Circuito integrado MAX232 1 259 259Circuito integrado LM567 1 132 132
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 58
CONCEPTO UND PRECIOUNITARIO
TOTAL
Transformador 220 V/15 V 3 A 1 2.741 2.741Regleta dos bornes 2 70 140Regleta tres bornes 2 104 208Zócalo IC DIL-8 2 20 40Zócalo IC DIL-14 2 35 70Zócalo IC DIL-16 1 40 40Núcleo toroidal de ferrita 36x23x15 mm 2 667 1.334Carrete hilo cobre esmaltado φ = 0,5 mm 1 410 410Disipador 2 63 126Conector para CI macho DIN 41651 de 26pins
1 81 81
Cable plano de 25 hilos 0,3 8 2Conector aéreo hembra DIN 41651 de 26pins
1 137 137
Conector aéreo hembra DB-25 para cableplano
1 364 364
Caja metálica de dimensiones 205x205x110(mm)
1 1.852 1.852
Placa circuito impreso de fibra de vidriodoble cara
1 1.657 1.657
Placa circuito impreso de fibra de vidrio carasimple
1 510 510
TOTAL EQUIPO 12.592
TOTALCOMPONENTES(DOS EQUIPOS)
25.185
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 59
B.-DISEÑO Y PUESTA EN MARCHA
UND CONCEPTO CANTIDAD PRECIOUNITARIO
TOTAL
Horas Estudio teórico 25 1.800 45.000Horas Diseño circuitos 50 1.800 90.000Horas Diseño placas circuito impreso 40 1.800 72.000Horas Realización programas 30 1.800 54.000Horas Montaje (dos equipos) 12 1.800 21.600Horas Puesta en marcha (dos equipos) 15 1.800 27.000P.A. Amortización equipo y software 1 45.000 45.000
TOTAL 354.600
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Pág. 60
2.4.- PRESUPUESTO GENERAL
El presupuesto general comprenderá los siguientes conceptos:
A.- COMPONENTES ......................................................................................... 25.185
B.- DISEÑO Y PUESTA EN MARCHA ........................................................... 354.600
--------------------------
PRESUPUESTO DE EJECUCIÓN MATERIAL .......................................... 379.785
IVA (16 %) ........................................................................................................ 60.766
PRESUPUESTO TOTAL .................................................................................. 440.551
El presupuesto total de este proyecto asciende a la cantidad de cuatrocientas cuarenta milquinientas cincuenta y una pesetas.
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
3.- ANEXOS
3.1.- LISTADO PROGRAMA
PROGRAMA MASTER
/******************************************************* MASTER.C ** ** Este programa chat se presenta en dos vestanas: una para ** la emisión y otra para la recepción. As¡, todos los datos que ** se entran por teclado se van almacenando en un vector. Cuando ** el vector está lleno o se pulsa F1, se envía el vector (paquete). ** Este paquete tiene un caracter de inicio de paquete (128) y otro ** de final de paquete (129). Si se pulsa F2 se reciben los datos ** que tiene el equipo esclavo. ** *******************************************************/#include <dos.h>#include <ctype.h>#include <process.h>#include<stdio.h>#include <conio.h>#include <graphics.h>
#include "types.h"#include "serutil.h"#include "irqutil.h"#include "args.h"#include "win.h"
#include "args.c"#include "serutil.c"#include "irqutil.c"#include "win.c"
/* -------------------- CONSTANTES--------------------- */#define XO 100#define XF (XO+459)#define XI (XO+5)#define migy (maxy/2)#define LS ((((migy)-XI)/2)+XI)#define INICIO_PAQUETE 128#define FIN_PAQUETE 129#define ESC 27#define ENTER 13#define F1 59#define F2 60
/*- Variables globales -----------------------------------------------*/int entra=0; /* entra=1 si se recibe un caracter*/unsigned char c[2];
int envRecepcion=0; /*contador de los elementos recibidos*/int saltoRecepcion=0; /*contador de los saltos de linea en los elementos recibidos*/int env=0; /*contador de elementos en lapantalla de emision*/int salto=0; /*contador de los saltos de lineaen los elementos
enviados*/INT iSerPort;INT iSerIRQ;int enviado=1; /* enviado=1 si se recibeun caracter*/int maxx,maxy, /*coordenadas m ximas de la pantalla*/ xRecepcion, /*coordenada x de la recepción*/ xEmision, /*coordenada x de la emisión*/ yEmision, /*coordenada y de la emisión*/ yRecepcion, /*coordenada y de la recepción*/ xEmiAnterior, /*coordenada x del elemento emitido anteriormente*/ xRecepcionAnterior;/*coordenada x del elemento recibido
anteriormente*/int i=0;charpantallaRecepcion[1700]; /*vector para guardar los
elementos que se reciben*/intsaltosRecepcion[1700]; /*vector para guardar la posición donde se encuentran los saltos de linea*//*declaración de funciones*/int EscribirPaquete(unsigned char *);voidMoverVectorChar(int,char *,int *);void MoverVectorInt(int,int *,int *);void EscribirVector(int,int,int,char *);void PresentaRecepcion(void); (int *,int *);void TodoCerosChar(char *);void TodoCerosInt(int *);void BorrarVentana(int,int,char *);void SubirLinea(int,int,int *,char *,int *,int *);
/*****************************************************//* GetSer : Rutina de interr., disparado por el puerto serie *//*****************************************************/VOID __interrupt _FP GetSer( VOID ) static BYTE bIRQID;
bIRQID = ( BYTE )inp( iSerPort + SER_IRQ_ID ); if( ! ( bIRQID & SER_ID_PENDING ) ) /* IRQ eperando ? */ switch( bIRQID & SER_ID_MASK ) case SER_ID_RECEIVED: /* Después de recepción */
entra=1; /*se ha recibido un caracter*/c[ 0 ] = ( BYTE )inp( iSerPort + SER_RXBUFFER );/*lectura del caracter*/ c[ 1 ] = '\0';break; case SER_ID_SENT: /*
Después de envío */enviado=1; /*se ha enviado un caracter*/
break; case SER_ID_MODEMSTATUS: /* Después de modif. de
estados de línea */ break; irq_SendEOI( iSerIRQ ); /* fin deinterrupción */
/*****************************************************//* P R O G R A M A P R I N C I P A L *//*****************************************************/VOID main( INT argc, PCHAR argv[] ) unsigned char paquete[102]; /*conjunto de caracteres a enviar*/ int indice; char baud[25]; static INT iCom; static LONG lBaud; VOID (_interrupt _FP *lpOldIRQ)();
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
INT iUART; char pantallaEmi[1700]; /*almacenamiento de todos los
elementos que hay en pantalla*/ int saltosEmi[1700]; /*almacenamiento de todos los saltos
de linea que hay en pantalla*/
/* gráficos -------------- */ int driver, modo, n, errorcode ; unsigned char letra[12]; unsigned char le; int k=0; int je;
TodoCerosChar(&pantallaEmi); /*ceros en todo el vector*/ TodoCerosInt(&saltosEmi); /*ceros en todo el vector*/ TodoCerosChar(&pantallaRecepcion); /*ceros en todo el
vector*/TodoCerosInt(&saltosRecepcion); /*ceros en todo el vector*/
if( FindString( argv, "?", argc ) ) printf("Sintaxis:\n" ); printf("MASTER [-COM:comport] [-BAUD:baudrate]\n"); printf("comport = 1 ó 2 (Por defecto: 1)\n"); printf("baudrate = 50 - 115200 (Por defecto: 9600)\n"); exit(0);
if( GetArg( argc, argv, "-COM:", _int, &iCom, 1 ) ) if( iCom == 1 ) iSerPort = SER_COM1; /* Sólo COM1 y COM2 están
"estandarizados" */ iSerIRQ = SER_IRQ_COM1; else if( iCom == 2 ) iSerPort = SER_COM2; /* Sólo COM1 y COM2 están
"estandarizados" */ iSerIRQ = SER_IRQ_COM2; else printf("Puerto COM no soportado\n"); exit(0); else iSerPort = SER_COM1; /* Sólo COM1 y COM2 están
"estandarizados" */ iSerIRQ = SER_IRQ_COM1; if( !GetArg( argc, argv, "-BAUD:", _long, &lBaud, 1 ) ) lBaud =9600L; /* Tasa máxima en UART 8450A */ if( lBaud > SER_MAXBAUD ) printf("Baudrate demasiado alto\n"); printf("M ximo: %ld Bd\n", SER_MAXBAUD ); exit(0);
iUART = ser_Init( iSerPort, lBaud, SER_LCR_8BITS | SER_LCR_1STOPBIT | SER_LCR_NOPARITY );
if( iUART == NOSER ) printf("No hay puerto\n"); exit( 0 ); if( iUART > INS8250 ) ser_FIFOLevel( iSerPort, SER_FIFO_TRIGGER14 );
/* instalar interrup. serie */ lpOldIRQ = ser_SetIRQHandler( iSerPort, iSerIRQ, GetSer,
SER_IER_SENT );
/* inicialización de la pantalla gráfica----------------------------------------- */driver=DETECT;modo=2;initgraph(&driver,&modo,"c:\\luis\\bc\\bgi");errorcode=graphresult();if (errorcode != grOk)
printf("Graphics error:%s\n", grapherrormsg(errorcode) ) ;
printf("Press any key to halt");getch();exit(1);
/* dibujo de los rectángulos donde estarán los caracteres---------------------------------------------------------------------- */
setcolor(WHITE);maxx =getmaxx();maxy =getmaxy();setlinestyle(SOLID_LINE, 1, 3);rectangle (0,0,maxx,maxy/2-25);rectangle (0,maxy/2-25,maxx,maxy-50);rectangle (0,maxy-50,maxx,maxy);
if (iCom==2) outtextxy(5,maxy-45,"PUERTO UTILIZADO: COM2");else outtextxy(5,maxy-45,"PUERTO UTILIZADO: COM1");
outtextxy(5,maxy-25,"BAUDRATE:");ltoa(lBaud,baud,10);outtextxy(85,maxy-25,&baud);outtextxy(140,maxy-25,"bps.");outtextxy(245,maxy-45,"F1 : ENVIAR PAQUETE");outtextxy(245,maxy-25,"F2 : RECIBIR PAQUETE");outtextxy(435,maxy-45,"ESC : SALIR DEL PROGRAMA");outtextxy(435,maxy-25,"ESTADO:");
outtextxy(5,5,"RECEPCION");rectangle (0,0,80,17);xRecepcion=9;yRecepcion=24;outtextxy(5,maxy/2-20,"EMISION");rectangle(0,maxy/2-25,65,maxy/2-8);xEmision=9;yEmision=maxy/2;setbkcolor(1);
/*el primer valor del paquete es 128 (inicio paquete)*/paquete[0]=INICIO_PAQUETE;indice=1;
/*inicio letra*/letra[0]=letra[1]='a';
/*mientras no se pulse ESCAPE*/while (letra[0]!=ESC)
/*leo valor del teclado*/letra[0]=getch();letra[1]='\0';/* cada 100 caracteres escritos se envian automaticamente*/if (indice==100)outtextxy(500,maxy-25,"ENVIANDO");EscribirPaquete(&paquete);paquete[0]=INICIO_PAQUETE;indice=1;setcolor(1);outtextxy(500,maxy-25,"ENVIANDO");setcolor(WHITE);
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
/*segun lo que sea valor se hara una u otra cosa*/
switch( letra[0] ) /*si es F1 o F2 letra[0]=0 y el siguiente valor dice si es F1 o F2*/
case 0: letra[0]=getch();
/*si F1 (enviar paquete)*/ if (letra[0]==F1) outtextxy(500,maxy-25,"ENVIANDO"); if (indice>1) indice= EscribirPaquete(&paquete);
setcolor(1); outtextxy(500,maxy-25,"ENVIANDO"); setcolor(WHITE); /*si F2 (recibir paquete)*/ if (letra[0]==F2) /* envio el valor 130 para indicar que envie paquete*/ outtextxy(500,maxy-
25,"RECIBIENDO"); ser_WriteByte( iSerPort, 130, 0, 0,0 ); /*int si recepcion*/
outp(iSerPort+SER_IRQ_ENABLE,SER_IER_RECEIVED); /*mientras no empiece
el paquete espera*/ while (c[0]!=INICIO_PAQUETE); /*mientras no final de paquete*/while (c[0]!=FIN_PAQUETE) /*si se ha
recibido un caracter*/ if (entra==1) entra=0;
/*si no es inicio o final de paquete escribe el valor recibido*/
if((c[0]!=INICIO_PAQUETE)&&(c[0]!=FIN_PAQUETE)) PresentaRecepcion();
/*int despues de envio*/ outp( iSerPort+SER_IRQ_ENABLE,SER_IER_SENT ); setcolor(1);
outtextxy(500,maxy-25,"RECIBIENDO"); setcolor(WHITE);break; /*caso de ser salto de carro, ENTER*/ case ENTER:
/*lo pone dentro del paquete*/ paquete[indice++]=letra[0]; paquete[indice]=FIN_PAQUETE; /*coordenadas para presentacion en pantalla*/ yEmision+=12; xEmiAnterior=xEmision; xEmision=9; /*vector de saltos de carro*/ saltosEmi[salto++]=env; pantallaEmi[env++]=letra[0]; /*si final de pantalla*/ if (yEmision > (maxy-65)) BorrarVentana(9,maxy/2,&pantallaEmi); SubirLinea(9,maxy/2,&saltosEmi, &pantallaEmi,&salto,&env); yEmision-=12; break;
/*si se da a borrar no hace nada*/ case 8:break; /*si se da al tabulador no hace nada*/ case 9:
/*si es ESC no hace nada*/ case ESC:
break; /*si es nada de lo anterior*/ default:
/*incluimos el caracter en el paquete*/ paquete[indice++]=letra[0]; paquete[indice]=FIN_PAQUETE; /*se presenta por pantalla*/ xEmision+=8; if (xEmision<9) xEmision=18; if(SaltaLinea(&xEmision,&yEmision)) saltosEmi[salto++]=env; pantallaEmi[env++]=ENTER; if (yEmision > (maxy-65)) BorrarVentana(9,maxy/2,&pantallaEmi); SubirLinea(9,maxy/2,&saltosEmi,
&pantallaEmi,&salto,&env); yEmision-=12; pantallaEmi[env++]=letra[0]; outtextxy(xEmision,yEmision,&letra);
break;
restorecrtmode();closegraph();
/* Instal. controlad. antiguo */ ser_RestoreIRQHandler( iSerPort, iSerIRQ, lpOldIRQ ); if( iUART > INS8250 ) ser_FIFOLevel( iSerPort, 0 );
/* La función EscribirPaquete escribe en el puerto caracter acaracter todo el paquete. Como parámetro tiene:- pakete: vector que contiene los datos a emitir. */int EscribirPaquete(unsigned char *pakete)int k; /*escribe en el puerto caracter a caracter todo el paquete*/ for (k=0;*(pakete+k)!=FIN_PAQUETE;k++) ser_WriteByte( iSerPort,*(pakete+k), 0, 0, 0 ); /*escribe en el puerto el caracter de final de paquete*/ ser_WriteByte( iSerPort,FIN_PAQUETE, 0, 0, 0 ); return 1;
/* La función EscribirVector escribe en pantalla un vector desdeuna posición de inicio. Como parámetros tiene:- inicio: lugar del vector desde donde se empieza a escribir.- inix, iniy: coordenadas de pantalla donde se debe empezar aescribir.- vect: vector a escribir.*/void EscribirVector(int inicio,int inix,int iniy, char *vect) intj,x=inix,y=iniy; char V[2];V[1]='\0';for(j=inicio;*(vect+j)!=0;j++) V[0]= *(vect+j); switch( V[0] ) /*si es salto de linea se resituan las coordenadas*/ case ENTER: y+=12;
x=9; break;
/*si es ESC salimos */ case ESC:
break;
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
/*cualquier otro caracter se escribe en pantalla*/ default:x+=8;
SaltaLinea(&x,&y); outtextxy(x,y,&V); break;
/* La función BorrarVentana elimina todos los caracteres escritosen la pantalla de emisión.Como parámetro tiene:- inix, iniy: coordenadas de pantalla donde se debe empezar aescribir.- vector: vector que contiene los datos a borrar. */void BorrarVentana(int inix,int iniy, char *vector)int j; /*el color para escribir será el del fondo (azul)*/ setcolor(1); /*escribo el vector con los datos */ EscribirVector(0,inix,iniy,vector); /*restauro el color blanco para escribir*/ setcolor(WHITE);
/* La función MoverVectorInt desplaza hacia la izquierda loselementos de un vector de enteros, descontando el valor delprimero.Como parámetro tiene:- ini: posiciones que deben desplazarse los elementos.- v: vector que contiene los datos.-salt: número de elementos del vector.*/void MoverVectorInt(int ini,int *v,int *salt) int j,k,primerValor; /*guardo el primer valor del vector*/ primerValor=*(v); /*mientras hay elementos*/ for(k=0;*(v+k+1)!=0;k++) /*desplaza los elementos restando el valor del primero*/ *(v+k)=*(v+k+ini) -primerValor - 1; /*guardo el elemento en el que estoy*/ *salt=k; /*pongo el siguiente valor a cero*/ *(v+k+1)=0; /*incremento en uno el numero de elementos*/ *salt=*salt+1;
/* La función MoverVectorChar desplaza hacia la izquierda loselementos de un vector de caracteres.Como parámetro tiene:- inicio: posiciones que deben desplazarse los elementos.- vector: vector que contiene los datos.- en: número de elementos del vector.*/
void MoverVectorChar(int inicio,char *vector,int *en) int j,k; /*mientras haya elementos*/ for(k=0,j=inicio;*(vector+j)!=0;j++,k++) /*desplaza un elementos*/ *(vector+k)=*(vector+j); /*guarda el número de elementos*/ *en=k; /*incrementa el número de elementos en uno*/ *en=*en+1; /*rellena de ceros el vector*/ for(j=*en;j<1701;j++)
*(vector+j)=0;
/* La función SubirLinea hace que cuando se llegue al final de lapantalla se elimine la línea superior y se pueda escribir en la últimalínea. Como parámetro tiene:- inix, iniy: posición de la pantalla donde se debe escribir.- saltos: vector donde están almacenadas las posiciones con salto delinea.- pantalla: vector donde están almacenadas todo lo que se haescrito.- sal: lugar donde se almacenará el próximo salto.- e: lugar donde se almacenará el próximo elemento escrito.*/
void SubirLinea(int inix,int iniy,int *saltos,char *pantalla,int*sal,int *e)int PrimerSalto;int j;
setcolor(WHITE); /*guardar el primer salto de linea*/ PrimerSalto=*saltos+1; /*escribe el vector donde están todo lo escrito hasta ahora*/ EscribirVector(PrimerSalto,inix,iniy,pantalla); /*muevo el vector de saltos eliminando el primero*/ MoverVectorInt(1,saltos,sal); /*muevo el vector de lo escrito eliminando la primera l¡nea*/ MoverVectorChar(PrimerSalto,pantalla,e);
/* La función TodoCerosChar llena de ceros un vector decaracteres. Como parámetro tiene:- z: vector a llenar de ceros.*/
void TodoCerosChar(char *z)int a; for(a=0;a<1701;a++) *(z+a)=0;
/* La función TodoCerosInt llena de ceros un vector de enteros.Como parámetro tiene:- z: vector a llenar de ceros.*/
void TodoCerosInt(int *z)int a; for(a=0;a<1701;a++) *(z+a)=0;
/* La función SaltaLinea llena de ceros un vector de enteros. Comoparámetro tiene:- x,y: coordenadas donde se escribirá el siguiente caracter.*/
int SaltaLinea(int *x, int *y)
/*si está al final de la linea salta al principio de lasiguiente linea.*/ if (*x>(maxx-20))
*y+=12;*x=17;return (1);
else return(0);
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
/* La función PresentaRecepcion escribe en pantalla los datos querecibe por el puerto serie.*/
void PresentaRecepcion(void) int j; int num;
switch( c[0] )
case 0: break;
/*si el elemento es salto de linea*/ case ENTER:
/*paso a la siguiente linea*/ yRecepcion+=12; xRecepcion=9; xRecepcionAnterior=xRecepcion; /*incluye el elemento en el vector de saltos de linea de la recepcion*/ saltosRecepcion[saltoRecepcion++]=envRecepcion; /*incluye el elemento en el vector de elementos recibidos de la recepcion*/ pantallaRecepcion[envRecepcion++]=c[0]; /*si se llega al final de la pantalla de recepción*/ if (yRecepcion > (maxy/2-40)) /*se borra la ventana*/ BorrarVentana(9,24,&pantallaRecepcion); /*se sube toda la pantalla una linea*/ SubirLinea(9,24,&saltosRecepcion,&pantallaRecepcion
,&saltoRecepcion,&envRecepcion);
yRecepcion-=12;
break; default:
/*se avanza un lugar en la pantalla*/ xRecepcion+=8; if (xRecepcion<9) xRecepcion=18; /*si llegamos al final de linea*/ if(SaltaLinea(&xRecepcion,&yRecepcion)) /*inserta en el vector de saltos la posición en la que est */ saltosRecepcion[saltoRecepcion++]=envRecepcion; /*inserta en el vector de elementos un salto de linea*/ pantallaRecepcion[envRecepcion++]=ENTER; /*si se llega al final de la pantalla*/ if (yRecepcion > (maxy/2-40)) /*borra pantalla*/ BorrarVentana(9,24,&pantallaRecepcion); /*sube toda la pantalla una linea*/ SubirLinea(9,24,&saltosRecepcion, &pantallaRecepcion,&saltoRecepcion,
&envRecepcion); yRecepcion-=12; /*se inserta el elemento en el vector de elementorecibidos*/
pantallaRecepcion[envRecepcion++]=c[0]; /*escribeen pantalla el elemento*/
outtextxy(xRecepcion,yRecepcion,&c); break;
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
PROGRAMA SLAVE
/******************************************************* SLAVE.C ** ** Este programa chat se presenta en dos ventanas: una para la ** emisión y otra para la recepción. Así, todos los datos que se ** entran por teclado se van almacenando en una lista enlazada, ** mientras que los datos que se reciben van llegando. Así cuando ** llega la señal predeterminada (130) los datos de la lista se ** envían. Así este equipo será el esclavo*********************************************************/#include<string.h>#include<math.h>#include<stdlib.h>#include<dos.h>#include <ctype.h>#include <process.h>#include <stdio.h>#include <conio.h>#include <graphics.h>
#include "types.h"#include "serutil.h"#include "irqutil.h"#include "args.h"#include "win.h"
#include "args.c"#include "serutil.c"#include "irqutil.c"#include "win.c"
/* ------------ CONSTANTES--------------- */#define XO 100#define XF (XO+459)#define XI (XO+5)#define migy (maxy/2)#define LS ((((migy)-XI)/2)+XI)#define INICIO_PAQUETE 128#define FIN_PAQUETE 129#define ESC 27#define ENTER 13
# define LISTA struct listaLISTA unsigned char caracter; LISTA *lazo; ;
/*---- Variables globales --------------------*/
unsigned char c[102]; int envRecepcion=0; int saltoRecepcion=0; int env=0; int salto=0;INT iSerPort;INT iSerIRQ;int i=0,recibir=0,enviar=0;
int maxx,maxy, /*coordenadas máximas de la pantalla*/ xRecepcion, /*coordenada x de la recepción*/ xEmision, /*coordenada x de la emisión*/ yEmision, /*coordenada y de la emisión*/ yRecepcion, /*coordenada y de la recepción*/
xEmiAnterior, /*coordenada x del elemento emitido anteriormente*/xRecepcionAnterior; /*coordenada x del elemento recibido
anteriormente*/charpantallaRecepcion[1700]; /*vector para guardar los
elementos que se reciben*/int saltosRecepcion[1700];/*vector para guardar la posición donde se encuentran los saltos de linea*//*DEFINICIÓN DE FUNCIONES--------------------------------------------*/int EscribirPaquete(unsigned char *);void MoverVectorChar(int,char *,int *);void MoverVectorInt(int,int *,int *);void EscribirVector(int,int,int,char *);void PresentaRecepcion(unsigned char);int SaltaLinea(int *,int *);void TodoCerosChar(char *);void TodoCerosInt(int *);void BorrarVentana(int,int,char *);void SubirLinea(int,int,int *,char *,int *,int *);int insertar_lista(LISTA **, LISTA *);int EscribirPaqueteLista(LISTA **);
/*****************************************************//* GetSer : Rutina de interr., disparado por el puerto serie *//*****************************************************/
VOID __interrupt _FP GetSer( VOID ) static BYTE bIRQID;
bIRQID = ( BYTE )inp( iSerPort + SER_IRQ_ID ); if( ! ( bIRQID & SER_ID_PENDING ) ) /* IRQ eperando ? */ switch( bIRQID & SER_ID_MASK ) case SER_ID_RECEIVED: /* Después de recepción */
c[ i++ ] = ( BYTE )inp( iSerPort + SER_RXBUFFER ); if(c[i-1]==FIN_PAQUETE) recibir=1;/*si se ha acabado de recibir un paquete recibir=1*/
if(c[i-1]==130) enviar=1; /*indicación de que se debeenviar */ break; case SER_ID_SENT: /*Después de envío */ break; case SER_ID_MODEMSTATUS: /* Después de modif. de
estados de línea */break; irq_SendEOI( iSerIRQ ); /* End OfInterrupt*//*****************************************************//* P R O G R A M A P R I N C I P A L*//*****************************************************/
VOID main( INT argc, PCHAR argv[] ) unsigned charpaquete[102]; /*paquete de datos*/ int indice; charbaud[25]; static INT iCom; static LONG lBaud; VOID (_interrupt _FP *lpOldIRQ)(); INT iUART; char pantallaEmi[1700]; /*almacenamiento de todos los
elementos que hay en pantalla*/ int saltosEmi[1700]; /*almacenamiento de todos los saltos
de linea que hay en pantalla*/ unsigned char CharRecibido[2];
/* gráficos ---------------- */ int driver, modo, n, errorcode ; unsigned char letra[12]; unsigned char le;
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
int k; int je; LISTA *p,*tmprg;
p=NULL; /*Inicializo el primer elemento de la lista a NULL*/
TodoCerosChar(&pantallaEmi); /*inicialización del vector de elementos de la pantalla de emisión */
TodoCerosInt(&saltosEmi); /*inicialización del vector de saltos de linea de emisión*/
TodoCerosChar(&pantallaRecepcion); /*inicialización del vector de elementos de la pantalla de recepción */TodoCerosInt(&saltosRecepcion); /*inicialización del vector de saltos de linea de recepción*/if( FindString( argv, "?", argc ) ) printf("Sintaxis:\n" ); printf("SLAVE [-COM:comport] [-BAUD:baudrate]\n"); printf("comport = 1 ó 2 (Por defecto: 1)\n"); printf("baudrate = 50 - 115200 (Por defecto: 9600)\n"); exit(0);
if( GetArg( argc, argv, "-COM:", _int, &iCom, 1 ) ) if( iCom == 1 ) iSerPort = SER_COM1; /* Sólo COM1 y COM2 están
"estandarizados" */ iSerIRQ =SER_IRQ_COM1; else if( iCom == 2 ) iSerPort =SER_COM2; /* Sólo COM1 y COM2 están
"estandarizados" */ iSerIRQ =SER_IRQ_COM2; else printf("Puerto COM nosoportado\n"); exit(0); else iSerPort = SER_COM1;/* Sólo COM1 y COM2 están "estandarizados" */ iSerIRQ =SER_IRQ_COM1; if( !GetArg( argc, argv, "-BAUD:", _long,&lBaud, 1 ) ) lBaud = 9600L; /* Tasa máxima en UART8450A */ if( lBaud > SER_MAXBAUD ) printf("Baudratedemasiado alto\n"); printf("Máximo: %ld Bd\n", SER_MAXBAUD );
iUART = ser_Init( iSerPort, lBaud, SER_LCR_8BITS | SER_LCR_1STOPBIT |
SER_LCR_NOPARITY );
if( iUART == NOSER ) printf("No hay puerto\n"); exit( 0 );
if( iUART > INS8250 ) ser_FIFOLevel( iSerPort, SER_FIFO_TRIGGER14 );
/* instalar interrup. serie*/ lpOldIRQ = ser_SetIRQHandler( iSerPort, iSerIRQ, GetSer,
SER_IER_RECEIVED );
/* inicialización de la pantalla gráfica----------------------------------------- */driver=DETECT;modo=2;initgraph(&driver,&modo,"c:\\luis\\bc\\bgi");errorcode=graphresult();if (errorcode != grOk)
printf("Graphics error: %s\n" ,grapherrormsg(errorcode));
printf("Press any key to halt"); getch(); exit(1);/*dibujo de los rectángulos donde estarán los caracteres---------------------------------------------------------------- */
setcolor(WHITE);maxx =getmaxx();maxy =getmaxy();setlinestyle(SOLID_LINE, 1, 3);rectangle (0,0,maxx,maxy/2-25);rectangle (0,maxy/2-25,maxx,maxy-50);rectangle (0,maxy-50,maxx,maxy);
if (iCom==2) outtextxy(5,maxy-45,"PUERTO UTILIZADO: COM2");else outtextxy(5,maxy-45,"PUERTO UTILIZADO: COM1");
outtextxy(5,maxy-25,"BAUDRATE:");ltoa(lBaud,baud,10);outtextxy(85,maxy-25,&baud);outtextxy(140,maxy-25,"bps.");outtextxy(435,maxy-45,"ESC : SALIR DEL PROGRAMA");outtextxy(435,maxy-25,"ESTADO:");
outtextxy(5,5,"RECEPCION");rectangle (0,0,80,17);xRecepcion=9;yRecepcion=24;outtextxy(5,maxy/2-20,"EMISION");rectangle(0,maxy/2-25,65,maxy/2-8);xEmision=9;yEmision=maxy/2;setbkcolor(1);
CharRecibido[1]='\0';paquete[0]=INICIO_PAQUETE;
tmprg=(LISTA *)malloc (sizeof(LISTA));
if (!tmprg) puts("No memoria");letra[0]=ESC;
tmprg->caracter=INICIO_PAQUETE;insertar_lista(&p,tmprg);
indice=1;
letra[0]=letra[1]='a';/*mientras no se pulse ESC*/while (letra[0]!=ESC)/*mientras no se pulse una tecla*/
while (!(kbhit()))/*si se est recibiendo*/if (recibir)/*hasta que no sea final de paqueterecibo y presento en pantalla lo recibido*/ outtextxy(500,maxy-25,"RECIBIENDO"); for (k=1;c[k]!=FIN_PAQUETE;k++)
CharRecibido[0]=c[k]; PresentaRecepcion(CharRecibido[0]);
c[k]=0;
i=0;recibir=0;setcolor(1);outtextxy(500,maxy-25,"RECIBIENDO");setcolor(WHITE);
/*si se debe enviar*/if (enviar) /*se permite escribir en el puerto*/
outtextxy(500,maxy-25, "ENVIANDO");
tmprg = (LISTA *) malloc
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
(sizeof(LISTA));if (!tmprg)
puts("No memoria");letra[0]=ESC;
/*se inserta el caracter de final de paquete*/ tmprg->caracter= FIN_PAQUETE;
insertar_lista(&p,tmprg);/*se envia el paquete*/EscribirPaqueteLista(&p);
p=NULL; tmprg=(LISTA *)malloc (sizeof(LISTA));
if (!tmprg) puts("No memoria");
letra[0]=ESC; /*se inicializa el paquete siguiente a enviar*/tmprg->caracter=INICIO_PAQUETE;
insertar_lista(&p,tmprg); /*se habilita únicamente la recepción*/ enviar=0; for (k=0;k<103;k++) c[k]=0; i=0; setcolor(1); outtextxy(500,maxy-25,"ENVIANDO"); setcolor(WHITE);
/*lectura de la tecla pulsada*/letra[0]=getch();letra[1]='\0';
switch( letra[0] ) case 0:letra[0]=getch();
break; case ENTER: /*lo inserto en la lista de caracteres a enviar*/
tmprg=(LISTA *)malloc (sizeof(LISTA));if (!tmprg) puts("No memoria");letra[0]=ESC;tmprg->caracter=letra[0];insertar_lista(&p,tmprg);
/*salto a la siguiente linea*/ yEmision+=12; xEmiAnterior=xEmision; xEmision=9; saltosEmi[salto++]=env; pantallaEmi[env++]=letra[0]; if (yEmision > (maxy-65)) BorrarVentana(9,maxy/2,&pantallaEmi); SubirLinea(9,maxy/2,&saltosEmi, &pantallaEmi,&salto,&env);
yEmision-=12; break;
case 8: case 9: case ESC:
break; default: /*lo inserto en la lista de caracteres a enviar*/
tmprg=(LISTA *)malloc (sizeof(LISTA));if (!tmprg) puts("No memoria");letra[0]=ESC;tmprg->caracter=letra[0];insertar_lista(&p,tmprg);
/*escribo el caracter por pantalla*/
xEmision+=8; if (xEmision<9)xEmision=18;if(SaltaLinea(&xEmision,&yEmision)) saltosEmi[salto++]=env;pantallaEmi[env++]=ENTER;if (yEmision > (maxy-65))BorrarVentana(9,maxy/2,&pantallaEmi);SubirLinea(9,maxy/2,&saltosEmi,
&pantallaEmi,&salto,&env); yEmision-=12; pantallaEmi[env++]=letra[0];outtextxy(xEmision,yEmision,&letra);
break;
restorecrtmode();closegraph();
/* Instal. controlad. antiguo */ ser_RestoreIRQHandler( iSerPort, iSerIRQ, lpOldIRQ ); if( iUART > INS8250 ) ser_FIFOLevel( iSerPort, 0 );
/* La función EscribirPaquete escribe en el puerto serie todos loselementos de un vector. Como parámetro tiene:- pakete: vector que contiene los datos a enviar.*/
int EscribirPaquete(unsigned char *pakete)int k; for (k=0;*(pakete+k)!=FIN_PAQUETE;k++) ser_WriteByte( iSerPort,*(pakete+k), 0, 0, 0 );
return 1;
/* La función EscribirPaqueteLista escribe en el puerto serie todoslos elementos de una lista enlazada. Como parámetro tiene:- pakete: lista enlazada que contiene los datos a enviar.*/
int EscribirPaqueteLista(LISTA **pakete)LISTA *siguiente=*pakete,*aux=NULL;
while (siguiente!=NULL) ser_WriteByte( iSerPort,siguiente->caracter, 0, 0, 0 ); aux=siguiente->lazo; siguiente=aux; return 1;
/* La función EscribirVector escribe en pantalla un vector desdeuna posición de inicio. Como parámetros tiene:- inicio: lugar del vector desde donde se empieza a escribir.- inix, iniy: coordenadas de pantalla donde se debe empezar aescribir.- vect: vector a escribir.*/
void EscribirVector(int inicio,int inix,int iniy, char *vect)int j,x=inix,y=iniy; char V[2];
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
V[1]='\0';
for(j=inicio;*(vect+j)!=0;j++) V[0]= *(vect+j); switch( V[0] ) /*si es salto de linea se resituan las coordenadas*/ case ENTER: y+=12;
x=9; break;
/*si es ESC salimos */ case ESC:
break; /*cualquier otro caracter se escribe en pantalla*/ default:x+=8;
SaltaLinea(&x,&y); outtextxy(x,y,&V); break;
/* La función BorrarVentana elimina todos los caracteres escritosen la pantalla de emisión. Como parámetro tiene:- inix, iniy: coordenadas de pantalla donde se debe empezar aescribir.- vector: vector que contiene los datos a borrar.*/
void BorrarVentana(int inix,int iniy, char *vector)int j; /*el color para escribir ser el del fondo (azul)*/ setcolor(1); /*escribo el vector con los datos */ EscribirVector(0,inix,iniy,vector); /*restauro el color blanco para escribir*/ setcolor(WHITE);
/* La función MoverVectorInt desplaza hacia la izquierda loselementos de un vector de enteros, descontando el valor delprimero. Como parámetro tiene:- ini: posiciones que deben desplazarse los elementos.- v: vector que contiene los datos.-salt: número de elementos del vector.*/
void MoverVectorInt(int ini,int *v,int *salt) int j,k,primerValor;
/*guardo el primer valor del vector*/ primerValor=*(v); /*mientras hay elementos*/ for(k=0;*(v+k+1)!=0;k++) /*desplaza los elementos restando el valor del primero*/ *(v+k)=*(v+k+ini) -primerValor - 1; /*guardo el elemento en el que estoy*/ *salt=k; /*pongo el siguiente valor a cero*/ *(v+k+1)=0; /*incremento en uno el numero de elementos*/ *salt=*salt+1;
/* La función MoverVectorChar desplaza hacia la izquierda loselementos de un vector de caracteres. Como parámetro tiene:- inicio: posiciones que deben desplazarse los elementos.- vector: vector que contiene los datos.
- en: número de elementos del vector.*/
void MoverVectorChar(int inicio,char *vector,int *en) int j,k;
/*mientras haya elementos*/ for(k=0,j=inicio;*(vector+j)!=0;j++,k++) /*desplaza un elementos*/ *(vector+k)=*(vector+j); /*guarda el número de elementos*/ *en=k; /*incrementa el número de elementos en uno*/ *en=*en+1; /*rellena de ceros el vector*/ for(j=*en;j<1701;j++) *(vector+j)=0;
/* La función SubirLinea hace que cuando se llegue al final de lapantalla se elimine la línea superior y se pueda escribir en la últimalínea. Como parámetro tiene:- inix, iniy: posición de la pantalla donde se debe escribir.- saltos: vector donde están almacenadas las posiciones con salto delinea.- pantalla: vector donde están almacenadas todo lo que se haescrito.- sal: lugar donde se almacenar el próximo salto.- e: lugar donde se almacenar el próximo elemento escrito.*/
void SubirLinea(int inix,int iniy,int *saltos,char *pantalla,int*sal,int *e)int PrimerSalto;int j;
setcolor(WHITE); /*guardar el primer salto de linea*/ PrimerSalto=*saltos+1; /*escribe el vector donde est n todo lo escrito hasta ahora*/ EscribirVector(PrimerSalto,inix,iniy,pantalla); /*muevo el vector de saltos eliminando el primero*/ MoverVectorInt(1,saltos,sal); /*muevo el vector de lo escrito eliminando la primera línea*/ MoverVectorChar(PrimerSalto,pantalla,e);
/* La función TodoCerosChar llena de ceros un vector decaracteres. Como parámetro tiene:- z: vector a llenar de ceros.*/
void TodoCerosChar(char *z)int a;
for(a=0;a<1701;a++) *(z+a)=0;
/* La función TodoCerosInt llena de ceros un vector de enteros.Como parámetro tiene:- z: vector a llenar de ceros.*/
void TodoCerosInt(int *z)
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
int a; for(a=0;a<1701;a++) *(z+a)=0;
/* La función SaltaLinea llena de ceros un vector de enteros. Comoparámetro tiene:- x,y: coordenadas donde se escribir el siguiente caracter.*/
int SaltaLinea(int *x, int *y)
/*si est al final de la linea salta al principio de lasiguiente linea.*/
if (*x>(maxx-20))*y+=12;*x=17;return (1);
else return(0);
/* La función PresentaRecepcion escribe en pantalla los datos querecibe por el puerto serie. Como parámetro tiene:- a: carácter a escribir en pantalla.*/void PresentaRecepcion(unsigned char a) int j; int num; unsigned char car[2]; switch( a )
case 0: case 128: case 129: case 130:
break;
/*si el elemento es salto de linea*/ case ENTER:
/*paso a la siguiente linea*/ yRecepcion+=12; xRecepcion=9; xRecepcionAnterior=xRecepcion; /*incluye el elemento en el vector de saltos de linea de la recepcion*/ saltosRecepcion[saltoRecepcion++]=envRecepcion; /*incluye el elemento en el
vector de elementos recibidos de la recepcion*/ pantallaRecepcion[envRecepcion++]=a; /*si se llega al final de la pantalla de recepción*/ if (yRecepcion > (maxy/2-40)) /*se borra la ventana*/ BorrarVentana(9,24,&pantallaRecepcion); /*se sube toda la pantalla una linea*/ SubirLinea(9,24,&saltosRecepcion, &pantallaRecepcion,&saltoRecepcion,
&envRecepcion); yRecepcion-=12; break;/*para cualquier otro caso*/ default:
/*se avanza un lugar en la pantalla*/ xRecepcion+=8; if (xRecepcion<9) xRecepcion=18; /*si llegamos al final de linea*/ if(SaltaLinea(&xRecepcion,&yRecepcion)) /*inserta en el vector de saltos la posición en la que est */
saltosRecepcion[saltoRecepcion++]=envRecepcion; /*inserta en el vector de elementos un salto de linea*/ pantallaRecepcion[envRecepcion++]=ENTER; /*si se llega al final de la pantalla*/ if (yRecepcion > (maxy/2-40)) /*borra pantalla*/ BorrarVentana(9,24,&pantallaRecepcion); /*sube toda la pantalla una linea*/ SubirLinea(9,24,&saltosRecepcion, &pantallaRecepcion,&saltoRecepcion, &envRecepcion); yRecepcion-=12; /*se inserta el elemento en el vector de elemento
recibidos*/ pantallaRecepcion[envRecepcion++]=a; car[0]=a; car[1]='\0'; /*escribe
en pantalla el elemento*/outtextxy(xRecepcion,yRecepcion,&car);
break;
/*Esta función crea un elemento de la lista*/LISTA *crea_registro(LISTA *elemento)LISTA*registro;registro=(LISTA *) malloc(sizeof(LISTA));if (registro==NULL) return NULL;*registro=*elemento;return registro;
/*A esta función le pasamos como par metros un puntero que señalala primera estructura de la lista (la variable p por referencia) y unpuntero que apunta al registro que queremos insertar (la variableelemento)*/
int insertar_lista(LISTA **p, LISTA *elemento)LISTA*en_curso=*p; /*la variable en_curso toma el valor del
puntero que se¤ala la primera estructura de lalista*/LISTA *anterior=NULL;LISTA *nuevo;/*mientras no llegueal final de la lista*/while (en_curso!=NULL ) anterior=en_curso; /*guardo la dirección del elemento de la
lista en el que me encuentro*/ en_curso=en_curso->lazo; /*avanzo un registro dentro de la
lista*/nuevo=crea_registro(elemento); /*creo lavariable nuevo y copio en ella el elemento que quiero insertar*/if (nuevo==NULL)return 0;nuevo->lazo=en_curso; /*El campo lazo del elementonuevo apuntar al elemento que ir detr s de ‚l en la lista*/if(anterior==NULL) /*si el elemento a insertar es el primero de
la lista*/ *p=nuevo; /*el puntero queapunta al primer elemento ser
el nuevo elemento*/else /*si elelemento a insertar no es el primero de la lista*/ anterior->lazo=nuevo; /*El campo lazo del elemento anterior apuntar al elemento que nuevo insertado en lalista*/return 1;
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
Además de estos dos programas principales se han utilizado algunas funciones de los siguientesarchivos extraidos del libro PC INTERNO de Michael Tischer y Bruno Jennrich:
/*****************************************************//* A R G S . C *//**----------------------------------------------------------------------------**//* Tarea : Funciones para procesar par metros de la línea *//* de comandos *//**----------------------------------------------------------------------------**//* Autor : Michael Tischer / Bruno Jennrich *//* desarrollado el: 20.03.1994 *//* último Update : 25.01.1995 *//*****************************************************/#ifndef __ARGS_C#define __ARGS_C
/*- Insertar archivos include ----------------------------------------*/#include <string.h>#include <stdlib.h>#include "types.h"#include "args.h"
/*****************************************************//* GetArg : obtener par metros de la línea de comandos *//**----------------------------------------------------------------------------*//* Entrada : *//* argc - Argument Count (s. main(INT argc, CHAR *argv[]))*//* argv - Argument Values (s. main(INT argc, CHAR *argv[]))*//* pPrefix - Parameter Prefix (p.e: "-o" para output)*//* iType - Tipo par metro (_char, _int, _long, _string, *//* _none = comprueba si el par metro existe) *//* pVar - Dirección de la variable que ha de recibir *//* el valor de la línea de comandos. *//* iNumElements - Si varias palabras est n separadas por *//* comas, se guardan en el array pVar *//* hasta iNumElements. *//* *//* Salida : Número de valores obtenidos, ó 0 si no *//* hay par metros*//* en la línea de comandos.*//*****************************************************/INT GetArg( INT argc, PCHAR argv[], PCHAR pPrefix, INT iType,
PVOID pVar, INT iNumElements ) INT i, j; INT iLen;
PCHAR cPtr; PINT iPtr; PLONG Ptr; PCHAR *sPtr;
iLen = _fstrlen( pPrefix );
for( i = 1; i < argc; i++ ) if( _fstrnicmp( pPrefix, ( LPCHAR )argv[ i ], iLen ) == 0 ) switch( iType ) case _int: iPtr = (PINT)pVar; for( j = 0; ( j < iNumElements ) && argv[ i ][ iLen ]; j++ ) *iPtr = atoi( ( PCHAR )&argv[ i ][ iLen ] ); while( argv[ i ][ iLen ] && ( argv[ i ][ iLen ] != ',' ) ) iLen++; if( argv[ i ][ iLen ] == ',' ) iLen++; iPtr++; return j;
case _char: cPtr = (PCHAR)pVar; for( j = 0; ( j < iNumElements ) && argv[ i ][ iLen ]; j++ ) *cPtr = argv[ i ][ iLen ]; while( argv[ i ][ iLen ] && ( argv[ i ][ iLen ] != ',' ) ) iLen++; if( argv[ i ][ iLen ] == ',' ) iLen++; cPtr++; return j;
case _long: Ptr = (PLONG)pVar; for( j = 0; ( j < iNumElements ) && argv[ i ][ iLen ]; j++ ) *Ptr = atol( ( PCHAR )&argv[ i ][ iLen ] ); while( argv[ i ][ iLen ] && ( argv[ i ][ iLen ] != ',' ) ) iLen++; if( argv[ i ][ iLen ] == ',' ) iLen++; Ptr++; return j;
case _string: sPtr = ( PCHAR *)pVar; for( j = 0; ( j < iNumElements ) && argv[ i ][ iLen ]; j++ ) *sPtr = &argv[ i ][ iLen ]; while( argv[ i ][ iLen ] && ( argv[ i ][ iLen ] != ',' ) ) iLen++; if( argv[ i ][ iLen ] == ',' ) argv[ i ][ iLen++ ] = '\0'; sPtr++; return j;
case _none: return TRUE; return FALSE;
/*****************************************************//* GetNArg : Obtener línea de par metros sin prefijo *//**----------------------------------------------------------------------------*//* Entrada : *//* argc - Argument Count (s. main(INT argc, CHAR *argv[]))*//* argv - Argument-Values (s. main(INT argc, CHAR *argv[]))*//* pPrefix - Parameter Prefix (p.e: "-o" para Output), que*//* NO puede estar contenido en los par metros*//* encontrados. *//* pString - Dirección del array de punteros de cadenas *//* que guarda los par metros. *//* iNumElements - Si hay varios par metros en la línea de *//* comandos, sólo se guarder n el número *//* de par metros de iNumElements. *//* Salida : Nº de los parámetros obtenidos, o 0 si no existe *//* en la línea de comandos. *//*****************************************************/INT GetNArg( INT argc, PCHAR argv[], PCHAR pPrefix, PCHAR *pString, INT iNumElements ) INT i, j; INT iLen;
iLen = _fstrlen( pPrefix );
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
for( i = 1, j = 0; ( i < argc ) && ( j < iNumElements ); i++ ) if( _fstrnicmp( pPrefix, ( PCHAR )argv[ i ], iLen ) != 0 ) pString[ j++ ] = argv[ i ];
return j;
/*****************************************************//* FindString : Busca cadena en un array de cadenas y devuelve *//*la posición de la cadena encontrada en el array. *//**--------------------------------------------------------------------------**//* Entrada : pArray - Array de cadenas a registrar *//* pFind - cadena a buscar *//* iNum - Nº de cadenas en el array *//* Salida : *//* Posición + 1 de la cadena buscada, o 0 si la cadena de *//*búsqueda no existe en el array.*//*****************************************************/INT FindString( PCHAR pArray[], PCHAR pFind, INT iNum ) INT i; for( i = 0; i < iNum; i++ ) if( _fstricmp( pArray[ i ], pFind ) == 0 ) return i + 1; return 0;
/*****************************************************//* htoi : Convierte una cadena hex en valor num‚rico *//**--------------------------------------------------------------------------**//* Entrada : pStr - Dirección de la cadena a convertir *//* iDef - Valor predeterminado *//* Salida : Valor de la cadena o 'iDef' si la cadena pasada no *//* representa un valor Hex correcto. *//*****************************************************/INT htoi( PCHAR pStr, INT iDef ) INT iNumChars = 0; INT iVal = 0;
if( pStr ) while( *pStr == ' ' ) pStr ++; /* Omitir espacios */ for(;;) switch( *pStr ) case '0': case '1': case '2': /* Convertir decimales */ case '3': case '4': case '5': case '6': case '7': case '8': case '9': iVal *= 0x10; /* Desplazar valor una posición izquier.*/ iVal += *(pStr++) - '0'; /* Añadir una 'unidad' */
iNumChars++; /* Incrementar nº de caracteres conv. */ break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': iVal *= 0x10; /* Desplazar valor una posición izquier.*/ iVal += *(pStr++) - 'a' + 10; /* Añadir una 'unidad' */ iNumChars++; /* Incrementar nº de caracteres conv. */ break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': iVal *= 0x10; /* Desplazar valor una posición izquier.*/ iVal += *(pStr++) - 'A' + 10; /* Añadir una 'unidad' */ iNumChars++; /* Incrementar nº de caracteres conv. */ break; default: return ( iNumChars != 0 ) ? iVal : iDef; return iDef;
/*****************************************************//* strichr : Busca la primera aparición de una cadena parcial *//* sin distinguir may/min. *//**------------------------------------------------------------------**//* Entrada : pStr - Dirección de la cadena a registrar *//* pSearch - Cadena parcial a buscar *//* Salida : Dirección del car cter que sigue la primera *//* aparición de la cadena parcial. .*//*****************************************************/PCHAR strichr( PCHAR pStr, PCHAR pSearch ) if( pStr &&pSearch ) INT iLen; /* Longitud de la cadena*/
iLen = _fstrlen( pSearch ); /* Funciones de cadenas ind. modelo*/ while( *pStr ) /*cadena a registrar, ¨aún no vacía? */ if( _fstrnicmp( pStr, pSearch, iLen ) == 0 ) /*- Pasar dirección del carácter posterior a la cadena encon.*/ pStr += iLen; if( *pStr ) return pStr; else pStr++; return NULL; /* No se encuentra cadena */
#endif
/*****************************************************//* I R Q U T I L . C *//**------------------------------------------------------------------**//* Tarea : Pone a disposición funciones para la pro- *//* gramación de interrupciones de hardware *//**------------------------------------------------------------------**//* Autor : Michael Tischer / Bruno Jennrich *//* desarrollado el: 12.03.1994 *//* último update : 23.01.1995 *//*****************************************************/#ifndef __IRQUTIL_C /* También se puede #Incluir */
#define __IRQUTIL_C
/* - Incluir archivos INCLUDE ----------------------------------------*/#include <dos.h>#include <conio.h>
#include "irqutil.h"
/*****************************************************//* irq_Enable : Permitir interrupciones de hardware *//**------------------------------------------------------------------**//* Entrada : iIRQ - Número de la interrupción hardware (0-15) */
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
/* que se debe permitir *//**------------------------------------------------------------------**//* Info : La activación y desactivación de IRQ's se realiza *//* mediante el paso de un byte llamado OCW1 (Operation *//* Control Word) al puerto base del controlador IRQ.*//*****************************************************/VOID irq_Enable( INT iIRQ ) INT iPort; /*Obtener dirección de port del PICcorrespondiente*/ /* ( 0-7 = MASTER_PIC , 8-15 = SLAVE_PIC ) */ iPort = ( iIRQ <= 7 ) ? MASTER_PIC : SLAVE_PIC ; iPort += IRQ_MASK; /* Selecc. port deenmascarado*/
iIRQ &= 0x0007; /* Obtener n§ de interr. de PIC (0-7)*/ /* Borrar bit -> permitir interrupción */ outp( iPort, inp( iPort ) & ~( 1 << iIRQ ) );
/*****************************************************//* irq_Disable : Prohibir interrupción de hardware *//**------------------------------------------------------------------**//* Entrada : iIRQ - Número de la interrupción de *//* hardware (0-15) que se quiere prohibir*//****************************************************/VOID irq_Disable( INT iIRQ ) INT iPort; /*Obtener direcciónde port del PIC correspondiente*/ /* ( 0-7 = MASTER_PIC , 8-15 = SLAVE_PIC ) */ iPort = ( iIRQ <= 7 ) ? MASTER_PIC : SLAVE_PIC ; iPort += IRQ_MASK; /* Selecc. port de enmascarado*/
iIRQ &= 0x0007; /* Obtener n§ de interr. de PIC (0-7)*/ /* Activar bit -> interr. bloqueda */ outp( iPort, inp( iPort ) | ( 1 << iIRQ ) );
/*****************************************************//* irq_SendEOI : "End Of Interrupt" señalizado *//**------------------------------------------------------------------**//* Entrada : iIRQ : Número de la interrupción de *//* hardware (0-15) que ha sido procesado completamente*//* Info: - Las interrupciones sólo se puede disparar de nuevo,*//* si se ha procesado completamente el disparo anterior.*//* Para se¤alizarle a los PIC's que el controlador de inte- *//* rrupciones ha terminado todas las tareas, se ha de enviar*//* un EOI a los mismos. *//* EOI - sin número de IRQ, ya que en Nested-Mode *//*****************************************************/VOID irq_SendEOI( INT iIRQ ) /* En caso de IRQ 8-15 comunicar con Slave */ if ( iIRQ > 7 ) outp( SLAVE_PIC, EOI ); outp( MASTER_PIC, EOI ); /* Al master siempre señalizarle EOI*//*****************************************************//* irq_SetHandler : Instalar nuevo controlador de interrupciones*//**------------------------------------------------------------------**//* Entrada : iIRQ - Número de interrupción que recibir nuevo*//* controlador. *//* lpHandler - Dirección del nuevo controlador *//* Salida : Dirección del antiguo controlador *//****************************************************/
VOID ( _interrupt _FP *irq_SetHandler( INT iIRQ, VOID (_interrupt _FP *lpHandler)() ) ) () VOID (_interrupt _FP *lpOldHandler)(); INT iVect; /* Obtener vector de interr. del la interr. de hardw.*/ /* IRQ 0 - 7 = Vectores 0x08 - 0x0F */ /* IRQ 8 - 15 = Vectores 0x70 - 0x77 */ iVect = ( iIRQ <= 7 ) ? ( MASTER_FIRST_VECTOR + iIRQ ) : ( SLAVE_FIRST_VECTOR + ( iIRQ & 0x0007 ) );
irq_Disable( iIRQ ); /* Bloquear interr. hardware y software */ _disable();
lpOldHandler = _dos_getvect( iVect ); /* Rescatar control. antiguo */ _dos_setvect( iVect, lpHandler ); /* Fijar nuevo control. */
_enable(); /* Permitir interr. de software */ if( lpHandler ) /* Si se pasó un controlador, permitir de nuevo*/ irq_Enable( iIRQ ); /*las interr. correspondientes de hardware*/
return lpOldHandler; /* Devolver direcc. del control. antiguo*/
/*****************************************************//* irq_ReadMask : Leer m scaras de un controlador IRQ *//**------------------------------------------------------------------**//* Entrada : iController - Puerto base del controlador IRQ(0x20/0xA0)*//* Salida : Máscara de los IRQ's servidos por el controlador*//* bits activados : IRQ no se dispara. *//**------------------------------------------------------------------**//* Info : Las máscaras de un PIC también se pueden averiguar *//* mediante una lectura del registro de m scaras. (0x21/0xA1)*//*****************************************************/BYTE irq_ReadMask( INT iController ) return ( BYTE )inp( iController + IRQ_MASK );
/*****************************************************//* irq_ReadISR : Leer registro de estado de un control de IRQ*//**------------------------------------------------------------------**//* Entrada : iController - Puerto base del controlador *//* IRQ (0x20/0xA0) *//*Salida : Reg's estado de las IRQ's servidas por *//* el IRQ-Controller *//* Bits activados: la rutinaIRQ correspondiente se ejecuta *//* inmediatamente o esinterrumpida mediante una IRQ de *//* mayor prioridad.*//**------------------------------------------------------------------**//*Info : Antes de que el control. IRQ lea el contenido del reg. ISR*//* se ha de pasar el byte apuntado en OCW3 al *//* controlador. *//*****************************************************/BYTE irq_ReadISR( INT iController ) /* OCW3: 0x0B = Sin operación, sin poll, leer ISR */ outp( iController, 0x0B ); return ( BYTE )inp( iController );
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
/*****************************************************//* irq_ReadIRR : Leer Requestregister de un controlador IRQ*//**------------------------------------------------------------------**//* Entrada : iController - Puerto base del controlador *//* IRQ (0x20/0xA0)*//* Salida : Registrosrequest de los IRQ's servidor por el control. *//* Bits activos: la rutina IRQ correspondiente se ha de *//* ejecutar a continuación, siempre que no haya ninguna*//* petición de mayor prioridad. *//**------------------------------------------------------------------**/
/* Info : Antes de que el control. IRQ lea el contenido del *//*reg. ISR se ha de pasar el byte apuntado en OCW3 al *//* controlador. *//*****************************************************/BYTE irq_ReadIRR( INT iController ) /* OCW3: 0x0B = Ninguna operación, sin Poll, leer IRR*/ outp( iController, 0x0A ); return ( BYTE )inp( iController );
#endif
/*****************************************************//* S E R U T I L . C *//**------------------------------------------------------------------**//* Tarea : Funciones para el acceso directo al puerto *//* serie *//**------------------------------------------------------------------**//* Autor : Michael Tischer / Bruno Jennrich *//* desarrollado el: 08.04.1994 *//* último update : 18.01.1995 *//*****************************************************/#ifndef __SERUTIL_C /* También se puede #incluir */#define __SERUTIL_C
#include <conio.h>#include "serutil.h"#include "irqutil.h"#include "win.h"
/*****************************************************//* ser_UARTType : Obtener tipo del chip UART *//**------------------------------------------------------------------**//* Entrada : iSerPort - Port base del puerto a comprobar*//* Salida : 0 (NOSER) - No se encontró chip UART *//* 1 (INS8250) - INS8250 o INS8250-B Chip *//* 2 (NS16450) - INS8250A, INS82C50A, *//* NS16450, NS16C450 *//*3 (NS16550A) - NS16550A Chip *//* 4 (NS16C552) - NS16C552 Chip *//*****************************************************/INT ser_UARTType( INT iSerPort ) /*- Comprobar funcionalidad básica--------------------------------- */
outp( iSerPort + SER_LINE_CONTROL, 0xAA ); /* Divisor-Latch activo */ if(inp( iSerPort + SER_LINE_CONTROL ) != 0xAA ) return NOSER;outp( iSerPort + SER_DIVISOR_MSB, 0x55 ); /* Describir Divisor */ if(inp( iSerPort + SER_DIVISOR_MSB ) != 0x55 ) return NOSER;outp( iSerPort + SER_LINE_CONTROL, 0x55 ); /* Divisor-Latch, borrar */ if( inp( iSerPort + SER_LINE_CONTROL ) != 0x55 ) returnNOSER;
outp( iSerPort + SER_IRQ_ENABLE, 0x55 ); if( inp( iSerPort + SER_IRQ_ENABLE ) != 0x05 ) return NOSER;
outp( iSerPort + SER_FIFO, 0 ); /* Borrar FIFO e IRQ */ outp( iSerPort + SER_IRQ_ENABLE, 0 ); if( inp( iSerPort + SER_IRQ_ID ) != 1 ) return NOSER;
outp( iSerPort + SER_MODEM_CONTROL, 0xF5 ); if( inp( iSerPort + SER_MODEM_CONTROL ) != 0x15 ) returnNOSER;
outp( iSerPort + SER_MODEM_CONTROL, SER_MCR_LOOP); /* Looping */ inp( iSerPort + SER_MODEM_STATUS ); if( ( inp( iSerPort + SER_MODEM_STATUS ) & 0xF0 ) != 0 )return NOSER;
outp( iSerPort + SER_MODEM_CONTROL, 0x1F ); if( ( inp( iSerPort + SER_MODEM_STATUS ) & 0xF0 ) != 0xF0 ) return NOSER;
outp( iSerPort + SER_MODEM_CONTROL, SER_MCR_DTR |SER_MCR_RTS );
outp( iSerPort + SER_SCRATCH, 0x55 ); /* Scratch-Register presente?*/ if( inp( iSerPort + SER_SCRATCH ) != 0x55 ) return INS8250; outp( iSerPort + SER_SCRATCH, 0 );
outp( iSerPort + SER_FIFO, 0xCF ); /* FIFO presente?*/ if( ( inp( iSerPort + SER_IRQ_ID ) & 0xC0 ) != 0xC0 ) returnNS16450; outp( iSerPort + SER_FIFO, 0 ); /* Alternate-Function Register presente? */ outp( iSerPort + SER_LINE_CONTROL,SER_LCR_SETDIVISOR ); outp( iSerPort + SER_2FUNCTION, 0x07 ); if( inp( iSerPort + SER_2FUNCTION ) != 0x07 ) outp( iSerPort + SER_LINE_CONTROL, 0 ); return NS16550A; outp( iSerPort + SER_LINE_CONTROL, 0 ); /* Reponer*/ outp( iSerPort + SER_2FUNCTION, 0 ); return NS16C552;
/*****************************************************//* ser_Init : inicializar puerto serie *//**------------------------------------------------------------------**//* Entrada : iSerPort - Port base del puerto que se ha de *//* inicializar. *//* lBaud - Baudrate ( de 1 - 115200 ) *//* bParams - Máscara de bits de los demás parámetros*//* (s. SER_LCR_...-Bits) *//* Salida : TRUE - Puerto se pudo inicializar *//* FALSE - no se encontró puerto */
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
/*****************************************************/INT ser_Init( INT iSerPort, LONG lBaudRate, BYTE bParams ) WORD uDivisor; if( ser_UARTType( iSerPort ) != NOSER ) /* Calcular divisor de baudios*/ uDivisor = ( WORD )( SER_MAXBAUD / lBaudRate ); outp( iSerPort + SER_LINE_CONTROL, /* Permitir acceso Divisor */inp( SER_LINE_CONTROL ) | SER_LCR_SETDIVISOR );/* Fijar divisor de baudios*/ outp( iSerPort + SER_DIVISOR_LSB, LOBYTE( uDivisor ) ); outp( iSerPort + SER_DIVISOR_MSB, HIBYTE( uDivisor ) ); /* Impedir acceso Divisor */ outp( iSerPort + SER_LINE_CONTROL, inp( SER_LINE_CONTROL ) & ~SER_LCR_SETDIVISOR);
/* Otros par metros después de reponer el latch de baudios, * //* ya que con esta operación se borran todos los parámetros *//*del puerto! */
/* Fijar parámetros de transmisión, excepto baudio */outp( iSerPort + SER_LINE_CONTROL, bParams ); /* Leerun byte, para reponer posibles errores */ inp( iSerPort +SER_TXBUFFER ); return TRUE; return FALSE;
/*****************************************************//* ser_FIFOLevel : Fijar tamaño del buffer FIFO *//**------------------------------------------------------------------**//* Entrada : 0 - Tam. buffer FIFO = 0, Disable y Reset (1Byte)*//* SER_FIFO_TRIGGER4/8/14 - Tamaño = 4, 8 o 14 Bytes*//*****************************************************/VOID ser_FIFOLevel( INT iSerPort, BYTE bLevel ) if( bLevel ) outp( iSerPort + SER_FIFO, bLevel |SER_FIFO_ENABLE ); else outp( iSerPort + SER_FIFO,SER_FIFO_RESETRECEIVE | SER_FIFO_RESETTRANSMIT );
/*****************************************************//* ser_IsDataAvaiable : ¨Hay datos para leer? *//**------------------------------------------------------------------**//* Entrada : iSerPort - Port base del puerto a comprobar.*//* Salida : == 0 : No hay bytes para leer *//* != 0 : Byte est listo *//**------------------------------------------------------------------**//* Info : Un byte se envía bit por bit, y con ello sólo volver *//* a ser un byte completo, si el puerto receptor ha vuelto *//* a componer los bits individuales. Esto es lo que la *//* función comprueba. *//*****************************************************/INT ser_IsDataAvaiable( INT iSerPort ) return inp( iSerPort + SER_LINE_STATUS ) &SER_LSR_DATARECEIVED;
/*****************************************************/
/*ser_IsWritingPossible : ¨Puede enviar el port el siguiente byte?*//**------------------------------------------------------------------**//* Entrada : iSerPort - Port base del puerto a comprobar.*//* Salida : == 0 : Byte no se puede enviar. *//* != 0 : Puerto está listo para enviar. *//**------------------------------------------------------------------**//*Info : Un puerto serie no se debería emplear en los siguientes*//* casos para enviar un byte: *//* 1. Un byte recibido aún no ha sido "recogido" por el *//* puerto. *//* 2. Una petición de envío antigua aún no ha finalizado. *//*****************************************************/INT ser_IsWritingPossible( INT iSerPort ) return ( inp( iSerPort + SER_LINE_STATUS ) &SER_LSR_TSREMPTY );
/*****************************************************//*ser_IsModemStatusSet : Comprobar estado de la líneas *//*de entrada *//**------------------------------------------------------------------**//* Entrada :iSerPort - Port base del puerto. *//* bTestStatus - Patrón de bits de las líneas a comprobar *//* (CTS, DSR, RI, CD) *//*****************************************************/INT ser_IsModemStatusSet( INT iSerPort, BYTE bTestStatus ) return ( ( BYTE )inp( iSerPort + SER_MODEM_STATUS ) & bTestStatus ) ==bTestStatus;/*****************************************************//* ser_SetModemControl : Líneas de señal paracomunicación *//*con Modem*//* etc, activadas *//**------------------------------------------------------------------**//* Entrada : iSerPort - Port base del puerto. *//* bNewControl - Nuevo estado de las líneas DTR, RTS, etc.*//*****************************************************/VOID ser_SetModemControl( INT iSerPort, BYTE bNewControl ) outp( iSerPort + SER_MODEM_CONTROL, bNewControl );
/*****************************************************//* ser_WriteByte : Enviar un byte *//**------------------------------------------------------------------**//* Entrada : iSerPort - Port base del puerto, por el cual se quiere*//* enviar un byte. *//* bData - byte a enviar *//* uTimeOut - Número de ejecuciones de bucle después de los*//* cuales se notifica un error de TimeOut en caso*//* de fallo de transmisión (Si TimeOut = 0, se *//* espera "para siempre".) *//* bSigMask - M scara de bits de las líneas a comprobar*//* (RTS, CTS, CD, RI) *//* bSigVals - Estado de las líneas de señal después de en- *//* masrcararlas con la máscara anterior. *//* Salida : == 0 - Byte se envió *//* != 0 - Error */
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
/*****************************************************/INT ser_WriteByte( INT iSerPort, BYTE bData, UINT uTimeOut, BYTE bSigMask, BYTE bSigVals ) if( uTimeOut ) /* Bucle TimeOut */ while( !ser_IsWritingPossible( iSerPort ) && uTimeOut )uTimeOut--; if( !uTimeOut ) return SER_ERRTIMEOUT; else while( !ser_IsWritingPossible( iSerPort ) ); /* Esperar!*/
/* Probar líneas de señal */ if( ( ( BYTE ) inp( iSerPort + SER_MODEM_STATUS ) &bSigMask ) == bSigVals ) /* Pasar byte al puerto para enviar */ outp( iSerPort + SER_TXBUFFER, bData ); /* Devolver error del puerto */ return inp( iSerPort + SER_LINE_STATUS ) &SER_LSR_ERRORMSK; else return SER_ERRSIGNALS;
/*****************************************************//* ser_ReadByte : Byte recibido *//**------------------------------------------------------------------**//* Entrada : iSerPort - Port base del puerto, por el cual se *//*quiere recibir un byte. *//* pData -Direcc. del byte que ha de acoger al byte *//*recibido. *//* uTimeOut - Número de ejecuciones de bucle después de los*//* Misserfolg des Empfangens ein TimeOut-Fehler *//* de fallo de transmisión (Si TimeOut = 0, se *//* espera "para siempre".) *//* bSigMask - Máscara de bits de las líneas a comprobar*//* (RTS, CTS, CD, RI) *//* bSigVals - Estado de las líneas de señal después de en- *//* mascararlas con la máscara anterior. *//* Salida : == 0 - Byte se envió *//* != 0 - Error *//*****************************************************/INT ser_ReadByte( INT iSerPort, PBYTE pData, UINT uTimeOut, BYTE bSigMask, BYTE bSigVals ) if( uTimeOut ) /* Bucle TimeOut */ while( !ser_IsDataAvaiable( iSerPort ) && uTimeOut )uTimeOut--; if( !uTimeOut ) return SER_ERRTIMEOUT; else while( !ser_IsDataAvaiable( iSerPort ) ); /* Esperar!*/
/* Probar líneas de señal */ if( ( ( BYTE ) inp( iSerPort + SER_MODEM_STATUS ) &bSigMask ) == bSigVals ) /* Leer byte recibido del puerto */ *pData = ( BYTE )inp( iSerPort + SER_RXBUFFER ); return inp( iSerPort + SER_LINE_STATUS ) &SER_LSR_ERRORMSK; else return SER_ERRSIGNALS;
/*****************************************************//* ser_WritePaket : Enviar paquete de datos *//**------------------------------------------------------------------**//* Entrada : iSerPort - Port base del puerto por el que se */
/*han de enviar datos. *//* pData -Direcc. de los datos a enviar *//* iLen - >= 0 :Nº de bytes a enviar. *//* < 0 : Tamaño buffer = strlen( pData ) *//* uTimeOut - Número de ejecuciones de bucle después de los*//* cuales se notifica un error de TimeOut en caso*//* de fallo de transmisión (Si TimeOut = 0, se *//* espera "para siempre".) *//* bSigMask - Máscara de bits de las líneas a comprobar*//* (RTS, CTS, CD, RI) *//* bSigVals - Estado de las líneas de señal después de en- *//* masrcararlas con la máscara anterior. *//* Salida : == 0 - Byte se envió *//* != 0 - Error *//*****************************************************/INT ser_WritePaket( INT iSerPort, PBYTE pData, INT iLen, UINT uTimeOut, BYTE bSigMask, BYTE bSigVals ) INT i, e; if( iLen < 0 ) iLen = 0; while( pData[ iLen ] ) iLen++; for( i = 0; i < iLen; i++ ) if( ( e = ser_WriteByte( iSerPort, pData[ i ], uTimeOut, bSigMask, bSigVals ) ) != 0 ) return e; return SER_SUCCESS;
/*****************************************************//* ser_ReadPaket : Recibido paquete de datos *//**------------------------------------------------------------------**//*Entrada : iSerPort - Port base del puerto por el que se han*//* de recibir los datos. *//* pData - Direcc. de los datos a enviar *//* iLen - Tamaño del buffer de recepción *//* uTimeOut - Número de ejecuciones de bucle después de los*//* cuales se notifica un error de TimeOut en caso*//* de fallo de transmisión (Si TimeOut = 0, se *//* espera "para siempre".) *//* bSigMask - Máscara de bits de las líneas a comprobar*//* (RTS, CTS, CD, RI) *//* bSigVals - Estado de las líneas de señal después de en- *//* masrcararlas con la máscara anterior. *//* Salida : == 0 - Byte se envió *//* != 0 - Error *//*****************************************************/INT ser_ReadPaket( INT iSerPort, PBYTE pData, INT iLen, UINT uTimeOut, BYTE bSigMask, BYTE bSigVals ) INT i, e; for( i = 0; i < iLen; i++ ) if( ( e = ser_ReadByte( iSerPort, &pData[ i ], uTimeOut, bSigMask, bSigVals ) ) != 0 ) return e; return SER_SUCCESS;
/*****************************************************//* ser_CLRIRQ : Evitar mensajes de interrupciones serie*//* al controlador IRQ. *//**------------------------------------------------------------------**//* Entrada : iSerPort -Port base del puerto que no debe */
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
/* enviar más IRQ's al controlador IRQ.*//*****************************************************/VOID ser_CLRIRQ( INT iSerPort ) outp( iSerPort +SER_MODEM_CONTROL, inp( iSerPort +SER_MODEM_CONTROL ) & ~SER_MCR_IRQENABLED );
/*****************************************************//* ser_SETIRQ : Permitir mensajes de interrupción serie al *//* controlador IRQ. *//**------------------------------------------------------------------**//* Entrada : iSerPort - Port base del puerto que ha de enviar *//* IRQ's al controlador IRQ. *//*****************************************************/VOID ser_SETIRQ( INT iSerPort ) outp( iSerPort + SER_MODEM_CONTROL, inp( iSerPort + SER_MODEM_CONTROL ) |SER_MCR_IRQENABLED );
/*****************************************************//* ser_SetIRQHandler : Fijar controlador de interrupciones*//**------------------------------------------------------------------**//* Entrada : iSerPort - Port base del puerto serie para el que se*//* quiere instalar un controlador de *//* interrupciones. *//* iSerIRQ - línea IRQ ocupada por el puerto *//* lpHandler - Dirección del controlador de interrupciones*//* bEnablers - Estados que se pueden provocar por una*//* IRQ (s. SER_IER_...-Bits) *//* Salida : Dirección del controlador IRQ antiguo *//*****************************************************/VOID ( _interrupt _FP *ser_SetIRQHandler( INT iSerPort, INT iSerIRQ, VOID ( _interrupt _FP *lpHandler ) (), BYTE bEnablers ) ) () /* Fijar disparador IRQ*/ outp( iSerPort + SER_IRQ_ENABLE, bEnablers ); ser_SETIRQ( iSerPort ); /* Enviar IRQ's al controlador */ /* Fijar controlador (IRQ se activa allí) */ return irq_SetHandler( iSerIRQ, lpHandler );
/*****************************************************//* ser_RestoreIRQHandler : Restaurar controlador IRQ antiguo*//**------------------------------------------------------------------**//* Entrada : iSerPort - Port base del puerto serie cuyo *//* controlador de interrupciones antiguo se vuelve a *//*interrupciones. *//* iSerIRQ - línea IRQocupada por el puerto *//* lpHandler - Direcc. delcontrolador de IRQ antiguo *//*****************************************************/VOID ser_RestoreIRQHandler( INT iSerPort, INT iSerIRQ, VOID ( _interrupt _FP *lpHandler ) () ) ser_CLRIRQ( iSerPort ); /* No enviar IRQ's al controlador */ /* Fijar controlador y borrar todos los activos */ ser_SetIRQHandler( iSerPort, iSerIRQ, lpHandler, 0 ); irq_Disable( iSerIRQ ); /* Desactivar IRQ por el controlador*/
/*****************************************************//* ser_PrintError : Dar mensaje de error *//**------------------------------------------------------------------**//* Entrada : pWin - Dirección de una ventana en la que se ha de*//* realizar la visualización o NULL para pantalla. *//* e - Error *//*****************************************************/VOID ser_PrintError( PWINDOW pWin, INT e ) switch( e ) case SER_LSR_DATARECEIVED: win_printf( pWin, "Datos antiguos\n" ); break; case SER_ERRTIMEOUT: win_printf( pWin, "TimeOut-Error! "); break; case SER_ERRSIGNALS: win_printf( pWin, "Líneas de señal"); break; default: if( e & SER_LSR_OVERRUNERROR ) win_printf( pWin, "Overrun Error\n" ); if( e & SER_LSR_PARITYERROR ) win_printf( pWin, "Parity Error\n" ); if( e & SER_LSR_FRAMINGERROR ) win_printf( pWin, "Framing Error\n" ); if( e & SER_LSR_BREAKDETECT ) win_printf( pWin, "Break detected\n" );
/*****************************************************//* ser_PrintModemStatus : Mostrar estado de las líneas de señal*//**------------------------------------------------------------------**//* Entrada : pWin - Dirección de una ventana en la que se ha de*//* realizar la visualización o NULL para pantalla. *//* iSerPort - Port base del puerto cuyos estado de línea *//* se quieren mostrar. *//*****************************************************/VOID ser_PrintModemStatus( PWINDOW pWin, INT iSerPort ) BYTE b; b = ( BYTE )inp( iSerPort + SER_MODEM_STATUS ); win_printf(pWin,"%s", b & SER_MSR_DCTS ? "DCTS :" : " CTS:" ); win_printf(pWin,"%s\n", b & SER_MSR_CTS ? "[X]" : "[ ]" ); win_printf(pWin,"%s", b & SER_MSR_DDSR ? "DDSR :" : "DSR :" ); win_printf(pWin,"%s\n", b & SER_MSR_DSR ? "[X]" : "[ ]" ); win_printf(pWin,"%s", b & SER_MSR_DRI ? "DRI :" : " RI :" ); win_printf(pWin,"%s\n", b & SER_MSR_RI ? "[X]" : "[ ]" ); win_printf(pWin,"%s", b & SER_MSR_DCD ? "DCD :" : " CD:" ); win_printf(pWin, "%s\n", b & SER_MSR_CD ? "[X]" : "[ ]" );
/*****************************************************//* ser_PrintLineStatus : Mostrar estado del puerto *//**------------------------------------------------------------------**//* Entrada : pWin - Dirección de una ventana en la que se ha de*//* realizar la visualización o NULL para pantalla. *//* iSerPort - Port base del puerto cuyos estados internos */
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
/* se quieren mostrar. *//*****************************************************/VOID ser_PrintLineStatus( PWINDOW pWin, INT iSerPort ) BYTE b; b = ( BYTE )inp( iSerPort + SER_LINE_STATUS ); win_printf(pWin, "Data received %s\n", b & SER_LSR_DATARECEIVED ? "[X]" : "[ ]" ); win_printf(pWin, "Overrun Error %s\n", b & SER_LSR_OVERRUNERROR ? "[X]" : "[ ]" ); win_printf(pWin, "Parity Error %s\n", b & SER_LSR_PARITYERROR ? "[X]" : "[ ]" ); win_printf(pWin, "Framing Error %s\n", b & SER_LSR_FRAMINGERROR ? "[X]" : "[ ]" ); win_printf(pWin, "Break detected%s\n", b & SER_LSR_BREAKDETECT ? "[X]" : "[ ]" ); win_printf(pWin, "THR Empty %s\n", b & SER_LSR_THREMPTY ? "[X]" : "[ ]" ); win_printf(pWin, "TSR Empty %s\n", b & SER_LSR_TSREMPTY ? "[X]" : "[ ]" );
/*****************************************************//* ser_GetBaud : Obtener baudios actuales de un puerto *//**------------------------------------------------------------------**//* Entrada : iSerPort - Direcc. base del puerto cuyos baudios se*//* quieren averiguar. *//* Salida : Tasa de baudios *//*****************************************************/LONG ser_GetBaud( INT iSerPort ) UINT uDivisor; BYTE bSettings;
_disable(); bSettings = ( BYTE ) inp( iSerPort + SER_LINE_CONTROL ); outp( iSerPort + SER_LINE_CONTROL, bSettings |SER_LCR_SETDIVISOR ); /* Leer divisor de baudios*/ uDivisor = MAKEWORD( inp( iSerPort + SER_DIVISOR_MSB ), inp( iSerPort + SER_DIVISOR_LSB ) );
outp( iSerPort + SER_LINE_CONTROL, bSettings ); _enable(); if( uDivisor ) return SER_MAXBAUD / uDivisor; return 0L;
/*****************************************************//* ser_PrintCardSettings : Mostrar par metros de transmisión del*//* puerto *//**------------------------------------------------------------------**/
/* Entrada : pWin - Dirección de una ventana en la que se ha de*//* realizar la visualización o NULL para pantalla. *//* iSerPort - Port base del puerto, cuyos par metros de *//* transmisión se quieren mostrar. *//*****************************************************/VOID ser_PrintCardSettings( PWINDOW pWin, INT iSerPort ) LONG lBaudRate; BYTE bSettings; INT WordLen;
switch( ser_UARTType( iSerPort ) ) case NOSER: win_printf(pWin, " No se encuentra ningún puerto\n"); return; case INS8250: win_printf(pWin, " INS8250 UART-Chip\n"); break; case NS16450: win_printf(pWin, " NS16450 UART-Chip\n"); break; case NS16550A: win_printf(pWin, " NS16550A UART-Chip\n"); break; case NS16C552: win_printf(pWin, " NS16C552 UART-Chip\n"); break; lBaudRate = ser_GetBaud( iSerPort ); win_printf(pWin, " Baudrate %ld\n", lBaudRate );
bSettings = ( BYTE ) inp( iSerPort + SER_LINE_CONTROL ); WordLen = 5 + ( bSettings & SER_LCR_WORDLEN ); win_printf(pWin, " Bit datos : %d\n", WordLen ); win_printf(pWin, " StopBits : %s\n", bSettings & SER_LCR_2STOPBITS ? ( WordLen == 5 ? "1.5" : "2" ) : "1"); win_printf(pWin, " Paridad : "); switch( bSettings & SER_LCR_PARITYMSK ) case SER_LCR_ODDPARITY: win_printf(pWin, "impar"); case SER_LCR_EVENPARITY: win_printf(pWin, "par"); break; case SER_LCR_PARITYSET: win_printf(pWin, "siempreactivo"); break; case SER_LCR_PARITYCLR: win_printf(pWin, "siempreborrado"); break; default: win_printf(pWin, "ninguno"); /* PARITYON = 0 => sin paridad */
win_printf(pWin, "\n"); if( bSettings & SER_LCR_SENDBREAK ) win_printf(pWin, "Enviar Break-Signal\n");#endif
/*****************************************************//* A R G S . H */ /**------------------------------------------------------------------**//* Tarea : Archivo de cabecera para ARGS.C *//**------------------------------------------------------------------**//* Autor : Michael Tischer / Bruno Jennrich *//* desarrollado el: 20.03.1994 *//* último update : 23.01.1995 *//*****************************************************/#ifndef _INC_ARGS_H#define _INC_ARGS_H
#include "types.h"
#define _char 0
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
#define _int 1#define _long 2#define _string 3#define _none 4
INT GetArg( INT argc, PCHAR argv[], PCHAR lpPrefix, INT iType, PVOID lpVar, INT iNumElements );INT GetNArg( INT argc, PCHAR argv[ ], PCHAR lpPrefix, PCHAR lpString[], INT iNumElements );INT FindString( PCHAR lpArray[], PCHAR lpFind, INT iNum );PCHAR strichr ( PCHAR lpStr, PCHAR lpSearch );INT htoi ( PCHAR lpStr, INT iDef );
#endif
/*****************************************************//* I R Q _ U T I L . H *//**------------------------------------------------------------------**//* Tarea : Constantes y prototipos para funciones de *//* interrupción. *//**------------------------------------------------------------------**//* Autor : Michael Tischer / Bruno Jennrich *//* desarrollado el: 12.03.1994 *//* último update : 24.01.1995 *//*****************************************************/#ifndef __INC_IRQ_UTIL_H#define __INC_IRQ_UTIL_H
#include "types.h"
/*- Direcciones de port controlador IRQ ------------------------------*/#define MASTER_PIC 0x20 /* Dirección base del Master PIC */#define SLAVE_PIC 0xA0 /* Dirección base del Slave-PIC */#define IRQ_MASK 0x01 /*Offset del port de enmascaramiento*/
/*- Comandos IRQ ----------------------------------------------------*/#define EOI 0x20 /* Fin de interr. sin especificar */
#define MASTER_FIRST_VECTOR 0x08 /* Vectores de software de las interr.*/#define SLAVE_FIRST_VECTOR 0x70 /*de hardware */
/*- Prototipos -------------------------------------------------------*/VOID irq_Enable ( INT iIRQ );VOID irq_Disable( INT iIRQ );VOID irq_SendEOI( INT iIRQ );VOID ( _interrupt _FP *irq_SetHandler( INT iIRQ, VOID (_interrupt _FP *lpHandler)() ) ) ();BYTE irq_ReadMask( INT iController );BYTE irq_ReadIRR ( INT iController );BYTE irq_ReadISR ( INT iController );#endif
/*****************************************************//* S E R U T I L . H *//**------------------------------------------------------------------**//* Tarea : Archivo Include para SERUTIL.C *//**------------------------------------------------------------------**//* Autor : Michael Tischer / Bruno Jennrich *//* desarrollado el: 08.04.1994 *//* último update : 25.01.1995 *//*****************************************************/#ifndef _INC_SER_UTIL_H#define _INC_SER_UTIL_H
#include <dos.h>
#include "types.h"#include "win.h"
#define SER_COM1 0x3F8 /* Dirección base COM1*/#define SER_COM2 0x2F8 /* Dirección base COM2*/
#define SER_IRQ_COM1 4 /* IRQ 4 = Vector 0x0C*/#define SER_IRQ_COM2 3 /* IRQ 3 = Vector 0x0B*/
#define SER_TXBUFFER 0x00 /* Transmit Register */#define SER_RXBUFFER 0x00 /* Receive Register*/#define SER_DIVISOR_LSB 0x00 /* Baudrate Divisor LSB*/
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
#define SER_DIVISOR_MSB 0x01 /* Baudrate Divisor MSB*/#define SER_IRQ_ENABLE 0x01 /* Interrupt-Enable-Register*/#define SER_IRQ_ID 0x02 /* Interrupt ID-Register */#define SER_FIFO 0x02 /* FIFO-Register */#define SER_2FUNCTION 0x02 /* Alternate-Function- Register */#define SER_LINE_CONTROL 0x03 /* Control de línea*/#define SER_MODEM_CONTROL 0x04 /* Control módem*/#define SER_LINE_STATUS 0x05 /* Estado de línea*/#define SER_MODEM_STATUS 0x06 /* Estadomódem*/#define SER_SCRATCH 0x07 /* Scratch-Register*/
/* IRQ-Enable-Register-Bits (Des/activarinterrupciones)*/#define SER_IER_RECEIVED 0x01 /*IRQ después de recepción*/#define SER_IER_SENT 0x02 /* IRQ después de byte enviado*/#define SER_IER_LINE 0x04 /*IRQ después de cambio de línea*/#define SER_IER_MODEM 0x08 /* IRQ después de cambio de estado de módem */
/* IRQ-ID - Bits ¨Razón de la IRQ? */#define SER_ID_PENDING 0x01 /* ¨hay una IRQ serie? */#define SER_ID_MASK 0x06 /* ID se codifica en bits 1 y 2*/#define SER_ID_LINESTATUS 0x06 /* Estado de línea (Error o Break) */#defineSER_ID_RECEIVED 0x04 /* Datos recibidos*/#define SER_ID_SENT 0x02 /* Byte se envió*/#define SER_ID_MODEMSTATUS 0x00 /* CTS, DSR, RI oRLSD cambiados */ /*Ocupación del bits en el reg. FIFO ( si es 16550A-UART)*/#define SER_FIFO_ENABLE 0x01#defineSER_FIFO_RESETRECEIVE 0x02#define SER_FIFO_RESETTRANSMIT 0x04
/* FIFO-Bits (¨Con cu ntos bbytes en el FIFO se dispara IRQ?)*/#define SER_FIFO_TRIGGER0 0x00 /* Normal*/#define SER_FIFO_TRIGGER4 0x40 /* 4 Bytes*/#define SER_FIFO_TRIGGER8 0x80 /* 8 Bytes*/#define SER_FIFO_TRIGGER14 0xC0 /* 14 Bytes*/
/* Line-Control-Register - Bits (Par metros de envío) */#define SER_LCR_WORDLEN 0x03 /* Nº bits a enviar */#define SER_LCR_5BITS 0x00#define SER_LCR_6BITS 0x01#define SER_LCR_7BITS 0x02#define SER_LCR_8BITS 0x03#define SER_LCR_2STOPBITS 0x04 /* 2 ó 1.5 Stopbits*/#define SER_LCR_1STOPBIT 0x00 /* 1 Stopbit */
#define SER_LCR_NOPARITY 0x00 /* Apagar comprob. paridad */#defineSER_LCR_ODDPARITY 0x08 /* Paridad impar */#define SER_LCR_EVENPARITY 0x18 /* Paridad par*/#define SER_LCR_PARITYSET 0x28 /* Bit de paridadsiempre
activo */#defineSER_LCR_PARITYCLR 0x38 /* Bit de paridad siempre inactivo */#defineSER_LCR_PARITYMSK 0x38#define SER_LCR_SENDBREAK0x40 /* Envía Break mientras bit activo */#define SER_LCR_SETDIVISOR 0x80 /* para cceso al divisor de baudios */ /*Modem-Control-Register - Bits (Control de señal) */#define SER_MCR_DTR 0x01 /* DTR-Signal activo*/#define SER_MCR_RTS 0x02 /* RTS-Signal activo*/#define SER_MCR_UNUSED 0x04#define SER_MCR_IRQENABLED 0x08 /* IRQ's al IRQ-Controller */#define SER_MCR_LOOP 0x10 /* Auto-Test */
/* Line-Status-Register - Bits (Error de envío) */#define SER_LSR_DATARECEIVED 0x01 /* Palabra de datos (5-8 bits) recibido*/#define SER_LSR_OVERRUNERROR 0x02 /* Palabraanterior perdida */#define SER_LSR_PARITYERROR 0x04 /* Error de paridad*/#define SER_LSR_FRAMINGERROR 0x08 /* Error de bit de paro */#defineSER_LSR_BREAKDETECT 0x10 /* Break descubirto */#define SER_LSR_ERRORMSK
(SER_LSR_OVERRUNERROR|SER_LSR_PARITYERROR|\
SER_LSR_FRAMINGERROR|SER_LSR_BREAKDETECT)#defineSER_LSR_THREMPTY 0x20#define SER_LSR_TSREMPTY0x40
/* Modem Status Register - Bits (Qué señales hay activas)*//* Los bits Delta... indican sie el estado de las señales *//*correspondientes se ha modificado desde la última lectura *//*del Modem Status Register.*/#define SER_MSR_DCTS 0x01 /* Delta CTS (Estado en CTS)*/#define SER_MSR_DDSR 0x02 /* Delta DSR (Estado en DSR)*/#define SER_MSR_DRI 0x04 /* Delta RI (Estado en RI)*/#define SER_MSR_DCD 0x08 /* Delta CD (Estado en CD)*/#define SER_MSR_CTS 0x10 /* Clear To Send activo*/#define SER_MSR_DSR 0x20 /* Data Set Ready activo*/#define SER_MSR_RI 0x40 /* Rin Indicator activo */#define SER_MSR_CD 0x80 /* Carrier Detect activo*/
#define NOSER 0#define INS8250 1 /* National Semiconductor UART's*/#define NS16450 2#define NS16550A 3#define NS16C552 4
#define SER_MAXBAUD 115200L /* Tasa baudios m x.*/
#define SER_SUCCESS 0#define SER_ERRSIGNALS 0x0300#define SER_ERRTIMEOUT 0x0400
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
/* Prototipos */INT ser_UARTType ( INT iSerPort );INT ser_Init ( INT iSerPort, LONG lBaudRate, BYTE bParams);VOID ser_FIFOLevel ( INT iSerPort, BYTE bLevel );VOID ser_CLRIRQ ( INT iSerPort );VOID ser_SETIRQ ( INT iSerPort );INT ser_IsDataAvaiable ( INT iSerPort );INT ser_IsWritingPossible( INT iSerPort );INT ser_IsModemStatusSet( INT iSerPort, BYTE bTestStatus );VOID ser_SetModemControl ( INT iSerPort, BYTE bNewControl );INT ser_WriteByte ( INT iSerPort, BYTE bData, UINT uTimeOut, BYTE bSigMask, BYTE bSigVals);INT ser_ReadByte ( INT iSerPort, PBYTE lpData, UINT uTimeOut, BYTE bSigMask, BYTE bSigVals);INT ser_WritePaket ( INT iSerPort, PBYTE lpData, INT iLen,UINT uTimeOut, BYTE bSigMask, BYTE bSigVals );
INT ser_ReadPaket ( INT iSerPort, PBYTE lpData, INT iLen, UINT uTimeOut, BYTE bSigMask, BYTE bSigVals);VOID ( _interrupt _FP *ser_SetIRQHandler( INT iSerPort, INTiSerIRQ VOID ( _interrupt _FP *lpHandler ) (),BYTE bEnablers ) )();VOID ser_RestoreIRQHandler( INTiSerPort, INT iSerIRQ, VOID ( _interrupt _FP*lpHandler ) () );VOID ser_PrintError ( PWINDOW pWin, INTe );VOID ser_PrintModemStatus ( PWINDOW pWin, INT iSerPort );VOID ser_PrintLineStatus ( PWINDOW pWin, INT iSerPort );LONG ser_GetBaud ( INT iSerPort );VOID ser_PrintCardSettings( PWINDOW pWin, INT iSerPort );
#endif
/*****************************************************//* T Y P E S . H *//**------------------------------------------------------------------**//* Tarea : Definir constantes y macros empleadas *//**------------------------------------------------------------------**//* Autor : Michael Tischer / Bruno Jennrich *//* desarrollado el: 20.03.1994 *//* último update : 26.01.1995 *//*****************************************************/#ifndef _INC_TYPES_H#define _INC_TYPES_H
#ifndef _FP#define _FP far#endif
#ifndef _NP#define _NP near#endif
typedef unsigned char BYTE;typedef BYTE _FP *LPBYTE;typedef BYTE _NP *NPBYTE;typedef BYTE *PBYTE;
typedef unsigned int UINT;typedef UINT _FP *LPUINT;typedef UINT _NP *NPUINT;typedef UINT *PUINT;
typedef unsigned int WORD;typedef WORD _FP *LPWORD;typedef WORD _NP *NPWORD;typedef WORD *PWORD;
typedef unsigned long ULONG;typedef ULONG _FP *LPULONG;typedef ULONG _NP *NPULONG;typedef ULONG *PULONG;
typedef long LONG;typedef LONG _FP *LPLONG;typedef LONG _NP *NPLONG;typedef LONG *PLONG;
typedef int INT;typedef int _FP *LPINT;typedef int _NP *NPINT;typedef int *PINT;
typedef char CHAR;typedef char _FP *LPCHAR;typedef char _NP *NPCHAR;typedef char *PCHAR;
typedef void VOID;typedef void _FP *LPVOID;typedef void _NP *NPVOID;typedef void *PVOID;
#define LOBYTE( w ) ( ( BYTE ) ( ( w ) & 0xFF ) )#define HIBYTE( w ) ( ( BYTE ) ( ( ( w ) >> 8 ) & 0xFF ) )#define MAKEWORD( h, l ) ( ( ( WORD )( h ) << 8 ) | ( WORD )( l ) )
#define LOWORD( l ) ( ( WORD )( ( l ) & 0x0000FFFF ) )#define HIWORD( l ) ( ( WORD )( ( l ) >> 16 ) )#define MAKELONG( h, l ) ( ( ( LONG )( h ) << 16 ) | ( LONG )( l ) )
#define TRUE (0 == 0)#define FALSE (0 == 1)
#define ON TRUE
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
#define OFF FALSE
#define NO_ERROR 0#define ERROR 0xFFFF /* Error no definido */
#ifndef MK_FP#define MK_FP(s, o)((LPVOID)((ULONG)(s)<<16|(o)))#endif
#ifndef _interrupt#define _interrupt interrupt#endif
#ifndef _REGS#define _REGS REGS#endif
#ifndef _REGS#define _SREGS SREGS#endif
#ifndef _SREGS#define _SREGS SREGS#endif
#ifndef _int86#define _int86 int86#endif
#ifndef _int86x#define _int86x int86x#endif
#ifndef _getch#define _getch getch#endif
#endif
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
3.2.- NORMAS APLICADAS
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
3.3.- HOJAS DE CARACTERÍSTICAS DE LOS COMPONENTES UTILIZADOS
M54HC00M74HC00
December 1992
QUAD 2-INPUT NAND GATE
B1R(Plastic Package)
ORDER CODES :M54HC00F1R M74HC00M1RM74HC00B1R M74HC00C1R
F1R(Ceramic Package)
M1R(Micro Package)
C1R(Chip Carrier)
PIN CONNECTIONS (top view)
NC =No InternalConnection
INPUT AND OUTPUT EQUIVALENT CIRCUIT
.HIGH SPEEDtPD = 6 ns (TYP.) AT VCC = 5 V.LOW POWER DISSIPATIONICC = 1 µA (MAX.) AT TA = 25 °C.HIGH NOISE IMMUNITYVNIH = VNIL = 28 % VCC (MIN.).OUTPUTS DRIVE CAPABILITY10 LSTTL LOADS.BALANCED PROPAGATION DELAYStPLH = tPHL.WIDE OPERATING VOLTAGE RANGEVCC (OPR) = 2 V TO 6 V.PIN AND FUNCTION COMPATIBLEWITH 54/74LS00.SYMMETRICAL OUTPUT IMPEDANCE IOH = IOL = 4 mA (MIN.)
The M54/74HC00 is a high speed CMOS QUAD 2-INPUT NAND GATE fabricated in silicon gateC2MOS technology. It has the same highspeed per-formance of LSTTL combined with true CMOS lowpower consumption. The internal circuit is com-posed of 3 stages including buffer output, which en-ables high noise immunity and stable output. Allinputs are equipped with protection circuits againststatic discharge and transient excess voltage.
DESCRIPTION
1/9
TRUTH TABLE
A B Y
L L H
L H H
H L H
H H L
PIN DESCRIPTION
PIN No SYMBOL NAME AND FUNCTION
1, 4, 9, 12 1A to 4A Data Inputs
2, 5, 10, 13 1B to 4B Data Inputs
3, 6, 8, 11 1Y to 4Y Data Outputs
7 GND Ground (0V)
14 VCC Positive Supply Voltage
IEC LOGIC SYMBOL
SCHEMATIC CIRCUIT (Per Gate)
ABSOLUTE MAXIMUM RATINGS
Symbol Parameter Value Unit
VCC Supply Voltage -0.5 to +7 V
VI DC Input Voltage -0.5 to VCC + 0.5 V
VO DC Output Voltage -0.5 to VCC + 0.5 V
IIK DC Input Diode Current ± 20 mA
IOK DC Output Diode Current ± 20 mA
IO DC Output Source Sink Current Per Output Pin ± 25 mA
ICC or IGND DC VCC or Ground Current ± 50 mA
PD Power Dissipation 500 (*) mW
Tstg Storage Temperature -65 to +150 oC
TL Lead Temperature (10 sec) 300 oCAbsolute MaximumRatings are those values beyond whichdamage to the device may occur. Functional operation under these condition isnot implied.(*) 500 mW: ≅ 65 oC derate to 300 mW by 10mW/oC: 65 oC to 85 oC
M54/M74HC00
2/9
RECOMMENDED OPERATING CONDITIONS
Symbol Parameter Value Unit
VCC Supply Voltage 2 to 6 V
VI Input Voltage 0 to VCC V
VO Output Voltage 0 to VCC V
Top Operating Temperature: M54HC SeriesM74HC Series
-55 to +125-40 to +85
oCoC
tr, tf Input Rise and Fall Time VCC = 2 V 0 to 1000 ns
VCC = 4.5 V 0 to 500
VCC = 6 V 0 to 400
DC SPECIFICATIONS
Symbol Parameter
Test Conditions Value
UnitVCC(V)
TA = 25 oC54HC and 74HC
-40 to 85 oC74HC
-55 to 125 oC54HC
Min. Typ. Max. Min. Max. Min. Max.
VIH High Level InputVoltage
2.0 1.5 1.5 1.5V4.5 3.15 3.15 3.15
6.0 4.2 4.2 4.2
VIL Low Level InputVoltage
2.0 0.5 0.5 0.5V4.5 1.35 1.35 1.35
6.0 1.8 1.8 1.8
VOH High LevelOutput Voltage
2.0VI =VIH
orVIL
IO=-20 µA1.9 2.0 1.9 1.9
V4.5 4.4 4.5 4.4 4.4
6.0 5.9 6.0 5.9 5.9
4.5 IO=-4.0 mA 4.18 4.31 4.13 4.10
6.0 IO=-5.2 mA 5.68 5.8 5.63 5.60
VOL Low Level OutputVoltage
2.0VI =VIH
orVIL
IO= 20 µA0.0 0.1 0.1 0.1
V4.5 0.0 0.1 0.1 0.1
6.0 0.0 0.1 0.1 0.1
4.5 IO= 4.0 mA 0.17 0.26 0.33 0.40
6.0 IO= 5.2 mA 0.18 0.26 0.33 0.40
II Input LeakageCurrent
6.0VI = VCC or GND ±0.1 ±1 ±1 µA
ICC Quiescent SupplyCurrent
6.0 VI = VCC or GND 1 10 20 µA
M54/M74HC00
3/9
AC ELECTRICAL CHARACTERISTICS (CL = 50 pF, Input tr = tf = 6 ns)
Symbol Parameter
Test Conditions Value
UnitVCC
(V)
TA = 25 oC54HC and 74HC
-40 to 85 oC74HC
-55 to 125 oC54HC
Min. Typ. Max. Min. Max. Min. Max.
tTLH
tTHL
Output TransitionTime
2.0 30 75 95 110ns4.5 8 15 19 22
6.0 7 13 16 19
tPLH
tPHL
PropagationDelay Time
2.0 27 75 95 110ns4.5 9 15 19 22
6.0 8 13 16 19
CIN Input Capacitance 5 10 10 10 pF
CPD (*) Power DissipationCapacitance
20pF
(*) CPD is defined as the value of the IC’s internal equivalent capacitance which is calculated from the operating current consumption without load.(Refer to Test Circuit). Average operting current can be obtained by the followingequation. ICC(opr) = CPD • VCC • fIN + ICC/4 (per Gate)
SWITCHING CHARACTERISTICS TEST CIRCUIT
INPUT WAVEFORM IS THE SAME AS THAT IN CASE OF SWITCHINGCHARACTERISTICS TEST.
TEST CIRCUIT ICC (Opr.)
M54/M74HC00
4/9
Plastic DIP14 MECHANICAL DATA
DIM.mm inch
MIN. TYP. MAX. MIN. TYP. MAX.
a1 0.51 0.020
B 1.39 1.65 0.055 0.065
b 0.5 0.020
b1 0.25 0.010
D 20 0.787
E 8.5 0.335
e 2.54 0.100
e3 15.24 0.600
F 7.1 0.280
I 5.1 0.201
L 3.3 0.130
Z 1.27 2.54 0.050 0.100
P001A
M54/M74HC00
5/9
Ceramic DIP14/1 MECHANICAL DATA
DIM.mm inch
MIN. TYP. MAX. MIN. TYP. MAX.
A 20 0.787
B 7.0 0.276
D 3.3 0.130
E 0.38 0.015
e3 15.24 0.600
F 2.29 2.79 0.090 0.110
G 0.4 0.55 0.016 0.022
H 1.17 1.52 0.046 0.060
L 0.22 0.31 0.009 0.012
M 1.52 2.54 0.060 0.100
N 10.3 0.406
P 7.8 8.05 0.307 0.317
Q 5.08 0.200
P053C
M54/M74HC00
6/9
SO14 MECHANICAL DATA
DIM.mm inch
MIN. TYP. MAX. MIN. TYP. MAX.
A 1.75 0.068
a1 0.1 0.2 0.003 0.007
a2 1.65 0.064
b 0.35 0.46 0.013 0.018
b1 0.19 0.25 0.007 0.010
C 0.5 0.019
c1 45° (typ.)
D 8.55 8.75 0.336 0.344
E 5.8 6.2 0.228 0.244
e 1.27 0.050
e3 7.62 0.300
F 3.8 4.0 0.149 0.157
G 4.6 5.3 0.181 0.208
L 0.5 1.27 0.019 0.050
M 0.68 0.026
S 8° (max.)
P013G
M54/M74HC00
7/9
PLCC20 MECHANICAL DATA
DIM.mm inch
MIN. TYP. MAX. MIN. TYP. MAX.
A 9.78 10.03 0.385 0.395
B 8.89 9.04 0.350 0.356
D 4.2 4.57 0.165 0.180
d1 2.54 0.100
d2 0.56 0.022
E 7.37 8.38 0.290 0.330
e 1.27 0.050
e3 5.08 0.200
F 0.38 0.015
G 0.101 0.004
M 1.27 0.050
M1 1.14 0.045
P027A
M54/M74HC00
8/9
Information furnished is believed to be accurate and reliable. However, SGS-THOMSON Microelectronics assumes no responsability for theconsequences of use of such information nor for any infringement of patents or other rights of third parties which may results from its use. Nolicense is granted by implication or otherwise under any patent or patent rights of SGS-THOMSON Microelectronics. Specificationsmentionedin this publication are subject to change without notice. This publication supersedes and replaces all information previously supplied.SGS-THOMSON Microelectronicsproducts are not authorized foruse ascritical components in life support devices or systems without expresswritten approval of SGS-THOMSON Microelectonics.
1994 SGS-THOMSON Microelectronics - All Rights Reserved
SGS-THOMSON Microelectronics GROUP OF COMPANIESAustralia - Brazil - France - Germany - Hong Kong - Italy - Japan - Korea - Malaysia - Malta - Morocco - The Netherlands -
Singapore - Spain - Sweden - Switzerland - Taiwan - Thailand - United Kingdom - U.S.A
M54/M74HC00
9/9
1N4001-1N
40071N4001 - 1N4007
1.0 Ampere General Purpose Rectifiers
Absolute Maximum Ratings* TA = 25°C unless otherwise noted
*These ratings are limiting values above which the serviceability of any semiconductor device may be impaired.
Electrical Characteristics TA = 25°C unless otherwise noted
Discrete POWER & SignalTechnologies
1998 Fairchild Semiconductor Corporation
Features
• Low forward voltage drop.
• High surge current capability.
Parameter Device Units4001 4002 4003 4004 4005 4006 4007
Peak Repetitive Reverse Voltage 50 100 200 400 600 800 1000 V
Maximum RMS Voltage 35 70 140 280 420 560 700 V
DC Reverse Voltage (Rated VR) 50 100 200 400 600 800 1000 V
Maximum Reverse Current @ rated VR TA = 25°C
TA = 100°C5.0500
µAµA
Maximum Forward Voltage @ 1.0 A 1.1 V
Maximum Full Load Reverse Current,Full Cycle TA = 75°C
30 µA
Typical Junction CapacitanceVR = 4.0 V, f = 1.0 MHz
15 pF
DO-41COLOR BAND DENOTES CATHODE
Symbol Parameter Value Units
IO Average Rectified Current.375 " lead length @ TA = 75°C
1.0 A
if(surge) Peak Forward Surge Current8.3 ms single half-sine-waveSuperimposed on rated load (JEDEC method)
30 A
PD Total Device DissipationDerate above 25°C
2.520
WmW/°C
RθJA Thermal Resistance, Junction to Ambient 50 °C/W
Tstg Storage Temperature Range -55 to +175 °CTJ Operating Junction Temperature -55 to +150 °C
1.0 min (25.4)
0.107 (2.72)0.080 (2.03)
0.034 (0.86)0.028 (0.71)
0.205 (5.21)0.160 (4.06)
Dimensions ininches (mm)
1N4001-1N
4007General Purpose Rectifiers
(continued)
Typical Characteristics
Forward Characteristics
0.6 0.8 1 1.2 1.40.01
0.02
0.04
0.1
0.2
0.4
1
2
4
10
20
FORWARD VOLTAGE (V)
FO
RW
AR
D C
UR
RE
NT
(A)
T = 25 C Pulse Width = 300 µS2% Duty Cycle
ºJ
Non-Repetitive Surge Current
1 2 4 6 8 10 20 40 60 1000
6
12
18
24
30
NUMBER OF CYCLES AT 60Hz
FO
RW
AR
D S
UR
GE
CU
RR
EN
T (
A) p
k
Forward Current Derating Curve
0 20 40 60 80 100 120 140 160 1800
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
AMBIENT TEMPERATURE ( C)
FO
RW
AR
D C
UR
RE
NT
(A
)
º
SINGLE PHASE HALF WAVE
60HZRESISTIVE OR
INDUCTIVE LOAD.375" 9.0 mm LEAD
LENGTHS
Reverse Characteristics
0 20 40 60 80 100 120 1400.01
0.1
1
10
100
1000
RATED PEAK REVERSE VOLTAGE (%)
RE
VE
RS
E C
UR
RE
NT
(
A)
T = 25 CºJ
T = 150 CºJ
T = 100 CºJ
µ
min
. 1.1
02 (
28.0
)m
in. 1
.102
(28
.0)
max
. .16
1 (4
.1)
max. ∅
Cathode
0.034 (0.86)
Mark
max. ∅ 0.102 (2.6)
12/5/00
1N4728 thru 1N4764Zener Diodes
VZ Range 3.3 to 100VPower Dissipation 1.0W
Maximum Ratings & Thermal Characteristics Ratings at 25°C ambient temperature unless otherwise specified.
Parameter Symbol Value Unit
Zener Current See Next Page
Power Dissipation at Tamb = 50°C Ptot 1.0(1) W
Thermal Resistance Junction to Ambient Air RΘJA 170(1) °C/W
Junction Temperature Tj 200 °C
Storage Temperature Range TS –65 to +200 °C
Note: (1) Valid provided that electrodes at a distance of 10mm from case are kept at ambient temperature.
DO-204AL (DO-41 Glass)
Dimensions in inchesand (millimeters)
Features• Silicon Planar Power Zener Diodes• For use in stabilizing and clipping circuits with
high power rating.• Standard Zener voltage tolerance is ±10%. Add
suffix “A” for ±5% tolerance. Other Zener voltagesand tolerances are available upon request.
• These diodes are also available in the MELF casewith type designation ZM4728 thru ZM4764
• For bidirectional product, contact local TechnicalSales office.
Mechanical Data Case: DO-41 Glass CaseWeight: approx. 0.35gPackaging Codes/Options:
D9/5K per 13” reel (52mm tape), 10K/boxE1/5K per Ammo mag. (52mm tape), 10K/box
Electrical Characteristics (TA = 25°C unless otherwise noted). Maximum VF = 1.2V at IF = 200mA
Nominal Test Maximum Zener impedance(1) Maximum Surge MaximumZener current reverse leakage current current regulator
voltage(3) current(2)
at ZZT at at atIZT at IZT ZZK IZK IR at VR TA = 25°C TA = 50°C
Type VZ (V) IZT (mA) (Ω) (Ω) (mA) (µA) (V) IR (mA) IZM (mA)
1N4728 3.3 76 10 400 1.0 100 1 1380 2761N4729 3.6 69 10 400 1.0 100 1 1260 2521N4730 3.9 64 9 400 1.0 50 1 1190 2341N4731 4.3 58 9 400 1.0 10 1 1070 2171N4732 4.7 53 8 500 1.0 10 1 970 1931N4733 5.1 49 7 550 1.0 10 1 890 1781N4734 5.6 45 5 600 1.0 10 2 810 1621N4735 6.2 41 2 700 1.0 10 3 730 1461N4736 6.8 37 3.5 700 1.0 10 4 660 1331N4737 7.5 34 4.0 700 0.5 10 5 605 1211N4738 8.2 31 4.5 700 0.5 10 6 550 1101N4739 9.1 28 5.0 700 0.5 10 7 500 1001N4740 10 25 7 700 0.25 10 7.6 454 911N4741 11 23 8 700 0.25 5 8.4 414 831N4742 12 21 9 700 0.25 5 9.1 380 761N4743 13 19 10 700 0.25 5 9.9 344 691N4744 15 17 14 700 0.25 5 11.4 304 611N4745 16 15.5 16 700 0.25 5 12.2 285 571N4746 18 14 20 750 0.25 5 13.7 250 501N4747 20 12.5 22 750 0.25 5 15.2 225 451N4748 22 11.5 23 750 0.25 5 16.7 205 411N4749 24 10.5 25 750 0.25 5 18.2 190 381N4750 27 9.5 35 750 0.25 5 20.6 170 341N4751 30 8.5 40 1000 0.25 5 22.8 150 301N4752 33 7.5 45 1000 0.25 5 25.1 135 271N4753 36 7.0 50 1000 0.25 5 27.4 125 251N4754 39 6.5 60 1000 0.25 5 29.7 115 231N4755 43 6.0 70 1500 0.25 5 32.7 110 221N4756 47 5.5 80 1500 0.25 5 35.8 95 191N4757 51 5.0 95 1500 0.25 5 38.8 90 181N4758 56 4.5 110 2000 0.25 5 42.6 80 161N4759 62 4.0 125 2000 0.25 5 47.1 70 141N4760 68 3.7 150 2000 0.25 5 51.7 65 131N4761 75 3.3 175 2000 0.25 5 56.0 60 121N4762 82 3.0 200 3000 0.25 5 62.2 55 111N4763 91 2.8 250 3000 0.25 5 69.2 50 101N4764 100 2.5 350 3000 0.25 5 76.0 45 9
Notes:(1) The Zener impedance is derived from the 1KHZ AC voltage which results when an AC current having an RMS value equal to 10% of the Zener current (IZT or
IZK) is superimposed on IZT or IZK. Zener impedance is measured at two points to insure a sharp knee on the breakdown curve and to eliminate unstable units(2) Valid provided that electrodes at a distance of 10mm from case are kept at ambient temperature(3) Measured under thermal equilibrium and DC test conditions
1N4728 thru 1N4764Zener Diodes
1N4728 ... 1N4764
1N4728 thru 1N4764Zener Diodes
Ratings and Characteristic Curves (TA = 25°C unless otherwise noted)
BD533/5/7BD534/6/8
COMPLEMENTARY SILICON POWER TRANSISTORS
BD534, BD535, BD536, BD537 AND BD538ARE SGS-THOMSON PREFERREDSALESTYPES
DESCRIPTIONThe BD533, BD535, and BD537 are siliconepitaxial-base NPN power transistors in JedecTO-220 plastic package, intented for use inmedium power linear and switching applications.The complementary PNP types are BD534,BD536, and BD538 respectively.
INTERNAL SCHEMATIC DIAGRAM
June 1997
ABSOLUTE MAXIMUM RATINGS
Symbol Parameter Value Uni t
NPN BD533 BD535 BD537
PNP BD534 BD536 BD538
VCBO Collector-Base Voltage (IE = 0) 45 60 80 V
VCES Collector-Emit ter Voltage (VBE = 0) 45 60 80 V
VCEO Collector-Emit ter Voltage (IB = 0) 45 60 80 V
VEBO Emitter-Base Voltage (IC = 0) 5 V
IC, IE Collector and Emit ter Current 8 A
IB Base Current 1 A
Ptot Total Dissipation at Tc ≤ 25 oC 50 W
Tstg Storage Temperature -65 to 150 oC
Tj Max. Operat ing Junction Temperature 150 oCFor PNP types voltage and current values are negative.
12
3
TO-220
1/4
THERMAL DATA
Rthj-ca se
Rthj- amb
Thermal Resistance Junction-case MaxThermal Resistance Junction-ambient Max
2.570
oC/WoC/W
ELECTRICAL CHARACTERISTICS (Tcase = 25 oC unless otherwise specified)
Symbol Parameter Test Conditions Min. Typ. Max. Unit
ICBO Collector Cut-offCurrent (IE = 0)
for BD533/534 VCB = 45 Vfor BD535/536 VCB = 60 Vfor BD537/538 VCB = 80 V
100100100
µAµAµA
ICES Collector Cut-offCurrent (VBE = 0)
for BD533/534 VCE = 45 Vfor BD535/536 VCE = 60 Vfor BD537/538 VCE = 80 V
100100100
µAµAµA
IEBO Emitter Cut-off Current(IC = 0)
VEB = 5 V 1 mA
VCEO(sus )∗ Collector-EmitterSustaining Voltage(IB = 0)
IC = 100 mA for BD533/534for BD535/536for BD537/538
456080
VVV
VCE(sat )∗ Collector-EmitterSaturat ion Voltage
IC = 2 A IB = 0.2 AIC = 6 A IB = 0.6 A 0.8
0.8 VV
VBE∗ Base-Emitter Voltage IC = 2 A VCE = 2 V 1.5 V
hFE∗ DC Current Gain IC = 10 mA VCE = 5 Vfor BD533/534for BD535/536for BD537/538
IC = 500 mA VCE = 2 VIC = 2 A VCE = 2 V
for BD533/534for BD535/536for BD537/538
20201540
252515
fT Transit ion frequency IC = 500 mA VCE = 1 V 3 12 MHz∗ Pulsed: Pulse duration = 300 µs, duty cycle 1.5 %For PNP types voltage and current values are negative.
Safe Operating Areas
BD533/BD534/BD535/BD536/BD537/BD538
2/4
DIM.mm inch
MIN. TYP. MAX. MIN. TYP. MAX.
A 4.40 4.60 0.173 0.181
C 1.23 1.32 0.048 0.051
D 2.40 2.72 0.094 0.107
D1 1.27 0.050
E 0.49 0.70 0.019 0.027
F 0.61 0.88 0.024 0.034
F1 1.14 1.70 0.044 0.067
F2 1.14 1.70 0.044 0.067
G 4.95 5.15 0.194 0.203
G1 2.4 2.7 0.094 0.106
H2 10.0 10.40 0.393 0.409
L2 16.4 0.645
L4 13.0 14.0 0.511 0.551
L5 2.65 2.95 0.104 0.116
L6 15.25 15.75 0.600 0.620
L7 6.2 6.6 0.244 0.260
L9 3.5 3.93 0.137 0.154
DIA. 3.75 3.85 0.147 0.151
P011C
TO-220 MECHANICAL DATA
BD533/BD534/BD535/BD536/BD537/BD538
3/4
Information furnished is believed to be accurate and reliable. However, SGS-THOMSON Microelectronics assumes no responsability for theconsequencesof use of such information nor for any infringementof patents or other rights of third parties which may results from its use. Nolicense is granted by implication or otherwise under anypatent or patent rights of SGS-THOMSON Microelectronics. Specifications mentionedin this publication are subject to change without notice. This publicationsupersedes and replaces all information previously supplied.SGS-THOMSON Microelectronics products are notauthorized for useas critical components in life support devices or systems without expresswritten approvalof SGS-THOMSON Microelectonics.
1997 SGS-THOMSON Microelectronics - Printed in Italy - All Rights Reserved
SGS-THOMSON Microelectronics GROUP OF COMPANIESAustralia - Brazil - Canada- China- France - Germany - Hong Kong - Italy - Japan- Korea - Malaysia - Malta - Morocco - The Netherlands -
Singapore - Spain - Sweden - Switzerland - Taiwan - Thailand - United Kingdom - U.S.A. . .
BD533/BD534/BD535/BD536/BD537/BD538
4/4
1) Valid for one branch – Gültig für einen Brückenzweig2) Valid, if leads are kept at ambient temperature at a distance of 5 mm from case
Gültig, wenn die Anschlußdrähte in 5 mm Abstand von Gehäuse auf Umgebungstemperatur gehalten werden
308 01.04.2000
B…C 2300-1500
Silicon-Bridge Rectifiers Silizium-Brückengleichrichter
Nominal current 2.3 / 1.5 ANennstrom
Alternating input voltage 40…500 VEingangswechselspannung
Plastic case 19 x 5 x 10 [mm]Kunststoffgehäuse
Weight approx. 1.8 gGewicht ca.
Suffix “A” for pinning / für Anschlußfolge [ + ~ ~ – ]Suffix “B” for pinning / für Anschlußfolge [ ~ + ~ – ]
Standard packaging: bulkDimensions / Maße in mm Standard Lieferform: lose im Karton
Maximum ratings Grenzwerte
TypeTyp
Alternating input volt.Eingangswechselspg.
VVRMS [V]
Rep. peak reverse voltagePeriod. Spitzensperrspg.
VRRM [V] 1)
Surge peak reverse volt.Stoßspitzensperrspg.
VRSM [V] 1)
B40C 2300-1500 40 80 100
B80C 2300-1500 80 160 200
B125C 2300-1500 125 250 400
B250C 2300-1500 250 600 800
B380C 2300-1500 380 800 1000
B500C 2300-1500 500 1000 1200
Repetitive peak forward current f > 15 Hz IFRM 10 A 2)Periodischer Spitzenstrom
Peak forward surge current, 50 Hz half sine-wave TA = 25/C IFSM 50 AStoßstrom für eine 50 Hz Sinus-Halbwelle
Rating for fusing, t < 10 ms TA = 25/C i2t 12.5 A2sGrenzlastintegral, t < 10 ms
Operating junction temperature – Sperrschichttemperatur Tj – 50...+150/CStorage temperature – Lagerungstemperatur TS – 50...+150/C
1) Without cooling fin – Ohne Kühlblech2) Valid for one branch – Gültig für einen Brückenzweig
30901.04.2000
B…C 2300-1500
Characteristics Kennwerte
Max. fwd. current without cooling fin TA = 50/C R-load IFAV 1.8 ADauergrenzstrom ohne Kühlblech C-load IFAV 1.5 A
Max. current with cooling fin 300 cm2 TA = 50/C R-load IFAV 2.5 ADauergrenzstrom mit Kühlblech 300 cm2 C-load IFAV 2.3 A
Leakage current – Sperrstrom Tj = 25/C VR = VRRM IR < 10 :A
Thermal resistance junction to ambient air RthA < 40 K/W 1)Wärmewiderstand Sperrschicht – umgebende Luft
TypeTyp
Max. admissible load capacitorMax. zulässiger Ladekondensator
CL [:F]
Min. required protective resistor Min. erforderl. Schutzwiderstand
Rt [S]
B40C 2300-1500 5000 0.8
B80C 2300-1500 2500 1.6
B125C 2300-1500 1500 2.5
B250C 2300-1500 800 5.0
B380C 2300-1500 600 8.0
B500C 2300-1500 400 10
1Motorola Bipolar Power Transistor Device Data
. . . designed for use as audio amplifiers and drivers utilizing complementary or quasicomplementary circuits.
• DC Current Gain — hFE = 40 (Min) @ IC = 0.15 Adc• BD 135, 137, 139 are complementary with BD 136, 138, 140
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
MAXIMUM RATINGS
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Rating
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
Symbol
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
Type
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
Value
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
Unit
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Collector–Emitter Voltage
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
VCEO
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
BD 135BD 137BD 139
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
456080
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
VdcÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Collector–Base Voltage
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
VCBO
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
BD 135BD 137BD 139
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
4560100
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
VdcÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Emitter–Base Voltage
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
VEBO
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
5
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
Vdc
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Collector Current
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
IC
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
1.5
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
Adc
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Base Current
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
IB
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
0.5
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
Adc
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Total Device Dissipation @ TA = 25CDerate above 25C
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
PD
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
1.2510
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
WattsmW/C
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Total Device Dissipation @ TC = 25CDerate above 25C
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
PD
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
12.5100
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
WattmW/C
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Operating and Storage JunctionTemperature Range
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
ÎÎÎÎÎÎ
TJ, Tstg
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
–55 to +150
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
C
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
THERMAL CHARACTERISTICSÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Characteristic
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
Symbol
ÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎ
Max
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
UnitÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Thermal Resistance, Junction to Case
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
θJC
ÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎ
10
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
C/W
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Thermal Resistance, Junction to Ambient
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎ
θJA
ÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎ
100
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
C/W
SEMICONDUCTOR TECHNICAL DATA
Order this documentby BD135/D
Motorola, Inc. 1995
1.5 AMPEREPOWER TRANSISTORS
NPN SILICON45, 60, 80 VOLTS
10 WATTS
CASE 77–08TO–225AA TYPE
REV 7
2 Motorola Bipolar Power Transistor Device Data
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ELECTRICAL CHARACTERISTICS (TC = 25C unless otherwise noted)
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Characteristic
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
Symbol
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
Type
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
Min
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
Max
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
UnIt
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Collector–Emitter Sustaining Voltage*(IC = 0.03 Adc, IB = 0)
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
BVCEO*
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
BD 135BD 137BD 139
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
456080
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
———
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
VdcÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Collector Cutoff Current(VCB = 30 Vdc, IE = 0)(VCB = 30 Vdc, IE = 0, TC = 125C)
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ICBO
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
——
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
0.110
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
µAdcÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Emitter Cutoff Current(VBE = 5.0 Vdc, IC = 0)
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
IEBO
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
—
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
10
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
µAdcÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
DC Current Gain(IC = 0.005 A, VCE = 2 V)(IC = 0.15 A, VCE = 2 V)(IC = 0.5 A VCE = 2 V)
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
hFE*
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
254025
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
—250—
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
—ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Collector–Emitter Saturation Voltage*(IC = 0.5 Adc, IB = 0.05 Adc)
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
VCE(sat)*
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
—
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
0.5
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
VdcÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Base–Emitter On Voltage*(IC = 0.5 Adc, VCE = 2.0 Vdc)
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
VBE(on)*
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
—
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
ÎÎÎÎ
1
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
ÎÎÎ
Vdc
* Pulse Test: Pulse Width 300 µs, Duty Cycle 2.0%.
10.0
1
Figure 1. Active–Region Safe Operating Area
VCE, COLLECTOR–EMITTER VOLTAGE (VOLTS)
5.0
2.0
1.0
0.5
0.012 5 10 20 80
BD135BD137BD139
50
0.1
0.05
I C, C
OLL
ECTO
R C
UR
REN
T (A
MP)
TJ = 125°C dc
5 ms 0.5 ms0.1 ms
0.02
3Motorola Bipolar Power Transistor Device Data
PACKAGE DIMENSIONS
CASE 77–08TO–225AA TYPE
ISSUE V
STYLE 1:PIN 1. EMITTER
2. COLLECTOR3. BASE
NOTES:1. DIMENSIONING AND TOLERANCING PER ANSI
Y14.5M, 1982.2. CONTROLLING DIMENSION: INCH.
–B–
–A–M
K
F C
Q
H
VG
S
D
JR
U
1 32
2 PL
MAM0.25 (0.010) B M
MAM0.25 (0.010) B M
DIM MIN MAX MIN MAXMILLIMETERSINCHES
A 0.425 0.435 10.80 11.04B 0.295 0.305 7.50 7.74C 0.095 0.105 2.42 2.66D 0.020 0.026 0.51 0.66F 0.115 0.130 2.93 3.30G 0.094 BSC 2.39 BSCH 0.050 0.095 1.27 2.41J 0.015 0.025 0.39 0.63K 0.575 0.655 14.61 16.63M 5 TYP 5 TYPQ 0.148 0.158 3.76 4.01R 0.045 0.055 1.15 1.39S 0.025 0.035 0.64 0.88U 0.145 0.155 3.69 3.93V 0.040 ––– 1.02 –––
4 Motorola Bipolar Power Transistor Device Data
How to reach us:USA / EUROPE: Motorola Literature Distribution; JAPAN : Nippon Motorola Ltd.; Tatsumi–SPD–JLDC, Toshikatsu Otsuki,P.O. Box 20912; Phoenix, Arizona 85036. 1–800–441–2447 6F Seibu–Butsuryu–Center, 3–14–2 Tatsumi Koto–Ku, Tokyo 135, Japan. 03–3521–8315
MFAX: [email protected] – TOUCHTONE (602) 244–6609 HONG KONG: Motorola Semiconductors H.K. Ltd.; 8B Tai Ping Industrial Park, INTERNET: http://Design–NET.com 51 Ting Kok Road, Tai Po, N.T., Hong Kong. 852–26629298
Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or guarantee regardingthe suitability of its products for any particular purpose, nor does Motorola assume any liability arising out of the application or use of any product or circuit,and specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters can and do vary in differentapplications. All operating parameters, including “Typicals” must be validated for each customer application by customer’s technical experts. Motorola doesnot convey any license under its patent rights nor the rights of others. Motorola products are not designed, intended, or authorized for use as components insystems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure ofthe Motorola product could create a situation where personal injury or death may occur. Should Buyer purchase or use Motorola products for any suchunintended or unauthorized application, Buyer shall indemnify and hold Motorola and its officers, employees, subsidiaries, affiliates, and distributors harmlessagainst all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or deathassociated with such unintended or unauthorized use, even if such claim alleges that Motorola was negligent regarding the design or manufacture of the part.Motorola and are registered trademarks of Motorola, Inc. Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer.
BD135/D
◊
1
Semiconductor
Features• Unlimited Input Rise and Fall Times
• Exceptionally High Noise Immunity
• Fanout (Over Temperature Range)- Standard Outputs . . . . . . . . . . . . . . . 10 LSTTL Loads- Bus Driver Outputs . . . . . . . . . . . . . 15 LSTTL Loads
• Wide Operating Temperature Range . . . -55 oC to 125oC
• Balanced Propagation Delay and Transition Times
• Significant Power Reduction Compared to LSTTLLogic ICs
• HC Types- 2V to 6V Operation- High Noise Immunity: N IL = 30%, NIH = 30% of VCC
at VCC = 5V
• HCT Types- 4.5V to 5.5V Operation- Direct LSTTL Input Logic Compatibility,
VIL= 0.8V (Max), VIH = 2V (Min)- CMOS Input Compatibility, I l ≤ 1µA at VOL, VOH
DescriptionThe Harris CD74HC14, CD74HCT14 each contain 6inverting Schmitt Triggers in one package.
PinoutCD54HC14, CD54HCT14, CD74HC14, CD74HCT14
(PDIP, CERDIP, SOIC)TOP VIEW
Ordering Information
PART NUMBERTEMP. RANGE
(oC) PACKAGEPKG.NO.
CD54HCT14F -55 to 125 14 Ld CERDIP F14.3
CD74HC14E -55 to 125 14 Ld PDIP E14.3
CD74HC14M -55 to 125 14 Ld SOIC M14.15
CD74HCT14E -55 to 125 14 Ld PDIP E14.3
CD74HCT14M -55 to 125 14 Ld SOIC M14.15
NOTES:
1. When ordering, use the entire part number. Add the suffix 96 toobtain the variant in the tape and reel.
2. Die is available which meets all electrical specifications. Pleasecontact your local sales office or Harris customer service forordering information.
1A
1Y
2A
2Y
3A
3Y
GND
VCC
6A
6Y
5A
5Y
4A
4Y
1
2
3
4
5
6
7
14
13
12
11
10
9
8
January 1998
CAUTION: These devices are sensitive to electrostatic discharge. Users should follow proper IC Handling Procedures.
Copyright © Harris Corporation 1998File Number 1781.1
CD74HC14,CD74HCT14
High Speed CMOS LogicHex Inverting Schmitt Trigger
2
Functional Diagram
Logic Diagram
1A
2A
4A
5A
6A
1
3
5
9
11
13
2
4
6
8
1Y
4Y
5Y
3Y
2Y
10
126Y
3A
GND = 7VCC = 14
TRUTH TABLE
INPUT (A) OUTPUT (Y)
L H
H L
NOTE:H= High LevelL = Low Level
FIGURE 3. HYSTERESIS DEFINITION, CHARACTERISTIC, AND TEST SETUP
nA nY
VOVH
VT- VT+
VI
VH = VT+ - VT-
VCC
VI
GND
VCC
VO
GND
VT+ VT -
VH
CD74HC14, CD74HCT14
3
Absolute Maximum Ratings Thermal InformationDC Supply Voltage, VCC . . . . . . . . . . . . . . . . . . . . . . . . -0.5V to 7VDC Input Diode Current, IIK
For VI < -0.5V or VI > VCC + 0.5V . . . . . . . . . . . . . . . . . . . . . .±20mADC Output Diode Current, IOK
For VO < -0.5V or VO > VCC + 0.5V . . . . . . . . . . . . . . . . . . . .±20mADC Drain Current, per Output, IO
For -0.5V < VO < VCC +0.5V . . . . . . . . . . . . . . . . . . . . . . . . . .±25mADC Output Source or Sink Current per Output Pin, IO
For VO > -0.5V or VO < VCC + 0.5V . . . . . . . . . . . . . . . . . . . .±25mADC VCC or Ground Current, ICC . . . . . . . . . . . . . . . . . . . . . . . . .±50mA
Operating ConditionsTemperature Range, TA . . . . . . . . . . . . . . . . . . . . . . -55oC to 125oCSupply Voltage Range, VCC
HC Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2V to 6VHCT Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4.5V to 5.5V
DC Input or Output Voltage, VI, VO . . . . . . . . . . . . . . . . . 0V to VCCInput Rise and Fall Time, tr, tf
2V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100ms (Max)4.5V. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100ms (Max)6V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100ms (Max)
Thermal Resistance (Typical, Note 3) θJA (oC/W) θJC (oC/W)PDIP Package . . . . . . . . . . . . . . . . . . . 90 -CERDIP Package . . . . . . . . . . . . . . . . 130 55SOIC Package . . . . . . . . . . . . . . . . . . . 120 -
Maximum Junction Temperature (Hermetic Package or Die) . . . 175oCMaximum Junction Temperature (Plastic Package) . . . . . . . . 150oCMaximum Storage Temperature Range . . . . . . . . . .-65oC to 150oCMaximum Lead Temperature (Soldering 10s) . . . . . . . . . . . . . 300oC
(SOIC - Lead Tips Only)
CAUTION: Stresses above those listed in “Absolute Maximum Ratings” may cause permanent damage to the device. This is a stress only rating and operationof the device at these or any other conditions above those indicated in the operational sections of this specification is not implied.
NOTE:
3. θJA is measured with the component mounted on an evaluation PC board in free air.
DC Electrical Specifications
PARAMETER SYMBOL
TESTCONDITIONS
VCC (V)
25oC -40oC TO 85oC -55oC TO 125oC
UNITSVI (V) IO (mA) MIN MAX MIN MAX MIN MAX
HC TYPES
Input Switch Points VT+ - - 2 0.7 1.5 0.7 1.5 0.7 1.5 V
4.5 1.7 3.15 1.7 3.15 1.7 3.15 V
6 2.1 4.2 2.1 4.2 2.1 4.2 V
VT- - - 2 0.3 1.0 0.3 1.0 0.3 1.0 V
4.5 0.9 2.2 0.9 2.2 0.9 2.2 V
6 1.2 3.0 1.2 3.0 1.2 3.0 V
VH - - 2 0.2 1.0 0.2 1.0 0.2 1.0 V
4.5 0.4 1.4 0.4 1.4 0.4 1.4 V
6 0.6 1.6 0.6 1.6 0.6 1.6 V
High Level OutputVoltage CMOS Loads
VOH VT- orVT+
-0.02 2 1.9 - 1.9 - 1.9 - V
-0.02 4.5 4.4 - 4.4 - 4.4 - V
-0.02 6 5.9 - 5.9 - 5.9 - V
High Level OutputVoltage TTL Loads
- - - - - - - - V
-4 4.5 3.98 - 3.84 - 3.7 - V
-5.2 6 5.48 - 5.34 - 5.2 - V
CD74HC14, CD74HCT14
4
Low Level Output VoltageCMOS Loads
VOL VIH orVIL
0.02 2 - 0.1 - 0.1 - 0.1 V
0.02 4.5 - 0.1 - 0.1 - 0.1 V
0.02 6 - 0.1 - 0.1 - 0.1 V
Low Level Output VoltageTTL Loads
- - - - - - - - V
4 4.5 - 0.26 - 0.33 - 0.4 V
5.2 6 - 0.26 - 0.33 - 0.4 V
Input Leakage Current II VCC orGND
- 6 - ±0.1 - ±1 - ±1 µA
Quiescent DeviceCurrent
ICC VCC orGND
0 6 - 2 - 20 - 40 µA
HCT TYPES
Input Switch Points VT+ - - 4.5 1.2 1.9 1.2 1.9 1.2 1.9 V
5.5 1.4 2.1 1.4 2.1 1.4 2.1 V
VT- 4.5 0.5 1.2 0.5 1.2 0.5 1.2 V
5.5 0.6 1.4 0.6 1.4 0.6 1.4 V
VH 4.5 0.4 1.4 0.4 1.4 0.4 1.4 V
5.5 0.4 1.5 0.4 1.5 0.4 1.5 V
High Level OutputVoltage CMOS Loads
VOH VIH orVIL
-0.02 4.5 4.4 - 4.4 - 4.4 - V
High Level OutputVoltage TTL Loads
-4 4.5 3.98 - 3.84 - 3.7 - V
Low Level Output VoltageCMOS Loads
VOL VIH orVIL
0.02 4.5 - 0.1 - 0.1 - 0.1 V
Low Level Output VoltageTTL Loads
4 4.5 - 0.26 - 0.33 - 0.4 V
Input Leakage Current II VCCandGND
- 5.5 - ±0.1 - ±1 - ±1 µA
Quiescent DeviceCurrent
ICC VCC orGND
0 5.5 - 2 - 20 - 40 µA
Additional QuiescentDevice Current Per InputPin: 1 Unit Load
∆ICC(Note 4)
VCC- 2.1
- 4.5 to5.5
- 360 - 450 - 490 µA
NOTE:
4. For dual-supply systems theoretical worst case (VI = 2.4V, VCC = 5.5V) specification is 1.8mA.
DC Electrical Specifications (Continued)
PARAMETER SYMBOL
TESTCONDITIONS
VCC (V)
25oC -40oC TO 85oC -55oC TO 125oC
UNITSVI (V) IO (mA) MIN MAX MIN MAX MIN MAX
HCT Input Loading Table
INPUT UNIT LOADS
nA 0.6
NOTE: Unit Load is ∆ICC limit specified in DC Electrical Specifica-tions table, e.g., 360µA max at 25oC.
CD74HC14, CD74HCT14
5
Switching Specifications Input tr, tf = 6ns
PARAMETER SYMBOLTEST
CONDITIONSVCC(V)
25oC -40oC TO 85oC -55oC TO 125oC
UNITSMIN TYP MAX MIN MAX MIN MAX
HC TYPES
Propagation Delay,A to Y
tPLH, tPHL CL = 50pF 2 - - 135 - 170 - 205 ns
CL = 50pF 4.5 - - 27 - 34 - 41 ns
CL = 15pF 5 - 11 - - - - - ns
CL = 50pF 6 - - 23 - 29 - 35 ns
Output Transition Times tTLH, tTHL CL = 50pF 2 - - 75 - 95 18 110 ns
4.5 - - 15 - 19 - 22 ns
6 - - 13 - 16 - 19 ns
Input Capacitance CI - - - - 10 - 10 - 10 pF
Power Dissipation Capacitance(Notes 5, 6)
CPD - 5 - 20 - - - - - pF
HCT TYPES
Propagation Delay,A to Y
tPLH, tPHL CL = 50pF 4.5 - - 38 - 48 - 57 ns
CL = 15pF 5 - 16 - - - - - ns
Output Transition Times tTLH, tTHL CL = 50pF 4.5 - - 15 - 19 - 22 ns
Input Capacitance CI - - - - 10 - 10 - 10 pF
Power Dissipation Capacitance(Notes 5, 6)
CPD - 5 - 20 - - - - - pF
NOTES:
5. CPD is used to determine the dynamic power consumption, per inverter.
6. PD = VCC2 fi (CPD + CL) where fi = input frequency, CL = output load capacitance, VCC = supply voltage.
Test Circuits and Waveforms
FIGURE 4. HC TRANSITION TIMES AND PROPAGATIONDELAY TIMES, COMBINATION LOGIC
FIGURE 5. HCT TRANSITION TIMES AND PROPAGATIONDELAY TIMES, COMBINATION LOGIC
tPHL tPLH
tTHL tTLH
90%50%10%
50%10%INVERTING
OUTPUT
INPUT
GND
VCC
tr = 6ns t f = 6ns
90%
tPHL tPLH
tTHL tTLH
2.7V1.3V0.3V
1.3V10%INVERTING
OUTPUT
INPUT
GND
3V
tr = 6ns tf = 6ns
90%
CD74HC14, CD74HCT14
LM555/LM555CTimerGeneral DescriptionThe LM555 is a highly stable device for generating accuratetime delays or oscillation. Additional terminals are providedfor triggering or resetting if desired. In the time delay mode ofoperation, the time is precisely controlled by one external re-sistor and capacitor. For astable operation as an oscillator,the free running frequency and duty cycle are accuratelycontrolled with two external resistors and one capacitor. Thecircuit may be triggered and reset on falling waveforms, andthe output circuit can source or sink up to 200 mA or driveTTL circuits.
Featuresn Direct replacement for SE555/NE555n Timing from microseconds through hoursn Operates in both astable and monostable modesn Adjustable duty cyclen Output can source or sink 200 mAn Output and supply TTL compatiblen Temperature stability better than 0.005% per ˚Cn Normally on and normally off outputn Available in 8 pin MSOP package
Applicationsn Precision timingn Pulse generationn Sequential timingn Time delay generationn Pulse width modulationn Pulse position modulationn Linear ramp generator
Schematic Diagram
DS007851-1
May 1997
LM555/LM
555CTim
er
© 1997 National Semiconductor Corporation DS007851 www.national.com
Absolute Maximum Ratings (Note 2)
If Military/Aerospace specified devices are required,please contact the National Semiconductor Sales Office/Distributors for availability and specifications.
Supply Voltage +18VPower Dissipation (Note 3)LM555H, LM555CH 760 mWLM555, LM555CN 1180 mWLM555CMM 613 mW
Operating Temperature RangesLM555C 0˚C to +70˚CLM555 −55˚C to + 125˚C
Storage Temperature Range −65˚C to +150˚CSoldering InformationDual-In-Line PackageSoldering (10 Seconds) 260˚C
Small Outline Packages(SOIC and MSOP)Vapor Phase (60 Seconds) 215˚CInfrared (15 Seconds) 220˚C
See AN-450 “Surface Mounting Methods and Their Effecton Product Reliability” for other methods of solderingsurface mount devices.
Electrical Characteristics (Notes 1, 2)
(TA = 25˚C, VCC = +5V to +15V, unless othewise specified)
Limits
Parameter Conditions LM555 LM555C Units
Min Typ Max Min Typ Max
Supply Voltage 4.5 18 4.5 16 V
Supply Current VCC = 5V, RL = ∞ 3 5 3 6 mA
VCC = 15V, RL = ∞ 10 12 10 15 mA
(Low State) (Note 4)
Timing Error, Monostable
Initial Accuracy 0.5 1 %
Drift with Temperature RA = 1k to 100 kΩ, 30 50 ppm/˚C
C = 0.1 µF, (Note 5)
Accuracy over Temperature 1.5 1.5 %
Drift with Supply 0.05 0.1 %/V
Timing Error, Astable
Initial Accuracy 1.5 2.25 %
Drift with Temperature RA, RB = 1k to 100 kΩ, 90 150 ppm/˚C
C = 0.1 µF, (Note 5)
Accuracy over Temperature 2.5 3.0 %
Drift with Supply 0.15 0.30 %/V
Threshold Voltage 0.667 0.667 x VCCTrigger Voltage VCC = 15V 4.8 5 5.2 5 V
VCC = 5V 1.45 1.67 1.9 1.67 V
Trigger Current 0.01 0.5 0.5 0.9 µA
Reset Voltage 0.4 0.5 1 0.4 0.5 1 V
Reset Current 0.1 0.4 0.1 0.4 mA
Threshold Current (Note 6) 0.1 0.25 0.1 0.25 µA
Control Voltage Level VCC = 15V 9.6 10 10.4 9 10 11 V
VCC = 5V 2.9 3.33 3.8 2.6 3.33 4 V
Pin 7 Leakage Output High 1 100 1 100 nA
Pin 7 Sat (Note 7)
Output Low VCC = 15V, I7 = 15 mA 150 180 mV
Output Low VCC = 4.5V, I7 = 4.5 mA 70 100 80 200 mV
www.national.com 2
Electrical Characteristics (Notes 1, 2) (Continued)
(TA = 25˚C, VCC = +5V to +15V, unless othewise specified)
Limits
Parameter Conditions LM555 LM555C Units
Min Typ Max Min Typ Max
Output Voltage Drop (Low) VCC = 15V
ISINK = 10 mA 0.1 0.15 0.1 0.25 V
ISINK = 50 mA 0.4 0.5 0.4 0.75 V
ISINK = 100 mA 2 2.2 2 2.5 V
ISINK = 200 mA 2.5 2.5 V
VCC = 5V
ISINK = 8 mA 0.1 0.25 V
ISINK = 5 mA 0.25 0.35 V
Output Voltage Drop (High) ISOURCE = 200 mA, VCC = 15V 12.5 12.5 V
ISOURCE = 100 mA, VCC = 15V 13 13.3 12.75 13.3 V
VCC = 5V 3 3.3 2.75 3.3 V
Rise Time of Output 100 100 ns
Fall Time of Output 100 100 ns
Note 1: All voltages are measured with respect to the ground pin, unless otherwise specified.
Note 2: Absolute Maximum Ratings indicate limits beyond which damage to the device may occur. Operating Ratings indicate conditions for which the device is func-tional, but do not guarantee specific performance limits. Electrical Characteristics state DC andAC electrical specifications under particular test conditions which guar-antee specific performance limits. This assumes that the device is within the Operating Ratings. Specifications are not guaranteed for parameters where no limit isgiven, however, the typical value is a good indication of device performance.
Note 3: For operating at elevated temperatures the device must be derated above 25˚C based on a +150˚C maximum junction temperature and a thermal resistanceof 164˚C/W (T0-5), 106˚C/W (DIP), 170˚C/W (S0-8), and 204˚C/W (MSOP) junction to ambient.
Note 4: Supply current when output high typically 1 mA less at VCC = 5V.
Note 5: Tested at VCC = 5V and VCC = 15V.
Note 6: This will determine the maximum value of RA + RB for 15V operation. The maximum total (RA + RB) is 20 MΩ.
Note 7: No protection against excessive pin 7 current is necessary providing the package dissipation rating will not be exceeded.
Note 8: Refer to RETS555X drawing of military LM555H and LM555J versions for specifications.
Connection Diagrams
Metal Can Package
DS007851-2
Top ViewOrder Number LM555H or LM555CHSee NS Package Number H08C
Dual-In-Line, Small Outlineand Molded Mini Small Outline Packages
DS007851-3
Top ViewOrder Number LM555J, LM555CJ,LM555CM, LM555CMM or LM555CN
See NS Package Number J08A, M08A, MUA08A orN08E
3 www.national.com
Typical Performance Characteristics
Minimuim Pulse WidthRequired for Triggering
DS007851-4
Supply Current vsSupply Voltage
DS007851-19
High Output Voltage vsOutput Source Current
DS007851-20
Low Output Voltage vsOutput Sink Current
DS007851-21
Low Output Voltage vsOutput Sink Current
DS007851-22
Low Output Voltage vsOutput Sink Current
DS007851-23
Output Propagation Delay vsVoltage Level of Trigger Pulse
DS007851-24
Output Propagation Delay vsVoltage Level of Trigger Pulse
DS007851-25
Discharge Transistor (Pin 7)Voltage vs Sink Current
DS007851-26
www.national.com 4
Typical Performance Characteristics (Continued)
Applications InformationMONOSTABLE OPERATION
In this mode of operation, the timer functions as a one-shot(Figure 1). The external capacitor is initially held dischargedby a transistor inside the timer. Upon application of a nega-tive trigger pulse of less than 1/3 VCC to pin 2, the flip-flop isset which both releases the short circuit across the capacitorand drives the output high.
The voltage across the capacitor then increases exponen-tially for a period of t = 1.1 RA C, at the end of which time thevoltage equals 2/3 VCC. The comparator then resets theflip-flop which in turn discharges the capacitor and drives theoutput to its low state. Figure 2 shows the waveforms gener-ated in this mode of operation. Since the charge and thethreshold level of the comparator are both directly propor-tional to supply voltage, the timing internal is independent ofsupply.
During the timing cycle when the output is high, the furtherapplication of a trigger pulse will not effect the circuit so longas the trigger input is returned high at least 10 µs before theend of the timing interval. However the circuit can be resetduring this time by the application of a negative pulse to thereset terminal (pin 4). The output will then remain in the lowstate until a trigger pulse is again applied.
When the reset function is not in use, it is recommended thatit be connected to VCC to avoid any possibility of false trig-gering.
Figure 3 is a nomograph for easy determination of R, C val-ues for various time delays.
NOTE: In monostable operation, the trigger should be drivenhigh before the end of timing cycle.
Discharge Transistor (Pin 7)Voltage vs Sink Current
DS007851-27
DS007851-5
FIGURE 1. Monostable
DS007851-6
VCC = 5V Top Trace: Input 5V/Div.TIME = 0.1 ms/DIV. Middle Trace: Output 5V/Div.RA = 9.1 kΩ Bottom Trace: Capacitor Voltage 2V/Div.C = 0.01 µF
FIGURE 2. Monostable Waveforms
5 www.national.com
Applications Information (Continued)
ASTABLE OPERATION
If the circuit is connected as shown in Figure 4 (pins 2 and 6connected) it will trigger itself and free run as a multivibrator.The external capacitor charges through RA + RB and dis-charges through RB. Thus the duty cycle may be preciselyset by the ratio of these two resistors.
In this mode of operation, the capacitor charges and dis-charges between 1/3 VCC and 2/3 VCC. As in the triggeredmode, the charge and discharge times, and therefore the fre-quency are independent of the supply voltage.
Figure 5 shows the waveforms generated in this mode ofoperation.
The charge time (output high) is given by:
t1 = 0.693 (RA + RB) C
And the discharge time (output low) by:
t2 = 0.693 (RB) C
Thus the total period is:
T = t1 + t2 = 0.693 (RA +2RB) C
The frequency of oscillation is:
Figure 6 may be used for quick determination of these RCvalues.
The duty cycle is:
FREQUENCY DIVIDER
The monostable circuit of Figure 1 can be used as a fre-quency divider by adjusting the length of the timing cycle.Figure 7 shows the waveforms generated in a divide by threecircuit.
DS007851-7
FIGURE 3. Time Delay
DS007851-8
FIGURE 4. Astable
DS007851-9
VCC = 5V Top Trace: Output 5V/Div.TIME = 20 µs/DIV. Bottom Trace: Capacitor Voltage 1V/Div.RA = 3.9 kΩRB = 3 kΩC = 0.01 µF
FIGURE 5. Astable Waveforms
DS007851-10
FIGURE 6. Free Running Frequency
www.national.com 6
Applications Information (Continued)
PULSE WIDTH MODULATOR
When the timer is connected in the monostable mode andtriggered with a continuous pulse train, the output pulsewidth can be modulated by a signal applied to pin 5. Figure8 shows the circuit, and in Figure 9 are some waveformexamples.
PULSE POSITION MODULATOR
This application uses the timer connected for astable opera-tion, as in Figure 10, with a modulating signal again appliedto the control voltage terminal. The pulse position varies with
the modulating signal, since the threshold voltage and hencethe time delay is varied. Figure 11 shows the waveformsgenerated for a triangle wave modulation signal.
LINEAR RAMP
When the pullup resistor, RA, in the monostable circuit is re-placed by a constant current source, a linear ramp is gener-ated. Figure 12 shows a circuit configuration that will performthis function.
DS007851-11
VCC = 5V Top Trace: Input 4V/Div.TIME = 20 µs/DIV. Middle Trace: Output 2V/Div.RA = 9.1 kΩ Bottom Trace: Capacitor 2V/Div.C = 0.01 µF
FIGURE 7. Frequency Divider
DS007851-12
FIGURE 8. Pulse Width Modulator
DS007851-13
VCC = 5V Top Trace: Modulation 1V/Div.TIME = 0.2 ms/DIV. Bottom Trace: Output Voltage 2V/Div.RA = 9.1 kΩC = 0.01 µF
FIGURE 9. Pulse Width Modulator
DS007851-14
FIGURE 10. Pulse Position Modulator
DS007851-15
VCC = 5V Top Trace: Modulation Input 1V/Div.TIME = 0.1 ms/DIV. Bottom Trace: Output 2V/Div.RA = 3.9 kΩRB = 3 kΩC = 0.01 µF
FIGURE 11. Pulse Position Modulator
DS007851-16
FIGURE 12.
7 www.national.com
Applications Information (Continued)
Figure 13 shows waveforms generated by the linear ramp.
The time interval is given by:
VBE ≅ 0.6V
50% DUTY CYCLE OSCILLATOR
For a 50% duty cycle, the resistors RA and RB may be con-nected as in Figure 14. The time period for the output high isthe same as previous, t1 = 0.693 RA C. For the output low itis t2 =
Thus the frequency of oscillation is
Note that this circuit will not oscillate if RB is greater than 1/2RA because the junction of RA and RB cannot bring pin 2down to 1/3 VCC and trigger the lower comparator.
ADDITIONAL INFORMATION
Adequate power supply bypassing is necessary to protectassociated circuitry. Minimum recommended is 0.1 µF in par-allel with 1 µF electrolytic.
Lower comparator storage time can be as long as 10 µswhen pin 2 is driven fully to ground for triggering. This limitsthe monostable pulse width to 10 µs minimum.
Delay time reset to output is 0.47 µs typical. Minimum resetpulse width must be 0.3 µs, typical.
Pin 7 current switches within 30 ns of the output (pin 3) volt-age.
DS007851-17
VCC = 5V Top Trace: Input 3V/Div.TIME = 20 µs/DIV. Middle Trace: Output 5V/Div.R1 = 47 kΩ Bottom Trace: Capacitor Voltage 1V/Div.R2 = 100 kΩRE = 2.7 kΩC = 0.01 µF
FIGURE 13. Linear Ramp
DS007851-18
FIGURE 14. 50% Duty Cycle Oscillator
www.national.com 8
Physical Dimensions inches (millimeters)
Metal Can Package (H)Order Number LM555H or LM555CH
NS Package Number H08C
Ceramic Dual-In-Line Package (J)Order Number LM555J or LM555CJ
NS Package Number J08A
9 www.national.com
Physical Dimensions inches (millimeters) (Continued)
Small Outline Package (M)Order Number LM555CMNS Package Number M08A
www.national.com 10
Physical Dimensions inches (millimeters) (Continued)
8-Lead (0.118” Wide) Molded Mini Small Outline PackageOrder Number LM555CMM
NS Package Number MUA08A
11 www.national.com
Physical Dimensions inches (millimeters) (Continued)
LIFE SUPPORT POLICY
NATIONAL’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DE-VICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT OF NATIONAL SEMI-CONDUCTOR CORPORATION. As used herein:1. Life support devices or systems are devices or sys-
tems which, (a) are intended for surgical implant intothe body, or (b) support or sustain life, and whose fail-ure to perform when properly used in accordancewith instructions for use provided in the labeling, canbe reasonably expected to result in a significant injuryto the user.
2. A critical component in any component of a life supportdevice or system whose failure to perform can be rea-sonably expected to cause the failure of the life supportdevice or system, or to affect its safety or effectiveness.
National SemiconductorCorporation1111 West Bardin RoadArlington, TX 76017Tel: 1(800) 272-9959Fax: 1(800) 737-7018
www.national.com
National SemiconductorEurope
Fax: (+49) 0-180-530 85 86Email: [email protected]
Deutsch Tel: (+49) 0-180-530 85 85English Tel: (+49) 0-180-532 78 32Français Tel: (+49) 0-180-532 93 58Italiano Tel: (+49) 0-180-534 16 80
National SemiconductorHong Kong Ltd.13th Floor, Straight Block,Ocean Centre, 5 Canton Rd.Tsimshatsui, KowloonHong KongTel: (852) 2737-1600Fax: (852) 2736-9960
National SemiconductorJapan Ltd.Tel: 81-043-299-2308Fax: 81-043-299-2408
Molded Dual-In-Line Package (N)Order Number LM555CNNS Package Number N08E
LM555/LM
555C
Timer
National does not assume any responsibility for use of any circuitry described, no circuit patent licenses are implied and National reserves the right at any time without notice to change said circuitry and specifications.
TL/H/7746
LM
78X
XSerie
sV
olta
ge
Regula
tors
February 1995
LM78XX Series Voltage Regulators
General DescriptionThe LM78XX series of three terminal regulators is available
with several fixed output voltages making them useful in a
wide range of applications. One of these is local on card
regulation, eliminating the distribution problems associated
with single point regulation. The voltages available allow
these regulators to be used in logic systems, instrumenta-
tion, HiFi, and other solid state electronic equipment. Al-
though designed primarily as fixed voltage regulators these
devices can be used with external components to obtain
adjustable voltages and currents.
The LM78XX series is available in an aluminum TO-3 pack-
age which will allow over 1.0A load current if adequate heat
sinking is provided. Current limiting is included to limit the
peak output current to a safe value. Safe area protection for
the output transistor is provided to limit internal power dissi-
pation. If internal power dissipation becomes too high for
the heat sinking provided, the thermal shutdown circuit
takes over preventing the IC from overheating.
Considerable effort was expanded to make the LM78XX se-
ries of regulators easy to use and mininize the number
of external components. It is not necessary to bypass the
output, although this does improve transient response. Input
bypassing is needed only if the regulator is located far from
the filter capacitor of the power supply.
For output voltage other than 5V, 12V and 15V the LM117
series provides an output voltage range from 1.2V to 57V.
FeaturesY Output current in excess of 1AY Internal thermal overload protectionY No external components requiredY Output transistor safe area protectionY Internal short circuit current limitY Available in the aluminum TO-3 package
Voltage RangeLM7805C 5V
LM7812C 12V
LM7815C 15V
Schematic and Connection Diagrams
TL/H/7746–1
Metal Can Package
TO-3 (K)
Aluminum
TL/H/7746–2
Bottom View
Order Number LM7805CK,
LM7812CK or LM7815CK
See NS Package Number KC02A
Plastic Package
TO-220 (T)
TL/H/7746–3
Top View
Order Number LM7805CT,
LM7812CT or LM7815CT
See NS Package Number T03B
C1995 National Semiconductor Corporation RRD-B30M115/Printed in U. S. A.
Absolute Maximum RatingsIf Military/Aerospace specified devices are required,
please contact the National Semiconductor Sales
Office/Distributors for availability and specifications.
Input Voltage (VO e 5V, 12V and 15V) 35V
Internal Power Dissipation (Note 1) Internally Limited
Operating Temperature Range (TA) 0§C to a70§C
Maximum Junction Temperature
(K Package) 150§C(T Package) 150§C
Storage Temperature Range b65§C to a150§CLead Temperature (Soldering, 10 sec.)
TO-3 Package K 300§CTO-220 Package T 230§C
Electrical Characteristics LM78XXC (Note 2) 0§C s Tj s 125§C unless otherwise noted.
Output Voltage 5V 12V 15V
Input Voltage (unless otherwise noted) 10V 19V 23V Units
Symbol Parameter Conditions Min Typ Max Min Typ Max Min Typ Max
VO Output Voltage Tj e 25§C, 5 mA s IO s 1A 4.8 5 5.2 11.5 12 12.5 14.4 15 15.6 V
PD s 15W, 5 mA s IO s 1A 4.75 5.25 11.4 12.6 14.25 15.75 V
VMIN s VIN s VMAX (7.5 s VIN s 20) (14.5 s VIN s 27) (17.5 s VIN s 30) V
DVO Line Regulation IO e 500 mA Tj e 25§C 3 50 4 120 4 150 mV
DVIN (7 s VIN s 25) 14.5 s VIN s 30) (17.5 s VIN s 30) V
0§C s Tj s a125§C 50 120 150 mV
DVIN (8 s VIN s 20) (15 s VIN s 27) (18.5 s VIN s 30) V
IO s 1A Tj e 25§C 50 120 150 mV
DVIN (7.5 s VIN s 20) (14.6 s VIN s 27) (17.7 s VIN s 30) V
0§C s Tj s a125§C 25 60 75 mV
DVIN (8 s VIN s 12) (16 s VIN s 22) (20 s VIN s 26) V
DVO Load Regulation Tj e 25§C 5 mA s IO s 1.5A 10 50 12 120 12 150 mV
250 mA s IO s 750 mA 25 60 75 mV
5 mA s IO s 1A, 0§C s Tj s a125§C 50 120 150 mV
IQ Quiescent Current IO s 1A Tj e 25§C 8 8 8 mA
0§C s Tj s a125§C 8.5 8.5 8.5 mA
DIQ Quiescent Current 5 mA s IO s 1A 0.5 0.5 0.5 mA
ChangeTj e 25§C, IO s 1A 1.0 1.0 1.0 mA
VMIN s VIN s VMAX (7.5 s VIN s 20) (14.8 s VINs 27) (17.9 s VIN s 30) V
IO s 500 mA, 0§C s Tj s a125§C 1.0 1.0 1.0 mA
VMIN s VIN s VMAX (7 s VIN s 25) (14.5 s VINs 30) (17.5 s VIN s 30) V
VN Output Noise Voltage TA e25§C, 10 Hz s f s 100 kHz 40 75 90 mV
DVIN
DVOUT
Ripple Rejection IO s 1A, Tj e 25§C or 62 80 55 72 54 70 dB
f e 120 Hz IO s 500 mA 62 55 54 dBÐ 0§C s Tj s a125§CVMIN s VIN s VMAX (8 s VIN s 18) (15 s VIN s 25) (18.5 s VIN s 28.5) V
RO Dropout Voltage Tj e 25§C, IOUT e 1A 2.0 2.0 2.0 V
Output Resistance f e 1 kHz 8 18 19 mX
Short-Circuit Current Tj e 25§C 2.1 1.5 1.2 A
Peak Output Current Tj e 25§C 2.4 2.4 2.4 A
Average TC of VOUT 0§C s Tj s a125§C, IO e 5 mA 0.6 1.5 1.8 mV/§C
VIN Input Voltage
Required to Maintain Tj e 25§C, IO s 1A 7.5 14.6 17.7 V
Line Regulation
Note 1: Thermal resistance of the TO-3 package (K, KC) is typically 4§C/W junction to case and 35§C/W case to ambient. Thermal resistance of the TO-220
package (T) is typically 4§C/W junction to case and 50§C/W case to ambient.
Note 2: All characteristics are measured with capacitor across the input of 0.22 mF, and a capacitor across the output of 0.1mF. All characteristics except noise
voltage and ripple rejection ratio are measured using pulse techniques (tw s 10 ms, duty cycle s 5%). Output voltage changes due to changes in internal
temperature must be taken into account separately.
2
Typical Performance Characteristics
Dissipation
Maximum Average Power
Dissipation
Maximum Average Power
Peak Output Current
to 1V at Tj e 25§C)
Output Voltage (Normalized
Ripple Rejection Ripple Rejection
Output Impedance Dropout Voltage Dropout Characteristics
Quiescent Current Quiescent Current
TL/H/7746–4
3
Physical Dimensions inches (millimeters)
Aluminum Metal Can Package (KC)
Order Number LM7805CK, LM7812CK or LM7815CK
NS Package Number KC02A
5
LM
78X
XSeries
Voltage
Regula
tors
Physical Dimensions inches (millimeters) (Continued)
TO-220 Package (T)
Order Number LM7805CT, LM7812CT or LM7815CT
NS Package Number T03B
LIFE SUPPORT POLICY
NATIONAL’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT
DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT OF NATIONAL
SEMICONDUCTOR CORPORATION. As used herein:
1. Life support devices or systems are devices or 2. A critical component is any component of a life
systems which, (a) are intended for surgical implant support device or system whose failure to perform can
into the body, or (b) support or sustain life, and whose be reasonably expected to cause the failure of the life
failure to perform, when properly used in accordance support device or system, or to affect its safety or
with instructions for use provided in the labeling, can effectiveness.
be reasonably expected to result in a significant injury
to the user.
National Semiconductor National Semiconductor National Semiconductor National SemiconductorCorporation Europe Hong Kong Ltd. Japan Ltd.1111 West Bardin Road Fax: (a49) 0-180-530 85 86 13th Floor, Straight Block, Tel: 81-043-299-2309Arlington, TX 76017 Email: cnjwge@ tevm2.nsc.com Ocean Centre, 5 Canton Rd. Fax: 81-043-299-2408Tel: 1(800) 272-9959 Deutsch Tel: (a49) 0-180-530 85 85 Tsimshatsui, KowloonFax: 1(800) 737-7018 English Tel: (a49) 0-180-532 78 32 Hong Kong
Fran3ais Tel: (a49) 0-180-532 93 58 Tel: (852) 2737-1600Italiano Tel: (a49) 0-180-534 16 80 Fax: (852) 2736-9960
National does not assume any responsibility for use of any circuitry described, no circuit patent licenses are implied and National reserves the right at any time without notice to change said circuitry and specifications.
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
403April 15, 1992 853-0124 06456
DESCRIPTIONThe NE/SE567 tone and frequency decoder is a highly stablephase-locked loop with synchronous AM lock detection and poweroutput circuitry. Its primary function is to drive a load whenever asustained frequency within its detection band is present at theself-biased input. The bandwidth center frequency and output delayare independently determined by means of four externalcomponents.
FEATURES• Wide frequency range (.01Hz to 500kHz)
• High stability of center frequency
• Independently controllable bandwidth (up to 14%)
• High out-band signal and noise rejection
• Logic-compatible output with 100mA current sinking capability
• Inherent immunity to false signals
• Frequency adjustment over a 20-to-1 range with an externalresistor
• Military processing available
APPLICATIONS• Touch-Tone decoding
• Carrier current remote controls
• Ultrasonic controls (remote TV, etc.)
• Communications paging
PIN CONFIGURATIONS
FE, D, N Packages
F Package
1
2
3
4 5
6
7
8
1
2
3
4
5
6
7 8
14
13
12
11
10
9
OUTPUT FILTERCAPACITOR C3
LOW-PASS FILTERCAPACITOR C2
INPUT
SUPPLY VOLTAGE V+
OUTPUT
GROUNDTIMINGELEMENTS R1AND C1TIMING ELEMENT R1
OUTPUT
C3
NC
C2
INPUT
NC
VCC
GND
NC
NC
R1C1
R1
NC
NC
TOP VIEW
TOP VIEW
• Frequency monitoring and control
• Wireless intercom
• Precision oscillator
BLOCK DIAGRAM
Touch-Tone is a registered trademark of AT&T.
INPUTV1
PHASEDETECTOR
CURRENTCONTROLLEDOSCILLATOR
QUADRATUREPHASE
DETECTOR
AMP
AMP
LOOPLOWPASS
FILTER
3
5
6
7 1
8
2
4
3.9k
+
–
+V
FILTER
C1
R1
R2
R3
RLVREF
C2
C3 OUTPUT
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 404
EQUIVALENT SCHEMATIC
–V4 R5
Q1
5
R1 6
C1
Q2
7
Q8
Q3
R6 Q
10D
R7 Q
12
Q13 –V Q
6
Q7
A
Q9
R4
Q5
R9
Q14
Q16
Q17
Q19
B
R19
R12
Q22
–V
R15
Q25
Q24
Q26
Q27
Q28
Q29
B
R18
R10
R11
–V
R20
R13
EF
Q23
Q30
B
R14
R16
R17
R23
R24
R21
R2
10k
Q20
R26
Q21
R22
A
Q34
R29
3
C Vi
2
C2 –V
Q35
R30
R26
R27Q
33
Q36
Q37
R36Q
50
R37Q
62V
ref Q
59
R40
F
E
R32
R48
21k
R48
21k
Q40
C
Q30
Q38
R36
R34
Q61
R36
Q16
Q18
Q31
B
R28
Q40
R33
R39
5k
R41 Q
63 Q55
R48
Q60
C
R43 Q
47Q
46Q
45Q
44
Q43
Q42 Q
41B
R44
Q62
Q61
R45
B
RL–V
R49
C3
1
R3
4.7k
R42 Q54
Q57
Q56
Q58
Q32
c
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 405
ORDERING INFORMATIONDESCRIPTION TEMPERATURE RANGE ORDER CODE DWG #
8-Pin Plastic SO 0 to +70°C NE567D 0174C
14-Pin Cerdip 0 to +70°C NE567F 0581B
8-Pin Plastic DIP 0 to +70°C NE567N 0404B
8-Pin Plastic SO -55°C to +125°C SE567D 0174C
8-Pin Cerdip -55°C to +125°C SE567FE 0581B
8-Pin Plastic DIP -55°C to +125°C SE567N 0404B
ABSOLUTE MAXIMUM RATINGSSYMBOL PARAMETER RATING UNIT
TA Operating temperature
NE567 0 to +70 °CSE567 -55 to +125 °C
VCC Operating voltage 10 V
V+ Positive voltage at input 0.5 +VS V
V- Negative voltage at input -10 VDC
VOUT Output voltage (collector of output transistor) 15 VDC
TSTG Storage temperature range -65 to +150 °CPD Power dissipation 300 mW
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 406
DC ELECTRICAL CHARACTERISTICSV +=5.0V; TA=25°C, unless otherwise specified.
SYM-BOL
PARAMETER TEST CONDITIONS SE567 NE567 UNIT
Min Typ Max Min Typ Max
Center frequency 1
fO Highest center frequency 500 500 kHz
fO Center frequency stability2 -55 to +125°C 35 ±140 35 ±140 ppm/°C0 to +70°C 35 ±60 35 ±60 ppm/°C
fO Center frequency distributionfO 100kHz 1
1.1R1C1
-10 0 +10 -10 0 +10 %
fO Center frequency shift with supplyvoltage fO 100kHz 1
1.1R1C1
0.5 1 0.7 2 %/V
Detection bandwidthBW Largest detection bandwidth
fO 100kHz 11.1R1C1
12 14 16 10 14 18 % of fO
BW Largest detection bandwidth skew 2 4 3 6 % of fOBW Largest detection bandwidth— VI=300mVRMS ±0.1 ±0.1 %/°C
variation with temperature
BW Largest detection bandwidth— VI=300mVRMS ±2 ±2 %/V
variation with supply voltage
InputRIN Input resistance 15 20 25 15 20 25 kΩVI Smallest detectable input voltage4 IL=100mA, fI=fO 20 25 20 25 mVRMS
Largest no-output input voltage4 IL=100mA, fI=fO 10 15 10 15 mVRMS
Greatest simultaneous out-band +6 +6 dB
signal-to-in-band signal ratio
Minimum input signal to wide-bandnoise ratio
Bn=140kHz -6 -6 dB
OutputFastest on-off cycling rate fO/20 fO/20
“1” output leakage current V8=15V 0.01 25 0.01 25 µA
“0” output voltage IL=30mA 0.2 0.4 0.2 0.4 V
IL=100mA 0.6 1.0 0.6 1.0 V
tF Output fall time3 RL=50Ω 30 30 ns
tR Output rise time3 RL=50Ω 150 150 ns
General
VCC Operating voltage range 4.75 9.0 4.75 9.0 V
Supply current quiescent 6 8 7 10 mA
Supply current—activated RL=20kΩ 11 13 12 15 mA
tPD Quiescent power dissipation 30 35 mW
NOTES:1. Frequency determining resistor R1 should be between 2 and 20kΩ2. Applicable over 4.75V to 5.75V. See graphs for more detailed information.3. Pin 8 to Pin 1 feedback RL network selected to eliminate pulsing during turn-on and turn-off.4. With R2=130kΩ from Pin 1 to V+. See Figure 1.
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 407
TYPICAL PERFORMANCE CHARACTERISTICS
Bandwidth vs InputSignal Amplitude
Largest Detection bandwidthvs Operating Frequency
Detection bandwidth as aFunction of C 2 and C3
Typical Supply Current vsSupply Voltage
Greatest Number of CyclesBefore Output
Typical Output Voltage vsTemperature
Typical Frequency DriftWith Temperature
(Mean and SD)
Typical Frequency DriftWith Temperature
(Mean and SD)
Typical Frequency DriftWith Temperature
(Mean and SD)
300
250
200
150
100
50
00 2 4 6 8 10 12 14 16
INP
UT
VO
LTA
GE
— m
Vrm
s
BANDWIDTH — % OF fO CENTER FREQUENCY — kHz
LAR
GE
ST
BA
ND
WID
TH
— %
OF
f
15
10
5
0
0.1 1 10 100 1000
O
BANDWIDTH — % OF fO
0 2 4 6 8 10 12 14 16
106
C3C2
105
104
103
25
20
15
10
5
0
4 5 6 7 8 9 10
SUPPLY VOLTAGE — V
CU
PP
LY C
UR
RE
NT
— m
A
QUIESCENTCURRENT
NO LOAD “ON” CURRENT
1.5
1.0
0.5
0
–0.5
–1.0
–1.5
–75 –25 0 25 75 125
TEMPERATURE — °C TEMPERATURE — °C TEMPERATURE — °C
+V = 4.75V1.5
1.0
0.5
0
–0.5
–1.0
–1.5–75 –25 0 25 75 125
+V = 5.75V5.5
2.5
0
–2.5
–5.0
–7.5
–10
–75 –25 0 25 75 125
(2)
(1)
+V = 7.0V (1)
+V = 9.0V (2)
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
–75 –25 0 25 75 125
TEMPERATURE — °C
OU
TP
UT
VO
LTA
GE
PIN
8 —
V
IL = 100mA
IL = 30mA
1000
500
300
100
50
30
10
CY
CLE
S
BANDWIDTH — % OF fO
1 5 10 50 100
BANDWIDTH LIMITED BYEXTERNAL RESISTOR
(MINIMUM C2)
BANDWIDTHLIMITED BY (C2)
(Hz
*
F)
µ
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 408
TYPICAL PERFORMANCE CHARACTERISTICS (Continued)
Center Frequency TemperatureCoefficient
(Mean and SD)
Center FrequencyShift With Supply
Voltage Change vsOperating Frequency
Typical Bandwidth VariationTemperature
100
0
–100
–200
–3004.5 5.0 5.5 6.0 6.5 7.0
SUPPLY VOLTAGE — V
TE
MP
ER
AT
UR
E C
OE
FF
ICIE
NT
— p
pm/
C °
∆t = 0°C to 70°C
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
01 2 3 4 5 10 20 40 100
CENTER FREQUENCY — kHz
tOtO V % V
15.0
12.5
10.0
7.5
5.0
2.5
0
–75 –25 0 25 75 125
TEMPERATURE – °C
BANDWIDTH AT 25 °C
2
4
6
8
10
12
14
BA
ND
WID
TH
— %
OF
fO
DESIGN FORMULAS
fO 1
1.1R1 C1
BW 1070VI
fO C2 in % of fO
VI 200mVRMS
WhereVI=Input voltage (VRMS)C2=Low-pass filter capacitor (µF)
PHASE-LOCKED LOOP TERMINOLOGY CENTERFREQUENCY (fO)The free-running frequency of the current controlled oscillator (CCO)in the absence of an input signal.
Detection Bandwidth (BW)The frequency range, centered about fO, within which an input signalabove the threshold voltage (typically 20mVRMS) will cause a logicalzero state on the output. The detection bandwidth corresponds tothe loop capture range.
Lock RangeThe largest frequency range within which an input signal above thethreshold voltage will hold a logical zero state on the output.
Detection Band SkewA measure of how well the detection band is centered about thecenter frequency, fO. The skew is defined as (fMAX+fMIN-2fO)/2fOwhere fmax and fmin are the frequencies corresponding to theedges of the detection band. The skew can be reduced to zero ifnecessary by means of an optional centering adjustment.
OPERATING INSTRUCTIONSFigure 1 shows a typical connection diagram for the 567. For mostapplications, the following three-step procedure will be sufficient forchoosing the external components R1, C1, C2 and C3.1. Select R1 and C1 for the desired center frequency. For best
temperature stability, R1 should be between 2K and 20K ohm,and the combined temperature coefficient of the R1C1 productshould have sufficient stability over the projected temperaturerange to meet the necessary requirements.
2. Select the low-pass capacitor, C2, by referring to the Bandwidthversus Input Signal Amplitude graph. If the input amplitudeVariation is known, the appropriate value of fO ⋅ C2 necessary togive the desired bandwidth may be found. Conversely, an area ofoperation may be selected on this graph and the input level andC2 may be adjusted accordingly. For example, constantbandwidth operation requires that input amplitude be above200mVRMS. The bandwidth, as noted on the graph, is thencontrolled solely by the fO ⋅ C2 product (fO (Hz), C2(µF)).
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 409
TYPICAL RESPONSE
Response to 100mV RMS Tone Burst
Response to Same Input Tone BurstWith Wideband Noise
INPUT
OUTPUT
OUTPUT
INPUT
NOTES:
NOTE:RL = 100Ω
S/N = –6dB
Noise Bandwidth = 140HzRL = 100Ω
3. The value of C3 is generally non-critical. C3 sets the band edgeof a low-pass filter which attenuates frequencies outside thedetection band to eliminate spurious outputs. If C3 is too small,frequencies just outside the detection band will switch the outputstage on and off at the beat frequency, or the output may pulseon and off during the turn-on transient. If C3 is too large, turn-onand turn-off of the
Figure 1.
INPUT 3
5
62 7 1
8
4
+V +V
OUTPUTFILTER
LOWPASSFILTER
567R1
RL
R2
C3C2C1
fO
1R1C1
output stage will be delayed until the voltage on C3 passes thethreshold voltage. (Such delay may be desirable to avoid spuriousoutputs due to transient frequencies.) A typical minimum value forC3 is 2C2.
4. Optional resistor R2 sets the threshold for the largest “no output”input voltage. A value of 130kΩ is used to assure the tested limitof 10mVRMS min. This resistor can be referenced to ground forincreased sensitivity. The explanation can be found in the“optional controls” section which follows.
AVAILABLE OUTPUTS (Figure 1)The primary output is the uncommitted output transistor collector,Pin 8. When an in-band input signal is present, this transistor
saturates; its collector voltage being less than 1.0 volt (typically0.6V) at full output current (100mA). The voltage at Pin 2 is thephase detector output which is a linear function of frequency overthe range of 0.95 to 1.05 fO with a slope of about 20mV per percentof frequency deviation. The average voltage at Pin 1 is, during lock,a function of the in-band input amplitude in accordance with thetransfer characteristic given. Pin 5 is the controlled oscillator squarewave output of magnitude (+V -2VBE)≅(+V-1.4V) having a DCaverage of +V/2. A 1kΩ load may be driven from pin 5. Pin 6 is anexponential triangle of 1VP-P with an average DC level of +V/2. Onlyhigh impedance loads may be
Figure 2. Typical Output Response
THRESHOLD VOLTAGEVREF
4.0
3.5
3.0
2.50 100 200mVrmsIN-BANDINPUTVOLTAGE
PIN 1VOLTAGE(AVG)
f1 = fO
7% BW
VCE (SAT) < 1.0V
14%
V+
0
3.9V
3.8V
3.7V
1.1fOfO0.9fO
LOW PASSFILTER(PIN 2)
OUTPUT(PIN 8)
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 410
Figure 3. Sensitivity Adjust
567 567
567
DECREASESENSITIVITY
INCREASESENSITIVITY
V+
R
R
1 1
1
SILICONDIODES FORTEMPERATURECOMPENSATION(OPTIONAL)
2.5k
1.0k
50k
C3C3
C3
RB
RC
V+
DECREASESENSITIVITY
INCREASESENSITIVITY
RA
connected to pin 6 without affecting the CCO duty cycle ortemperature stability.
OPERATING PRECAUTIONSA brief review of the following precautions will help the user achievethe high level of performance of which the 567 is capable.
1. Operation in the high input level mode (above 200mV) will freethe user from bandwidth variations due to changes in the in-bandsignal amplitude. The input
stage is now limiting, however, so that out-band signals or highnoise levels can cause an apparent bandwidth reduction as theinband signal is suppressed. Also, the limiting action will createin-band components from sub-harmonic signals, so the 567becomes sensitive to signals at fO/3, fO/5, etc.
2. The 567 will lock onto signals near (2n+1) fO, and will give anoutput for signals near (4n+1) fO where n=0, 1, 2, etc. Thus,signals at 5fO and 9fO can cause an unwanted output. If suchsignals are anticipated, they should be attenuated beforereaching the 567 input.
3. Maximum immunity from noise and out-band signals is affordedin the low input level (below 200mVRMS) and reduced bandwidthoperating mode. However, decreased loop damping causes theworst-case lock-up time to increase, as shown by the GreatestNumber of Cycles Before Output vs Bandwidth graph.
4. Due to the high switching speeds (20ns) associated with 567operation, care should be taken in lead routing. Lead lengthsshould be kept to a minimum. The power supply should beadequately bypassed close to the 567 with a 0.01µF or greatercapacitor; grounding paths should be carefully chosen to avoidground loops and unwanted voltage variations. Another factorwhich must be considered is the effect of load energization onthe power supply. For example, an incandescent lamp typicallydraws 10 times rated current at turn-on. This can be somewhatgreater when the output stage is made less sensitive, rejection ofthird harmonics or in-band harmonics (of lower frequencysignals) is also improved.
cause supply voltage fluctuations which could, for example, shift thedetection band of narrow-band systems sufficiently to causemomentary loss of lock. The result is a low-frequency oscillation intoand out of lock. Such effects can be prevented by supplying heavyload currents from a separate supply or increasing the supply filtercapacitor.
SPEED OF OPERATIONMinimum lock-up time is related to the natural frequency of the loop.The lower it is, the longer becomes the turn-on transient. Thus,maximum operating speed is obtained when C2 is at a minimum.When the signal is first applied, the phase may be such as to initiallydrive the controlled oscillator away from the incoming frequencyrather than toward it. Under this condition, which is of courseunpredictable, the lock-up transient is at its worst and the theoreticalminimum lock-up time is not achievable. We must simply wait for thetransient to die out.
The following expressions give the values of C2 and C3 which allowhighest operating speeds for various band center frequencies. Theminimum rate at which digital information may be detected withoutinformation loss due to the turn-on transient or output chatter isabout 10 cycles per bit, corresponding to an information transfer rateof fO/10 baud.
Rf
Figure 4. Chatter Prevention
567
V+
8
Cf
LOWER VALUE OF C f
RL
Rf*10k
*OPTIONAL - PERMITS
C3
567
V+
8
200 TO
RL
RA
C3
1
1k
10k
567
V+
8
1 10kRf RL
V+
200 TO 1kRA
1
Figure 5. Skew Adjust
567 567
567
V+
R
R
2 2
1
SILICONDIODES FORTEMPERATURECOMPENSATION(OPTIONAL)
2.5k
1.0k
50k
C2C2
C2
RB
RC
V+
RA
RAISES fOLOWERS fO
RAISES fO RAISES fO
LOWERS fO
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 411
C2 130fO F
C3 260fO F
In cases where turn-off time can be sacrificed to achieve fastturn-on, the optional sensitivity adjustment circuit can be used tomove the quiescent C3 voltage lower (closer to the thresholdvoltage). However, sensitivity to beat frequencies, noise andextraneous signals will be increased.
OPTIONAL CONTROLS (Figure 3)The 567 has been designed so that, for most applications, noexternal adjustments are required. Certain applications, however,will be greatly facilitated if full advantage is taken of the addedcontrol possibilities available through the use of additional externalcomponents. In the diagrams given, typicalvalues are suggested where applicable. For best results theresistors used, except where noted, should have the sametemperature coefficient. Ideally, silicon diodes would below-resistivity types, such as forward-biased transistor base-emitterjunctions. However, ordinary low-voltage diodes should be adequatefor most applications.
DETECTION BAND — % OF f O
Figure 6. BW Reduction
NOTE:
130fO
10k RR C2
1300fO
10k RR
Adjust control for symmetry of detection band edgesabout fO.
250
200
150
100
50
00 2 4 6 8 10 12 14 16
INP
UT
VO
LTA
GE
MV
— R
MS
0.5k 0.9k 1.4k 1.9k 2.5k 3.2k 4.0k
10k
20k
100k
R
OPTIONAL SILICONDIODES FORTEMPERATURECOMPENSATION
PIN 2567
V+
C2
RARB
RC
R RA RBRC
RB RC
50k
SENSITIVITY ADJUSTMENT (Figure 3)When operated as a very narrow-band detector (less than 8percent), both C2 and C3 are made quite large in order to improvenoise and out-band signal rejection. This will inevitably slow theresponse time. If, however, the output stage is biased closer to thethreshold level, the turn-on time can beimproved. This is accomplished by drawing additional current toterminal 1. Under this condition, the 567 will also give an output forlower-level signals (10mV or lower).
By adding current to terminal 1, the output stage is biased furtheraway from the threshold voltage. This is most useful when, to obtainmaximum operating speed, C2 and C3 are made very small.Normally, frequencies just outside the detection band could causefalse outputs under this condition. By desensitizing the output stage,the out-band beat notes do not feed through to the output stage.Since the input level must
Figure 7. Output Latching
NOTE:CA prevents latch-up when power supply is turned on.
V+
C3
RL
V+
CA
RA10k
567 8
1
UNLATCH
20kRf
V+
567 8
1
20kC3
RL
Rf
UNLATCH
V+
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 412
CHATTER PREVENTION (Figure 4)Chatter occurs in the output stage when C3 is relatively small, sothat the lock transient and the AC components at the quadraturephase detector (lock detector) output cause the output stage tomove through its threshold more than once. Many loads, forexample lamps and relays, will not respond to the chatter. However,logic may recognize the chatter as a series of outputs. By feedingthe output stage output back to its input (Pin 1) the chatter can beeliminated. Three schemes for doing this are given in Figure 4. Alloperate by feeding the first output step (either on or off) back to theinput, pushing the input past the threshold until the transientconditions are over. It is only necessary to assure that the feedbacktime constant is not so large as to prevent operation at the highestanticipated speed. Although chatter can always be eliminated bymaking C3 large, the feedback circuit will enable faster operation ofthe 567 by allowing C3 to be kept small. Note that if the feedbacktime constant is made quite large, a short burst at the inputfrequency can be stretched into a long output pulse. This may beuseful to drive, for example, stepping relays.
DETECTION BAND CENTERING (OR SKEW)ADJUSTMENT (Figure 5)When it is desired to alter the location of the detection band(corresponding to the loop capture range) within the lock range, thecircuits shown above can be used. By moving the detection band toone edge of the range, for example, input signal variations willexpand the detection band in only one direction. This may proveuseful when a strong but undesirable signal is expected on one sideor the other of the center frequency. Since RB also alters the dutycycle slightly, this method may be used to obtain a precise dutycycle when the 567 is used as an oscillator.
ALTERNATE METHOD OF BANDWIDTHREDUCTION (Figure 6)Although a large value of C2 will reduce the bandwidth, it alsoreduces the loop damping so as to slow the circuit response time.This may be undesirable. Bandwidth can be reduced by reducingthe loop gain. This scheme will improve damping and permit fasteroperation under narrow-band conditions. Note that the reducedimpedance level at terminal 2 will require that a larger value of C2 beused for a given filter cutofffrequency. If more than three 567s are to be used, the network of RBand RC can be eliminated and the RA resistors connected together.A capacitor between this junction and ground may be required toshunt high frequency components.
OUTPUT LATCHING (Figure 7)To latch the output on after a signal is received, it is necessary toprovide a feedback resistor around the output stage (between Pins 8and 1). Pin 1 is pulled up to unlatch the output stage.
REDUCTION OF C1 VALUEFor precision very low-frequency applications, where the value of C1becomes large, an overall cost savings may be achieved byinserting a voltage-follower between the R1 C1 junction and Pin 6,so as to allow a higher value of R1 and a lower value of C1 for agiven frequency.
PROGRAMMINGTo change the center frequency, the value of R1 can be changedwith a mechanical or solid state switch, or additional C1 capacitorsmay be added by grounding them through saturating NPNtransistors.
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 413
TYPICAL APPLICATIONS
Touch-Tone Decoder
NOTES:
Component values (Typical)
R1 = 26.8 to 15kΩR2 = 24.7kΩR3 = 20kΩC1 = 0.10mF
C2 = 1.0mF 5VC3 = 2.2mF 6VC4 = 250µF 6V
DIGIT1
2
3
4
5
6
7
8
9
0
*
567897Hz
567770Hz
567852Hz
567941Hz
5671209Hz
5671336Hz
5671477Hz
+
+
+
+
+
+
+
R3
R2
R1C1
C3C2
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 414
TYPICAL APPLICATIONS (Continued)
NOTES:R2 = R1/5
Adjust R1 so that φ = 90° with control midway.
NOTES:1. Resistor and capacitor values chosen for desired frequencies and bandwidth.
2. If C3 is made large so as to delay turn-on of the top 567, decoding of sequential (f1 f2) tones is possible.
Dual-Tone Decoder
24% Bandwidth Tone Decoder
Precision VLF
Carrier-Current Remote Control or Intercom
0° to 180° Phase Shifter
AUDIO OUT(IF INPUT ISFREQUENCYMODULATED)
LOAD
+5 TO 15V
56735 6 2 1
8
60Hz AC LINE
500pF
50–200VRMS
fO ≈ 100kHzC2
C3C1
0.004mfd
.006
.02
K1
C427pF
1:1 R12.5kΩ
567
5
6
5741
–
++
C1
R1
INPUTCHANNELOR RECEIVER
56735 6 2 1
8
56735 6 2 1
8
C1 C2 C3
C’1 C’2 C’3
R1
R’1
NOR
20k
20k
+V
+V
VO
f1
f2
OUTPUT(INTO 1kOHM MIN.LOAD)
5673 5
62
R1
f2
C1C2
100mv (pp)SQUARE OR50mVRMSSINE INPUT
+90°PHASESHIFT
5673
5 6 2 1
8
5673
5 6 2 1
8
INPUT SIGNAL(>100mVrms)
+V
RL
R1
R’1
C’1 C’2
C1
C2
C3
C 2 C2 130fO
(mfd)
C 1 C1R 1 1.12R1
Philips Semiconductors Linear Products Product specification
NE/SE567Tone decoder/phase-locked loop
April 15, 1992 415
TYPICAL APPLICATIONS (Continued)
Oscillator With Quadrature OutputOscillator With Double Frequency
OutputPrecision Oscillator With 20ns
Switching
Pulse Generator With 25% Duty CyclePrecision Oscillator to Switch 100mA
Loads Pulse Generator
CONNECT PIN 3TO 2.8V TOINVERT OUTPUT
5673
2 6 5
8
+
RL
RL > 1000ΩR1
CL
80°
+
RL
R110k
C1C2
567
32 6 5
8
fO
567
2 6 5
RL > 1000ΩR1
C1C2
VCOTERMINAL(±6%)
+
567
13 6 5
8
RL
R1
C1
10kΩ
+
567
12 6 5
8
RL
R1
C1C2
VCOTERMINAL(±6%)
567
6 5
OUTPUT
DUTYCYCLEADJUST
C1
1kΩ (MIN)
100kΩ
logic symbol †
† This symbol is in accordance with ANSI/IEEE Std 91-1984 and IECPublication 617-12.
2VCC – 1.5 V
–2VCC + 1.5 V
2
6
14
7
13
8
C1+
C1–
C2+
C2–
1
3
4
5
11
10
12
9
GND15
0 V
VCC
16
VCC
C1+
C1–
C2+
C2–
T1IN
T2IN
R1OUT
R2OUT
T1OUT
T2OUT
R1IN
R2IN
VS+
VS–
MAX232, MAX232IDUAL EIA-232 DRIVER/RECEIVER
SLLS047G – FEBRUARY 1989 – REVISED AUGUST 1998
1POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
Operates With Single 5-V Power Supply
LinBiCMOS Process Technology
Two Drivers and Two Receivers
±30-V Input Levels
Low Supply Curren t . . . 8 mA Typical
Meets or Exceeds TIA/EIA-232-F and ITURecommendation V.28
Designed to be Interchangeable WithMaxim MAX232
ApplicationsTIA/EIA-232-FBattery-Powered SystemsTerminalsModemsComputers
ESD Protection Exceeds 2000 V PerMIL-STD-883, Method 3015
Package Options Include PlasticSmall-Outline (D, DW) Packages andStandard Plastic (N) DIPs
description
The MAX232 device is a dual driver/receiver thatincludes a capacitive voltage generator to supplyEIA-232 voltage levels from a single 5-V supply.Each receiver converts EIA-232 inputs to 5-VTTL/CMOS levels. These receivers have a typicalthreshold of 1.3 V and a typical hysteresis of 0.5 V,and can accept ±30-V inputs. Each driverconverts TTL/CMOS input levels into EIA-232levels. The driver, receiver, and voltage-generatorfunctions are available as cells in the TexasInstruments LinASIC library.
The MAX232 is characterized for operation from0°C to 70°C. The MAX232I is characterized foroperation from –40°C to 85°C.
AVAILABLE OPTIONS
PACKAGED DEVICES
TASMALL
OUTLINE(D)
SMALLOUTLINE
(DW)
PLASTIC DIP(N)
0°C to 70°C MAX232D‡ MAX232DW‡ MAX232N
–40°C to 85°C MAX232ID‡ MAX232IDW‡ MAX232IN
‡ This device is available taped and reeled by adding an R to the part number (i.e., MAX232DR).
Copyright 1998, Texas Instruments IncorporatedPRODUCTION DATA information is current as of publication date.Products conform to specifications per the terms of Texas Instrumentsstandard warranty. Production processing does not necessarily includetesting of all parameters.
Please be aware that an important notice concerning availability, standard warranty, and use in critical applications ofTexas Instruments semiconductor products and disclaimers thereto appears at the end of this data sheet.
LinASIC and LinBiCMOS are trademarks of Texas Instruments Incorporated.
1
2
3
4
5
6
7
8
16
15
14
13
12
11
10
9
C1+VS+C1–C2+C2–VS–
T2OUTR2IN
VCCGNDT1OUTR1INR1OUTT1INT2INR2OUT
D, DW, OR N PACKAGE(TOP VIEW)
MAX232, MAX232IDUAL EIA-232 DRIVER/RECEIVER
SLLS047G – FEBRUARY 1989 – REVISED AUGUST 1998
2 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
absolute maximum ratings over operating free-air temperature range (unless otherwise noted) †
Input supply voltage range, VCC (see Note 1) – 0.3 V to 6 V. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Positive output supply voltage range, VS+ VCC – 0.3 V to 15 V. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Negative output supply voltage range, VS– –0.3 V to –15 V. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Input voltage range, VI: Driver –0.3 V to VCC + 0.3 V. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Receiver ±30 V. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Output voltage range, VO: T1OUT, T2OUT VS– –0.3 V to VS+ + 0.3 V. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
R1OUT, R2OUT –0.3 V to VCC + 0.3 V. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Short-circuit duration: T1OUT, T2OUT Unlimited. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Package thermal impedance, θJA (see Note 2): D package 113°C/W. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DW package 105°C/W. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N package 78°C/W. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Storage temperature range, Tstg –65°C to 150°C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Lead temperature 1,6 mm (1/16 inch) from case for 10 seconds 260°C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
† Stresses beyond those listed under “absolute maximum ratings” may cause permanent damage to the device. These are stress ratings only, andfunctional operation of the device at these or any other conditions beyond those indicated under “recommended operating conditions” is notimplied. Exposure to absolute-maximum-rated conditions for extended periods may affect device reliability.
NOTE 1: All voltage values are with respect to network ground terminal.2. The package thermal impedance is calculated in accordance with JESD 51, except for through-hole packages, which use a trace length
of zero.
recommended operating conditions
MIN NOM MAX UNIT
Supply voltage, VCC 4.5 5 5.5 V
High-level input voltage, VIH (T1IN,T2IN) 2 V
Low-level input voltage, VIL (T1IN, T2IN) 0.8 V
Receiver input voltage, R1IN, R2IN ±30 V
Operating free air temperature TAMAX232 0 70
°COperating free-air temperature,TAMAX232I –40 85
°C
MAX232, MAX232IDUAL EIA-232 DRIVER/RECEIVER
SLLS047G – FEBRUARY 1989 – REVISED AUGUST 1998
3POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
electrical characteristics over recommended ranges of supply voltage and operating free-airtemperature range (unless otherwise noted)
PARAMETER TEST CONDITIONS MIN TYP† MAX UNIT
VOH High-level output voltageT1OUT, T2OUT RL = 3 kΩ to GND 5 7
VVOH High-level out ut voltageR1OUT, R2OUT IOH = –1 mA 3.5
V
VOL Low level output voltage‡T1OUT, T2OUT RL = 3 kΩ to GND –7 –5
VVOL Low-level output voltage‡R1OUT, R2OUT IOL = 3.2 mA 0.4
V
VIT+Receiver positive-going inputthreshold voltage
R1IN, R2IN VCC = 5 V, TA = 25°C 1.7 2.4 V
VIT–Receiver negative-going inputthreshold voltage
R1IN, R2IN VCC = 5 V, TA = 25°C 0.8 1.2 V
Vhys Input hysteresis voltage R1IN, R2IN VCC = 5 V 0.2 0.5 1 V
ri Receiver input resistance R1IN, R2IN VCC = 5, TA = 25°C 3 5 7 kΩ
ro Output resistance T1OUT, T2OUT VS+ = VS– = 0, VO = ± 2 V 300 Ω
IOS§ Short-circuit output current T1OUT, T2OUT VCC = 5.5 V, VO = 0 ±10 mA
IIS Short-circuit input current T1IN, T2IN VI = 0 200 µA
ICC Supply currentVCC = 5.5 V,TA = 25°C
All outputs open,8 10 mA
† All typical values are at VCC = 5 V, TA = 25°C.‡ The algebraic convention, in which the least positive (most negative) value is designated minimum, is used in this data sheet for logic voltage
levels only.§ Not more than one output should be shorted at a time.
switching characteristics, V CC = 5 V, TA = 25°CPARAMETER TEST CONDITIONS MIN TYP MAX UNIT
tPLH(R) Receiver propagation delay time, low- to high-level output See Figure 1 500 ns
tPHL(R) Receiver propagation delay time, high- to low-level output See Figure 1 500 ns
SR Driver slew rateRL = 3 kΩ to 7 kΩ,See Figure 2
30 V/µs
SR(tr) Driver transition region slew rate See Figure 3 3 V/µs
MAX232, MAX232IDUAL EIA-232 DRIVER/RECEIVER
SLLS047G – FEBRUARY 1989 – REVISED AUGUST 1998
4 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
PARAMETER MEASUREMENT INFORMATION
≤ 10 ns
VCC
R1INor
R2IN
R1OUTor
R2OUT
RL = 1.3 kΩ
See Note C
CL = 50 pF(see Note B)
TEST CIRCUIT
≤ 10 ns
Input
Output
tPHLtPLH
1.5 VVOL
VOH
0 V
3 V
10%90%
50%
500 ns
WAVEFORMS
1.5 V
90%50% 10%
NOTES: A. The pulse generator has the following characteristics: ZO = 50 Ω, duty cycle ≤ 50%.B. CL includes probe and jig capacitance.C. All diodes are 1N3064 or equivalent.
PulseGenerator
(see Note A)
Figure 1. Receiver Test Circuit and Waveforms for t PHL and t PLH Measurements
MAX232, MAX232IDUAL EIA-232 DRIVER/RECEIVER
SLLS047G – FEBRUARY 1989 – REVISED AUGUST 1998
5POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
PARAMETER MEASUREMENT INFORMATION
T1IN or T2IN T1OUT or T2OUT
CL = 10 pF(see Note B)
TEST CIRCUIT
≤ 10 ns≤ 10 ns
Input
Output
tPHLtPLH
VOL
VOH
0 V
3 V
10%
90%50%
5 µs
WAVEFORMS
90%50%
10%
RL
90%
10%
90%
10%
tTLHtTHL
EIA-232 Output
SR
0.8 (VOH–VOL)
tTLHor
0.8 (VOL–VOH)
tTHL
NOTES: A. The pulse generator has the following characteristics: ZO = 50 Ω, duty cycle ≤ 50%.B. CL includes probe and jig capacitance.
PulseGenerator
(see Note A)
Figure 2. Driver Test Circuit and Waveforms for t PHL and t PLH Measurements (5- µs input)
EIA-232 Output
–3 V
3 V
–3 V
3 V
3 kΩ
10%1.5 V90%
WAVEFORMS
20 µs
1.5 V90%
10%
VOH
VOL
tTLHtTHL
≤ 10 ns ≤ 10 ns
TEST CIRCUIT
CL = 2.5 nF
PulseGenerator
(see Note A)
Input
Output
SR
6 VtTHL or t TLH
NOTE A: The pulse generator has the following characteristics: ZO = 50 Ω, duty cycle ≤ 50%.
Figure 3. Test Circuit and Waveforms for t THL and t TLH Measurements (20- µs input)
MAX232, MAX232IDUAL EIA-232 DRIVER/RECEIVER
SLLS047G – FEBRUARY 1989 – REVISED AUGUST 1998
6 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265
APPLICATION INFORMATION
VS+
VS–
2
6
14
7
13
8
C1+
C1–
C2+
C2–
1
3
4
5
11
10
12
9
GND15
0 V
VCC
16
5 V
EIA-232 Output
EIA-232 Output
EIA-232 Input
EIA-232 Input
+ 1 µF
8.5 V
– 8.5 V
1 µF
1 µF
1 µF
From CMOS or TTL
To CMOS or TTL
Figure 4. Typical Operating Circuit
IMPORTANT NOTICE
Texas Instruments and its subsidiaries (TI) reserve the right to make changes to their products or to discontinueany product or service without notice, and advise customers to obtain the latest version of relevant informationto verify, before placing orders, that information being relied on is current and complete. All products are soldsubject to the terms and conditions of sale supplied at the time of order acknowledgement, including thosepertaining to warranty, patent infringement, and limitation of liability.
TI warrants performance of its semiconductor products to the specifications applicable at the time of sale inaccordance with TI’s standard warranty. Testing and other quality control techniques are utilized to the extentTI deems necessary to support this warranty. Specific testing of all parameters of each device is not necessarilyperformed, except those mandated by government requirements.
CERTAIN APPLICATIONS USING SEMICONDUCTOR PRODUCTS MAY INVOLVE POTENTIAL RISKS OFDEATH, PERSONAL INJURY, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE (“CRITICALAPPLICATIONS”). TI SEMICONDUCTOR PRODUCTS ARE NOT DESIGNED, AUTHORIZED, ORWARRANTED TO BE SUITABLE FOR USE IN LIFE-SUPPORT DEVICES OR SYSTEMS OR OTHERCRITICAL APPLICATIONS. INCLUSION OF TI PRODUCTS IN SUCH APPLICATIONS IS UNDERSTOOD TOBE FULLY AT THE CUSTOMER’S RISK.
In order to minimize risks associated with the customer’s applications, adequate design and operatingsafeguards must be provided by the customer to minimize inherent or procedural hazards.
TI assumes no liability for applications assistance or customer product design. TI does not warrant or representthat any license, either express or implied, is granted under any patent right, copyright, mask work right, or otherintellectual property right of TI covering or relating to any combination, machine, or process in which suchsemiconductor products or services might be or are used. TI’s publication of information regarding any thirdparty’s products or services does not constitute TI’s approval, warranty or endorsement thereof.
Copyright 1998, Texas Instruments Incorporated
------------------------------Trabajo conjunto de Final de Carrera de Jose Luis Alonso Bartolomé--------------------------
4.- PLANOS