Beruflich Dokumente
Kultur Dokumente
A 5 1 W
B 6
74S86N U2B
2 X
C 4
U3C
74S86N 7 Y
D
74S86N
3 Z
^ caret.
1
Reglas generales 3
Programa 4
Niveles de voltaje 5
Hojas de seguimiento 6
Relación de Prácticas y Proyectos 10
Ejercicios básicos 12
Relación de Prácticas y Proyectos (parte II) 14
Ejemplos de Programación C++ Arduino 26
Modelos de reactivos de evaluación. 36
Digital electronics concepts 44
Flip-flop (summary) 56
2
Reglas generales:
1.- Del Reglamento: El alumno debe ser puntual y constante. Se dará una tolerancia de 5
minutos en la entrada. Se considerarán 3 retardos equivalente a una falta.
2.- Cada falta será sancionada con 3 puntos menos del promedio general que obtenga el
alumno.
3.- En consecuencia:
Con más de 10 faltas cualquier promedio el alumno estará reprobado.
4.- Los alumnos podrán disponer de 3 permisos durante el semestre para no asistir,
preferentemente notificándolo previamente.
5.-La evaluación del curso será de la siguiente tabla.
(a) Proyecto(s) de la unidad. 40 puntos
(b)Asistencia, puntualidad, participación, actitud, tareas, etc. 10 puntos
(c) Evaluación teórica 50 puntos
6) Los proyectos deben de incluir:
(a) Reporte escrito en computadora, Word u otro software. Circuitos hechos
con los paquetes de programación (Multisim, Hotwire, Proteus, etc.)
(b) Objetivo del proyecto. Introducción teoría básica (marco teórico) breve. Conclusiones
al final. ¿Qué verifiqué? ¿Qué aprendí? ¿Cuánto aprendí? Etc.
(c) Cálculos. Diagramas físico de conexiones, diagrama esquemático.
(d) Fotos escaneadas de la evidencia del buen funcionamiento del proyecto.
Con el visto bueno (o aprobación del profesor).
(e) Costos parciales de cada componente y el total del proyecto
7. Los proyectos pequeños son individuales.
8.- Se aplican las reglas conocidas. Si no se presenta en la fecha indicada, la entrega del
proyecto, pasa a segunda oportunidad.
9.- Subir en cuenta YOUTUBE (opcional) todas las prácticas y proyectos (haga su guión
primero)
10.- La asesoría por parte del profesor, será de acuerdo a las necesidades del alumno.
11.- El profesor hará la revisión, el seguimiento y registro de los proyectos.
12.- En todos los proyectos puede consultar Internet para ideas o consulta de hojas de
datos de los dispositivos. Si baja algún circuito asegúrese de que venga explicado y/o
calculado, de lo contrario usted tendrá que hacerlo.
13.- En todo caso primero verifique el estado de la sonda (o punta de prueba) del equipo
de medición y prueba y después arme su circuito.
Atentamente.
P R O G R A M A.
3
UNIDAD I FUNDAMENTOS DE SISTEMAS DIGITALES
4
NIVELES DE VOLTAJE. SON IMPORTANTE PARA QUE FUNCIONE
CORRECTAMENTE EL CIRCUITO INTEGRADO. (I.C. EN INGLES)
Como se muestra en la figura, cada valor binario tiene una desviación aceptable
del valor nominal. La región intermedia entre las dos regiones permitidas se cruza
solamente durante la transición de estado. Los terminales de entrada de un
circuito digital aceptan señales binarias dentro de las tolerancias permitidas y los
circuitos responden en los terminales de salida con señales binarias que caen
dentro de las tolerancias permitidas.
5
ELECTRÓNICA DIGITAL
6
Formato de seguimiento de prácticas y proyectos
SI TODO ES ACEPTABLE, EL PROFESOR FIRMA EL
AVANCE.
SI LO COPIÓ DE INTERNET, QUE INTERNET SE LO
CALIFIQUE.
Pre-práctica o
% Avance
PROYECTO MODALIDAD
Fecha de Fecha de
PUNTOS
entrega 1 entrega 2 Firma y comentarios
del docente
Sumador completo de
Individual
1 BIT. Sistema
mecánico o
electromecánico
PY2
PY3
PY4
Sumador completo
En equipo
de1 Bit programado
Arduino u otra
plataforma
Preprácticas:
Ejercicio 1
Ejercicio 2
Ejercicio 3
7
UNIDAD II: FUNCIONES Y COMPUERTAS LÓGICAS
% Avance
Pre-práctica o Fecha de Fecha de
MODALIDAD PUNTOS
PROYECTO entrega 1 entrega 2
Firma y comentarios
del docente
PY1
Compuertas lógicas
Individual
de dos entradas 1
salida (vea y lea
información abajo)
PY2
Convertidor de En equipo
Binario a código
Gray 4 BIT’s
PY3
Decodificador de En equipo
BCD a 7 Segmentos
PY4
Función Lógica
z(A,B) En equipo
(vea y lea
información abajo)
PY4
Sumador / Restador
de 4 BIT’s En equipo
ELECTRÓNICA DIGITAL
8
UNIDAD III: LÓGICA COMBINACIONAL
% Avance
Pre-práctica o Fecha de Fecha de
MODALIDAD PUNTOS
PROYECTO entrega 1 entrega 2
Firma y comentarios
del docente
PY1
Potencia al cuadrado:.
En equipo
y = x2 (3-bit’s)
Entrada/Salida: binaria
PY2
Potencia al cuadrado:.
y = x2
En equipo
(Teclado 9-entradas)
Salida 7-Segmentos
PY3
Medición de la En equipo
Constante de gravedad
g.
PY4
Bin-level control
En equipo
system
9
% Avance
Pre-práctica o Fecha de Fecha de
MODALIDAD PUNTOS
PROYECTO entrega 1 entrega 2
Firma y comentarios
del docente
PY1
Secuenciador En equipo
PY2
PY#
Conteo
Convertidor de digital ascendente
a analógico (DAC) de
3 bits con resistores UP/Down
ponderados, R, R/2, counter
R/4, RLoad Opción
escalera R-2R. o DAC Individual
en C. I.
PY3
PY4
Dispenser machine.
En equipo
(vea y lea información)
En equipo
PY4 Marcador de
basquetball 4_displays
ELECTRÓNICA DIGITAL
UNIDAD V: FUNDAMENTOS DE SISTEMAS DIGITALES
10
% Avance
Fecha de Fecha de
PROYECTO MODALIDAD PUNTOS
entrega 1 entrega 2
Firma y comentarios
del docente
PY1
Letrero (desplegado)
OPCIONES:
7-SEGMENTOS
14-SEGMENTOS Todo grupo
4x MATRIZ 5X7
DIFERENTES
DIMENSIONES CADA
SEMESTRE
PY2
DESPACHADOR DE
UNO A 10 PRODUCTOS
Equipo
(LATAS O CANICAS) A
PETICIÓN DE USUARIO.
USO DEL TECLADO
QWERTY
PY3
11
Sistemas Numéricos y Códigos
Enunciado:
1) CON TRES INTERRUPTORES A, B Y C, (DE ACCIÓN MOMENTANEA)
SE DESEA CONTROLAR DOS LÁMPARAS X, Y, DE TAL MANERA QUE:
a) SI SE OPRIME UN SOLO INTERRUPTOR A LA VEZ PRENDE LA
LÁMPARA Y (LSD).
b) SI SE OPRIME UN PAR (SIMULTÁNEAMENTE) PRENDE LA
LÁMPARA X. (MSB)
c) SI SE OPRIMEN O ACTIVAN LOS 3 INTERRUPTORES
(SIMULTÁNEAMENTE) PRENDE AMBAS LÁMPARAS X, Y.
Proyecto: INDIVIDUAL.
12
El ejemplo (abajo), es un montaje en PVC con dos interruptores rotativos 1P3T X4
y un relevador 2P2T a 12V. (P=polo, T=tiro)
EN EQUIPO ( 2 O 3 INTEGRANTES)
CIN
B Full S1 (= COUT )
Adder
13
Competencias Específicas, Usar:
14
Nombre: 1-BIT FULL ADDER (v.3)
EN EQUIPO ( 2 O 3 INTEGRANTES)
PLACAS ARDUINO
15
The Arduino language is based on C/C++.
PREPRÁCTICAS Y PROYECTOS
L5 L5
L6
L7 L7
L8
L9
SALIDA (CORRIENTE O VOLTAJE)
16
EJERCICIO 2: ANALICE EL SIGUIENTE CIRCUITO Y HAGA EL PROGRAMA
CORRESPONDIENTE. VERIFIQUELO.
J2
J1 4 3
1 5 X1
V1 Key = A Key = B 100V_100W
120 Vrms
60 Hz
0°
2
Visite estos links.
https://www.wisc-online.com/learn/career-clusters/manufacturing/dig2603/boolean-
theorems-single-variable
http://www.engr.sjsu.edu/caohuut/EE270/Documents/Lecture01.pdf
http://proyectoelectronico.com/
http://proyectoelectronico.com/leds/secuenciador-de-luces-led.html
17
Key = A
J1
LED2
7 5
J2
U2
1A VCC
1B 4B
1Y 4A
2A 4Y
2B 3B
2Y 3A
GND 3Y
LED3
6 74LS32N
Key = B
1
R1 V1
220Ω 5V
3
2 4
R3 R2 LED1
1kΩ 1kΩ
PREPRÁCTICAS Y PROYECTOS
Nombre: COMPUERTA LÓGICA DE DOS ENTRADAS UNA SALIDA.
INDIVIDUAL
1) ANALICE EL CIRCUITO SIGUIENTE. HAGA
o A) LA TABLA DE VERDAD
o B) OBTENGA LA ECUACIÓN BOOLEANA.
o C) IDENTIFIQUE EL TIPO DE COMPUERTA
o D) HAGA LA PROGRAMACIÓN CORRESPONDIENTE.
o E) VERIFIQUE EN ARDUINO.
3
R1 V1
1kΩ 12 V
1 Vout
ENTRADAS Q1
R2 Salida
Vin1 4 2
10kΩ
2N2222A
5 R4
Vin2
10kΩ
0 GND
18
Nombre: CONVERTIDOR DE BINARIO A CÓDIGO GRAY DE 4 BIT´S
EN EQUIPO ( 2 O 3 INTEGRANTES)
A W
CONVERTIDOR
B DE BINARIO X
4 BIT´S. A
C CÓDIGO GRAY Y
D Z
ENTRADAS S A L I D A S (SEGMENTOS) a, b, c, d, e, f, g.
ABCD a b c d e f g
0000 1 1 1 1 1 1 0
0001 0 1 1 0 0 0 0
0010 1 1 0 1 1 0 1
0011 1 1 1 1 0 0 1
19
0100 0 1 1 0 0 1 1
0101 1 0 1 1 0 1 1
0110 1 0 1 1 1 1 1
0111 1 1 1 0 0 0 0
1000 1 1 1 1 1 1 1
1001 1 1 1 1 0 1 1
1010 X X X X X X X
…. …. ….. …. …. …. …. ….
1111 X X X X X X X
OBTENGA.
20
U1A
A 1 U3A
5 U4A
74LS04N 7 Z
2 74LS08N
B U2B 3 U3B 674LS32N
4
74LS04N 74LS08N
Nombre: SUMADOR / RESTADOR DE 4 BIT’S.
EN EQUIPO ( 2 O 3 INTEGRANTES)
Cin
ENTRADAS SALIDAS
A So (LSB)
SUMADOR/ S1
RESTADOR S2
B DE 4 BIT´S S3
S4 (= Cout)
CTRL
21
A, B, SON ENTRADAS DE 4 BIT´S, ES DECIR, A = [A0, A1, A2 ,A3]
B = [B0, B1, B2 ,B3]
Competencia específica:
Uso del Método Heurístico para el diseño de un sistema digital.
DIAGRAMA DE FLUJO
SUMA / RESTA
ENTRADAS
A, B, C
NO
C=0
¿ SI
PROCESO
B = B’
S=A+B S= A+ B
MSB=1 NO ( A < B)
SI (A > B)
S=S+1 S = S’ COMPLEMENTO
Salidas (Respuestas)
Donde:
22
S
A, B OPERANDOS. C = ENTRADA DE CONTROL. B’ COMPLEMENTO B. Most Significant Bit
(MBS)
PREPRÁCTICAS Y PROYECTOS
23
Nombre: CONSTANTE DE GRAVEDAD (MEDIR)
EN EQUIPO ( 2 O 3 INTEGRANTES)
74S08N Q
Termina Reset
EMISOR 2 SENSOR 2
Conteo
24
Entradas: Stop, Start a G1. Bin 1 Full al inversor y éste a G4. Bin 1 empty a G2.
Bin 2 Empty a G6 y a G3. Bin 2Full al inversor éste a G3 y G5. From
Output of G1 a G5.
Salidas: Fill Bin 1 solenoid. Alarm Horn. Fill Bin 2 solenoide.
Intermedio: 2-minute timer. Alarm Acknowledgment.
25
PREPRÁCTICAS Y PROYECTOS
Nombre: SECUENCIADOR
EN EQUIPO ( 2 O 3 INTEGRANTES)
ANALICE EL CIRCUITO
OBTENGA LAS ECUACIONES DE LAS ENTRADAS DE LOS FLIP
FLOP’s (ECUACIONES DE EXCITACIÓN)
DIBUJE EL DIAGRAMA DE ESTADOS
ESQUEMATICE EL DIAGRAMA DE TIEMPOS
OBTENGA LA VERSIÓN PROGRAMADA.
VEFIFIQUE EN ARDUINO U OTRA PLATAFORMA
+5V 1
2 U4A
5 2 U3A
2 2 ~1PR
9
U2A U1A 74LS08N
4 4 1J
R1 R2
~1PR ~1PR 1Q 15 R3
220Ω 220Ω
4 1J 1Q 15 4 1J 1Q 15 1 1CLK 220Ω
6 7
CLOCK PULSE 1 1CLK 1 1CLK 16 1K ~1Q 14 8
16 1K ~1Q 14 16 1K ~1Q 14 ~1CLR LED1 LED2
LED3
~1CLR 3 ~1CLR 3 74LS76N
3 74LS76N 3 74LS76N
0
Observe que todos los preset (parte superior del FF) y los clear (parte
inferior) están conectados a “uno lógico” (+5v. No flotando) para que no
actúen o active esas entradas y mal funcione el circuito.
26
Prototipo (Material didáctico construido por el maestro)
27
Nombre: SEMÁFORO DE DOS VÍAS.
EN EQUIPO ( 2 O 3 INTEGRANTES)
4) DISEÑE UN SEMÁFOR DE DOS VÍAS, EL VERDE DESTELLA 3
VECES ANTES DE PASAR AL AMBAR. PROTOTIPO A ESCALA
FOCOS DE 60 WATT (VERDE, AMBAR ROJO)
HAGA PRIMERO DEL DIAGRAMA DE TIEMPOS.
RETURN 2 COINS
WAIT WAIT
Select
Product X product
sold ctct
Product Y
STATE DIAGRAM.
28
IMAGEN DEL PROTOTIPO, CORTESÍA DEL ALUMNO CAMPOS VILLEDA
DAVID Y EQUIPO. UN SERVOMOTOR CONTROLA LA SALIDA DEL
PRODUCTO SELECCIONADO. UN INDICADOR VISUAL (LCD) DESPLEGA EL
NOMBRE DEL PRODUCTO DESPACHADO. (EJEMPLO: CHOCOLATE O
CARAMELO), Señalado con una flecha el LCD (Liquid Crystal Display)
29
PREPRÁCTICAS Y PROYECTOS
30
A CONTINUACIÓN, ALGUNOS EJEMPLOS DE PROGRAMACIÓN.
31
// Serial.begin(9600); (usada solo para la depuración)
}
32
/* “ SUMADOR COMPLETO DE 1 BIT.” (1-Bit Full Adder) Prf. G. Acosta M. v3
Febrero 2018. */
void setup()
{
// initialize the digital pin as an output or input.
pinMode(11, OUTPUT); // LSB = L0, Least Significant Bit
pinMode(12, OUTPUT); // MSB = L1, Most Significant Bit
pinMode(2, INPUT); // Entrada X (--> A)
pinMode(3, INPUT); // Entrada Y (--> B)
pinMode(4, INPUT); // Entrada Z (--> C)
}
void loop()
{
X=0, Y=0, Z=0; // Entradas al iniciar en cero. Opcional, son cero al iniciar.
//LEctrura de las entradas
X=digitalRead(2); Y=digitalRead(3); Z=digitalRead(4);
// FUNCION Lógica S0 = C'(A B' + A'B) + C ( A'B' + AB)
// ! = NOT, && = AND, || = OR. Notaciones de Arduino
S0 = !Z && ( (X&& !Y ) || (!X && Y) ) || Z && ( (!X && !Y ||XA && Y) );
// FUNCION Lógica S1 = A B + A C + B C
S1 = (X && Y) || (X && Z) || (Y && Z);
// ABAJO: CONDICIONES para prender el LED correspondiente de salida
if(S0 == true) digitalWrite(11, HIGH); else digitalWrite(11, LOW);
if (S1==true) digitalWrite(12, HIGH); else digitalWrite(12, LOW);
delay(50); //Retardo agregado arbitrariamente. Pruebe sin este
}
33
// COMPARADOR DE 4 BITS
// VERSION UNO. SIN ECUACIONES LÓGICAS(BOOLEANAS)
// Notas Prof. G. Acosta M...... 20-III-2015
//
int sala=10, salb=11, salc=12; // sala <, salb =, salc > : SALIDAS
int A, B, C, D, E, F, G, H, M, N, i;
void setup()
{
pinMode(sala, OUTPUT); pinMode(salb, OUTPUT); pinMode(salc, OUTPUT);
for (i=2; i<10; i++) pinMode(i, INPUT); // ENTRADAS A,B,C,D; E,F, G,
H. A y E =MSB; D y H =LSB.
Serial.begin(9600);
}
void loop()
{
// ABAJO: Lectura del estado actual de LASA ENTRADAS, PINS 2,3,4,5
A=digitalRead(2); B=digitalRead(3); C=digitalRead(4);
D=digitalRead(5);
E=digitalRead(6); F=digitalRead(7); G=digitalRead(8);
H=digitalRead(9);
// abajo: ECUACIONES (LÓGICA ARITMÉTICA) de variables -----
if (A==1) A=8; else A=0; if (B==1) B=4; else B=0; if (C==1) C=2; else
C=0; if (D==1) D=1; else D=0;
N = A + B + C + D; //SUMA LAS ENTRADAS SEGÚN SU PESO. A=MSB; D=LSB.
if (E==1) E=8; else E=0; if (F==1) F=4; else F=0; if (G==1) G=2; else
G=0; if (H==1) H=1; else H=0;
M = E + F + G + H; //SUMA LAS ENTRADAS SEGÚN SU PESO. E=MSB; H=LSB.
// ABAJO: CONDICIONES lógico-ARITMÉTICAS prende salidas
if (N < M) digitalWrite(sala, HIGH); else digitalWrite(sala, LOW);
//menor
if (N == M) digitalWrite(salb, HIGH); else digitalWrite(salb, LOW);
// igual NOTA VERIFICAR ASIGNACIÓN VS COMPARACIÓN
if (N > M) digitalWrite(salc, HIGH); else digitalWrite(salc, LOW); //
mayor
boolean A, B, C, D, E, F, G, H; //
boolean w0, w1, w2, w3, x0, x1, x2, x3, w, x, y, y0,y1, y2, y3, P, Q;
void setup()
{
pinMode(sala, OUTPUT); pinMode(salb, OUTPUT); pinMode(salc, OUTPUT);
34
for (i=2; i<10; i++) pinMode(i, INPUT); // ENTRADAS A0..A3, B0...B3.
Serial.begin(9600);
}
void loop()
{
// ABAJO: Lectura del estado actual de LASA ENTRADAS, PINS
2,3,4,5...9
A=digitalRead(2); B=digitalRead(3); C=digitalRead(4);
D=digitalRead(5);
E=digitalRead(6); F=digitalRead(7); G=digitalRead(8);
H=digitalRead(9);
void compara()
{
// Ecuación del comparador de 1-bit
w = !P && Q; y = P && !Q;
x= !P && !Q || P && Q;
}
// Decodificador de BCD a 7-segmetos cátodo común..
// VERSION DOS. SIN LÓGICA BOOLEANA...
// Notas Prof. G. Acosta M...... 6-III-2015
// VERIFICADO OK
int sala=10, salb=11, salc=12, sald=13, sale=14, salf=15, salg=16;
int A, B, C, D, N, i;
void setup()
{
pinMode(sala, OUTPUT); pinMode(salb, OUTPUT); pinMode(salc, OUTPUT);
pinMode(sald, OUTPUT);
pinMode(sale, OUTPUT); pinMode(salf, OUTPUT); pinMode(salg, OUTPUT);
pinMode(2, INPUT); pinMode(3, INPUT); pinMode(4, INPUT); pinMode(5,
INPUT); //ENTRADAS A, B, C, D.
35
// Serial.begin(9600);
}
void loop()
{
// ABAJO: Lectura del estado actual de LASA ENTRADAS, PINS 2,3,4,5
A=digitalRead(2); B=digitalRead(3); C=digitalRead(4);
D=digitalRead(5);
// abajo: ECUACIONES (LÓGICA ARITMÉTICA) de variables -----
if (A==1) A=8; else A=0; if (B==1) B=4; else B=0; if (C==1) C=2; else
C=0; if (D==1) D=1; else D=0;
N = A + B + C + D; //SUMA LAS ENTRADAS SEGÚN SU PESO. A=MSB; D=LSB.
// ABAJO: Lógica para prender los segmentos a, b, c.....g
switch(N)
{
case 0: for (i=10; i<16; i++) digitalWrite(i, HIGH); break;
//prende“0"
case 1: for (i=11; i<13; i++) digitalWrite(i, HIGH); break;
//prende“1"
case 2: for (i=10; i<17; i++) {digitalWrite(i, HIGH);
digitalWrite(15, LOW); digitalWrite(12, LOW);} break;
//prende“2"
case 3: for (i=10; i<14; i++) {digitalWrite(i, HIGH);
digitalWrite(16, HIGH);} break; //prende“3"
case 4: for (i=11; i<13; i++) {digitalWrite(i, HIGH);
for (i=15; i<17; i++)digitalWrite(i, HIGH); digitalWrite(12,
HIGH);} break;
case 5: for (i=10; i<17; i++) {digitalWrite(i, HIGH);
digitalWrite(11, LOW); digitalWrite(14, LOW);} break;
case 6: for (i=10; i<17; i++) {digitalWrite(i, HIGH);
digitalWrite(11, LOW);} break;
case 7: for (i=10; i<13; i++) {digitalWrite(i, HIGH);} break;
case 8: for (i=10; i<17; i++) digitalWrite(i, HIGH); break;
case 9: for (i=10; i<17; i++) {digitalWrite(i, HIGH);
digitalWrite(14, LOW);} break; //prende“9"
}
36
// “ HOLA EL TEC LES DESEA FELICIDAD "
// NOTAS del profr. GAMO 5/VI/2014
// Se definen las variables del tipo "entero" (son localidades físicas de memoria
// mem es tipo caracter, y cade es una cadena de caracteres
void setup()
{ // Se definen lon pins del arduino del 2 al 8 como salidas
for (pin=2; pin <= 8; ++pin) {pinMode(pin, OUTPUT);}
// Serial.begin(9600); se uso en la depuración
//Definimos las entradas analógicas como SALIDA digital para el multiplexado BJT (transistores)
pinMode(A0,OUTPUT); pinMode(A1,OUTPUT); pinMode(A2,OUTPUT); pinMode(A3,OUTPUT);
} // Fin de la función void setup ()
switch(mem)
{
case 'H':
digitalWrite(3,HIGH); for (pin=6; pin<=6; pin++) digitalWrite(pin,HIGH);
digitalWrite(4,HIGH); break;
case 'O':
for (pin=2; pin<=7; pin++) digitalWrite(pin,HIGH); break;
37
case 'L':
for (pin=5; pin<=7; pin++) digitalWrite(pin,HIGH); break;
case 'A':
for (pin=2; pin<=4; pin++) digitalWrite(pin,HIGH);
for (pin=6; pin<=8; pin++) digitalWrite(pin,HIGH); break;
case 'E':
digitalWrite(2,HIGH); for (pin=5; pin<=8; pin++) digitalWrite(pin,HIGH); break;
case 'T':
for (pin=5; pin<=8; pin++) digitalWrite(pin,HIGH);digitalWrite(5,HIGH); break;
case 'C':
digitalWrite(2,HIGH); for (pin=5; pin<=7; pin++) digitalWrite(pin,HIGH); break;
case 'S':
digitalWrite(2,HIGH); digitalWrite(4,HIGH); digitalWrite(5,HIGH);
digitalWrite(7,HIGH); digitalWrite(8,HIGH); break;
case 'D':
for (pin=3; pin<=6; pin++) digitalWrite(pin,HIGH); digitalWrite(8,HIGH); break;
case 'F':
digitalWrite(2,HIGH); for (pin=6; pin<=8; pin++) digitalWrite(pin,HIGH); break;
case 'I':
for (pin=6; pin<=7; pin++) digitalWrite(pin,HIGH); break;
} // cierra la estructua switch...case
delay(5); // Requiere este delay para que se vea bien la letra, sin parpadeo (estabilización)
analogWrite(A0,LOW); analogWrite(A1,LOW);analogWrite(A2,LOW); analogWrite(A3,LOW);
//Apaga multiplexado
cont=cont+1; if (cont > 3) cont=0;
} // Cierra el ciclo for
cont1=cont1 + 1; // Siguiente letra
cont=0; delay(5);
if (cont1 >35) {cont1=0; cont=0;}
38
/*
SEMAFO DE DOS VÍAS : Alumnos: MOY + DANY* + ANGEL (22-V-2014)
Depura profr. GAMO
*/
39
EJERCICIO.
ANALICE Y DETERMINE LO QUE SE OBTIENE DE SALIDA EN EL PROGRAMA
SIGUIENTE.
void setup()
{
// initialize the digital pin as an output.
for (cont=3; cont<10; cont++) pinMode(cont,OUTPUT); // pin 3 --> segmento a...
//pin 9 --> segmento g
cont=0;
Serial.begin(9600); // Para usar el monitor serial al DEPURAR EL PROGRAMA
}
// the loop routine runs over and over again forever:(se repite en bucle infinito)
void loop()
{
for (i=3; i<=9; i++)digitalWrite(i,LOW);
while (j<=10)
{
for (i=3; i<=8; i++)
{
digitalWrite(i,HIGH); delay(retardo);digitalWrite(i,LOW);
delay(retardo);
}
retardo=retardo-5; j++;
}
j=0; retardo=50;
switch(cont)
{
case 0:
digitalWrite(3,HIGH); digitalWrite(4,HIGH); digitalWrite(5,HIGH);
digitalWrite(6,HIGH); digitalWrite(7,HIGH); digitalWrite(8,HIGH);
digitalWrite(9,LOW); break;
case 1:
digitalWrite(3,LOW); digitalWrite(4,HIGH); digitalWrite(5,HIGH);
40
digitalWrite(6,LOW); digitalWrite(7,LOW); digitalWrite(8,LOW);
digitalWrite(9,LOW); break;
case 2:
digitalWrite(3,HIGH); digitalWrite(4,HIGH); digitalWrite(5,LOW);
digitalWrite(6,HIGH); digitalWrite(7,HIGH); digitalWrite(8,LOW);
digitalWrite(9,HIGH); break;
case 3:
digitalWrite(3,HIGH); digitalWrite(4,HIGH); digitalWrite(5,HIGH);
digitalWrite(6,HIGH); digitalWrite(7,LOW); digitalWrite(8,LOW);
digitalWrite(9,HIGH); break;
case 4:
digitalWrite(3,LOW); digitalWrite(4,HIGH); digitalWrite(5,HIGH);
digitalWrite(6,LOW); digitalWrite(7,LOW); digitalWrite(8,HIGH);
digitalWrite(9,HIGH); break;
case 5:
digitalWrite(3,HIGH); digitalWrite(4,LOW); digitalWrite(5,HIGH);
digitalWrite(6,HIGH); digitalWrite(7,LOW); digitalWrite(8,HIGH);
digitalWrite(9,HIGH); break;
case 6:
digitalWrite(3,HIGH); digitalWrite(4,LOW); digitalWrite(5,HIGH);
digitalWrite(6,HIGH); digitalWrite(7,HIGH); digitalWrite(8,HIGH);
digitalWrite(9,HIGH); break;
case 7:
digitalWrite(3,HIGH); digitalWrite(4,HIGH); digitalWrite(5,HIGH);
digitalWrite(6,LOW); digitalWrite(7,LOW); digitalWrite(8,LOW);
digitalWrite(9,LOW); break;
case 8:
digitalWrite(3,HIGH); digitalWrite(4,HIGH); digitalWrite(5,HIGH);
digitalWrite(6,HIGH); digitalWrite(7,HIGH); digitalWrite(8,HIGH);
digitalWrite(9,HIGH); break;
case 9:
digitalWrite(3,HIGH); digitalWrite(4,HIGH); digitalWrite(5,HIGH);
digitalWrite(6,HIGH); digitalWrite(7,LOW); digitalWrite(8,HIGH);
digitalWrite(9,HIGH); break;
}
Serial.println (cont); cont++; // incrementa contador
if (cont >=10) cont=0; Serial.println("---"); j=1; delay(800); }
41
EN HOJAS LIMPIAS REALICE DETALLADA Y ORDENADAMENTE EL PROCEDIMIENTO DE
TODA OPERACIÓN, Y ESCRIBA EN ESTA HOJO LOS RESULTADOS.
P3) a) SISTEMA BASE 16: RESTE POR COMPLEMENTO A 15; 1947 – 2014 =
b) CÓDIGO BCD 8421; 1521 + 2014 + 1985 =
42
ELECTRÓNICA DIGITAL. UNIDAD II. (FUNCIONES Y COMPUERTAS LÓGICAS).
ALUMNO: FECHA:
3) X = π(1, 3, 5, 7) (MAXITÉRMINOS)
U1A
A 1 U3A
5 U4A
74LS04N 7 Z
2 74LS08N
B U2B 3 U3B 674LS32N
4
74LS04N 74LS08N
UNIDAD III
2) Diseñe un sistema digital que detecte los números impares del 0 al 31.
3) Diseñe un sistema Digital que detecte los números primos. Entrada binaria de 4 bits.
4) Diseñe una ALU de un Bit con estrada de control C. Para C=0, S = A + B. Para C=1,
S = A – B (salida en complemento a dos). Para C=2, S = A XNOR B. Para C=3, S= A NAND
B con estructura de “PROM”
43
SOLUCIÓN: ELECTRÓNICA DIGITAL UNIDAD 3 (LÓGICA COMBINACIONAL)
A’ 0 1 3 2 A’
7 6 4 5
4 5 7 6 3 2 0 1
A A
C’ C C’ C’ C C’
44
7404N
U1A
A 1 I0
I1 MUX 6 F
4:1
0 2
I2
1 3
I3
B 4
C 5
G = A’B’C’ + AB + AC
TEOREMA DeMORGAN: G’ = (A’B’C’ + AB + AC)’ = (A’B’C’)’ (AB)’ ( AC)’
TEOREMA DeMORGAN: [G’ = (A’B’C’)’ (AB)’ ( AC)’]’;
G =[(A’B’C’)’ (AB)’ ( AC)’]’; COMPUERTA NAND S = (XYZ)’
ENTONCES: X= (A’B’C’)’ , Y=(AB)’, Z= ( AC)’.
X U2A
Y G
Z
7410N
45
FINALMENTE el circuito es:
13 U6A U4A
A 10
8
7400N
11 7410N
U7A U2A
B 14 G
12
U5A 9
7400N 7410N
15 U8A
C 7
7400N
7400N U3A
7400N
16 U9A U10A
X
Z = X'
DONDE: 7400N EQUIVALE A 7404N INVERSOR.
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 1 1 1
C’ C C’
(A + B + C)’ + (A’ + B’)’ + (A’+ C’)’ = A’B’C’ + AB + AC
TEOREMA DeMORAN
[H = A’B’C’ + AB + AC]’ H’ = [A’B’C’ + AB + AC]’
H’ = (A’B’C’)’ (AB)’ ( AC)’ = (A+B+C)(A’+B’)(A’+C’)
46
EL DIAGRAMA LÓGICO CORRESPONDIENTE S.
21 U16A
A 24 U15A
25
7402N 20
22 U17A 7402N
B U14A U11A 17 U13A
19 H
26
7402N
23 U18A 7402N 7427N 7402N
C 18
U12A
7402N
7427N
27 U19A U20A
=
DONDE. 7402N 7404N
47
A B’C’ B’C BC BC’
0 1 1 1
1 1 0 0
48
A2
A0 A1
U21A
1
2
7404N
3
U1A
4
7404N 5
U2A D12 6
1N3208
7404N D1 D3
D2 D4 D5 D6 D10
1N3208 D8 D9 D11
1N3208 D13 D14 D15 D16
1N3208 1N3208
1N3208
1N3208D7 1N3208 D17
11 1N32081N3208 1N3208
1N3208
1N3208
1N3208
1N3208
D18
10 1N3208
8 1N3208 13 12 14
16
9 7
1N3208
d
a,f b c e g
f = [2,4,5], g = [1,2,3,4,5,6] a
1 2 3 4 5 6 (direcciones) f b g
e c
d
49
Wikitronics Digital electronics
http://electronics.wikia.com/wiki/Digital_electronics
Digital electronics are those electronics systems that use a digital signal instead
of an analog signal. Digital electronics are the most common representation of
Boolean algebra and are the basis of all digital circuits for computers, mobile
phones, and numerous other consumer products.
The most common fundamental unit of digital electronics is the logic gate. By
combining numerous logic gates (from tens to hundreds of thousands) more
complex systems can be created. The complex system of digital electronics is
collectively referred to as a digital circuit.
To most electronic engineers, the terms "digital circuit", "digital system" and "logic"
are interchangeable in the context of digital circuits.
Advantages
The usual advantages of digital circuits when compared to analog circuits are:
Digital systems interface well with computers and are easy to control with
software. It is often possible to add new features to a digital system without
changing hardware, and to do this remotely, just by uploading new software.
Design errors or bugs can be worked-around with a software upgrade, after
the product is in customer hands.
Information storage can be much easier in digital systems than in analog
ones. In particular, the great noise-immunity of digital systems makes it
possible to store data and retrieve it later without degradation. In an analog
system, aging and wear and tear will degrade the information in storage, but
in a digital system, as long as the wear and tear is below a certain level, the
information can be recovered perfectly.
Robustness
One of the primary advantages of digital electronics stems from it simply being
digital: robustness. The robustness stems from the fact that if the noise is less than
the noise margin then the system performs as if there were no noise at all. This is a
necessary and sufficient property for a circuit to be considered digital. However, if
the noise exceeds this level, the circuit can give unexpected and undesired results
— perhaps catastrophic incorrect results.
50
Theoretically, there is no data-loss when copying digital data. This is a great
advantage over analog systems, which faithfully reproduce every bit of noise that
makes its way into the signal.
Disadvantages
Digital circuits use more energy than analog circuits to accomplish the same
calculations and signal processing tasks, thus producing more heat as well. In
portable or battery-powered systems this can be a major limiting factor, but in a
situation where power is plentiful, a digital system is often preferred because of all
the advantages listed above, especially that of (re-)programmability and ease of
upgrading without requiring hardware changes.
The world in which we live is analog, and signals from this world such as light,
temperature, sound, electrical conductivity, electric and magnetic fields, and
phenomena such as the flow of time, are for most practical purposes continuous
and thus analog quantities rather than discrete digital ones. For a digital system to
do useful things in the real world, translation from the continuous realm to the
discrete digital realm must occur, resulting in quantization errors. This problem can
usually be mitigated by designing the system to store enough digital data to
represent the signal to the desired degree of fidelity. The Nyquist-Shannon
sampling theorem provides an important guideline as to how much digital data is
needed to accurately portray a given analog signal.
Fragility
Digital systems can be fragile, in that if a single piece of digital data is lost or
misinterpreted, the meaning of large blocks of related data can completely change.
This problem can be mitigated by designing the digital system for robustness. For
example, a parity bit or other error-detecting or error-correcting code can be
inserted into the signal path so that if less than a certain fraction of the data is
corrupted, the system can determine that this has occurred and possibly uncorrupt
the data, or ask for the corrupted data to be resent. In a state-machine, the state
transition logic can be designed to catch all unused states and trigger a reset
51
sequence or other error recovery routine. For example, it is standard practice in
embedded software design to fill unused program memory with interrupt
instructions that point to an error recovery routine, to help guard against a failure
that corrupts the microcontroller's instruction pointer which could otherwise cause
random code to be executed.
Analog issues Digital circuits are made from analog components, and care has to
be taken in design so that the analog nature of these underlying components don't
dominate over the desired digital behavior. In particular, attention must be paid to
all noise and timing margins, to parasitic inductances and capacitances, to proper
filtering of power and ground connections, to electromagnetic coupling amongst
datalines, and many other details. Inattention to these can cause intermittent
problems such as "glitches", vanishingly-fast pulses that may trigger some logic but
not others, "runt pulses" that do not reach valid switching (threshold) voltages, or
unexpected ("undecoded") combinations of logic states.
A corollary of the fact that digital circuits are made from analog components is the
fact that digital circuits are slower to perform calculations than analog circuits that
occupy a similar amount of physical space and consume the same amount of
power. However, the digital circuit will perform the calculation with much better
repeatability, due to the high noise immunity of digital circuitry.
Construction
A digital circuit is often constructed from small electronic circuits called logic gates.
Each logic gate represents a function of boolean logic. A logic gate is an
arrangement of electrically controlled switches. The output is an electrical flow or
voltage, that can, in turn, control more logic gates. Logic gates often use the fewest
number of transistors in order to reduce their size, power consumption and cost,
and increase their reliability. Manufactured as integrated circuits, they are the least
expensive implementation when made in large volumes. They are usually designed
by engineers using electronic design automation software (See below for more
information).
Another form of digital circuit is constructed from lookup tables, (many sold as
"programmable logic devices", though other kinds of PLDs exist). Lookup tables
can perform all the same functions as machines based on logic gates, but lookup
tables can be easily reprogrammed without changing the wiring. This means that a
designer can often repair errors without changing the arrangement of wires.
Therefore, in small volume products, programmable logic devices are often the
preferred solution. They are usually designed by engineers using electronic design
automation software (See below for more information).
52
When the volumes are medium to large, and the logic can be slow, or involves
complex algorithms or sequences, often a small microcontroller is programmed to
make an embedded system. These are usually programmed by software
engineers.
When only one digital circuit is needed, and its design is totally customized, as for
a factory production line controller, the conventional solution is a programmable
logic controller, or PLC. These are usually programmed by electricians, using
ladder logic.
Engineers use many methods to minimize logic functions, in order to reduce the
complexity, and thus the number of errors and the expense of digital circuits. The
most widely used method is the application of a minimization algorithm within a
CAD system, although historically, truth tables, Karnaugh Maps, and Boolean
algebra have also been used.
The classical way to represent a digital circuit is with an equivalent set of logic
gates. Another way, often with the least electronics, is to construct an equivalent
system of electronic switches (usually transistors). One of the easiest ways is to
simply have a memory containing a truth table. The inputs are fed into the address
of the memory, and the data outputs of the memory become the outputs.
For automated analysis, these representations have digital file formats that can be
processed by computer programs. Most digital engineers are very careful to select
computer programs ("tools") with compatible file formats.
A combinatorial system always presents the same output when given the same
inputs. It is basically a representation of a set of logic functions, as already
discussed.
A sequential system is a combinatorial system with some of the outputs fed back
as inputs. This makes the digital machine perform a "sequence" of operations. The
simplest sequential system is probably a flip flop, a mechanism that represents a
binary digit or "bit".
53
Sequential systems are often designed as state machines. In this way, engineers
can design a system's gross behavior, and even test it in a simulation, without
considering all the details of the logic functions.
The state register is just a representation of a binary number. If the states in the
state machine are numbered (easy to arrange), the logic function is just some logic
that produces the number of the next state.
In comparison, asynchronous systems are very hard to design because all possible
states, in all possible timings must be considered. The usual method is to construct
a table of the minimum and maximum time that each such state can exist, and then
adjust the circuit to minimize the number of such states, and force the circuit to
periodically wait for all of its parts to enter a compatible state. (This is called "self-
resynchronization.") Without such careful design, it is easy to accidentally produce
asynchronous logic that is "unstable", that is, real electronics will have
unpredictable results because of the cumulative delays caused by small variations
in the values of the electronic components. Certain circuits (such as the
synchronizer flip-flops, switch debouncers, and the like which allow external
unsynchronized signals to enter synchronous logic circuits) are inherently
asynchronous in their design and must be analyzed as such.
As of now (2005), almost all digital machines are synchronous designs because it
is much easier to create and verify a synchronous design. However, asynchronous
logic is thought to be superior, if it can be made to work, because its speed is not
constrained by an arbitrary clock; instead, it simply runs at the maximum speed
permitted by the propagation rates of the logic gates from which it is constructed.
Building an asynchronous circuit using faster parts implicitly makes the circuit "go"
faster.
54
More generally, many digital systems are data flow machines. These are usually
designed using synchronous register transfer logic, using hardware description
languages such as VHDL or Verilog.
In register transfer logic, binary numbers are stored in groups of flip flops called
registers. The outputs of each register are a bundle of wires called a "bus" that
carries that number to other calculations. A calculation is simply a piece of
combinatorial logic. Each calculation also has an output bus, and these may be
connected to the inputs of several registers. Sometimes a register will have a
multiplexer on its input, so that it can store a number from any one of several
buses. Alternatively, the outputs of several items may be connected to a bus
through buffers that can turn off the output of all of the devices except one. A
sequential state machine controls when each register accepts new data from its
input.
In the 1980s, some researchers discovered that almost all synchronous register-
transfer machines could be converted to asynchronous designs by using first-in-
first-out synchronization logic. In this scheme, the digital machine is characterized
as a set of data flows. In each step of the flow, an asynchronous "synchronization
circuit" determines when the outputs of that step are valid, and presents a signal
that says, "grab the data" to the stages that use that stage's inputs. It turns out that
just a few relatively simple synchronization circuits are needed.
In this way, the complex task of designing the controls of a computer is reduced to
a simpler task of programming a relatively independent collection of much simpler
logic machines.
55
Automated design tools
To save costly engineering effort, much of the effort of designing large logic
machines has been automated. The computer programs are called "electronic
design automation tools" or just "EDA."
Simple truth table-style descriptions of logic are often optimized with EDA that
automatically produces reduced systems of logic gates or smaller lookup tables
that still produce the desired outputs.
Most practical algorithms for optimizing large logic systems use algebraic
manipulations or binary decision diagrams, and there are promising experiments
with genetic algorithms and annealing optimizations.
To automate costly engineering effort, some EDA can take state tables that
describe state machines and automatically produce a truth table for the
combinatorial part of a state machine. The state table is a piece of text that lists
each state, and the conditions that can exit that state.
Tool flows for large logic systems such as microprocessors can be thousands of
commands long, and combine the work of hundreds of engineers.
Parts of tool flows are "debugged" by testing the outputs of simulated logic
machines against expected inputs. The test tools take computer files with sets of
inputs and outputs, and highlight discrepancies between the simulated behavior
and the expected behavior.
These test data are usually called "test vectors." Often, the test vectors are
preserved and used in the factory to test that newly constructed logic machines
work correctly.
56
Design for testability
A large logic machine (say, with more than a hundred logical variables) can have
an astronomical number of possible states. Obviously, in the factory, testing every
state is impractical if testing each state takes a microsecond, and there are more
states than the number of microseconds since the universe began. Unfortunately,
this ridiculous-sounding case is typical.
One common test scheme known as "scan design" moves test bits serially (one
after another) from external test equipment through one or more serial shift
registers known as "scan chains". Serial scans have only one or two wires to carry
the data, and minimize the physical size and expense of the infrequently-used test
logic.
After all the test data bits are in place, the design is reconfigured to be in "normal
mode" and one or more clock pulses are applied, to test for faults (e.g. stuck-at low
or stuck-at high) and capture the test result into flip-flops and/or latches in the scan
shift register(s). Finally, the result of the test is shifted out to the block boundary
and compared against the predicted "good machine" result.
Another common testing scheme provides a test mode that forces some part of the
logic machine to enter a "test cycle." The test cycle usually exercises large
independent parts of the machine.
The cost of a logic gate is crucial. In the 1930s, the earliest digital logic systems
were constructed from telephone relays because these were inexpensive and
relatively reliable. After that, engineers always used the cheapest available
electronic switches that could still fulfill the requirements.
The earliest integrated circuits were a happy accident. They were constructed not
to save money, but to save weight, and permit the Apollo Guidance Computer to
control an inertial guidance system for a spacecraft. The first integrated circuit logic
57
gates cost nearly $50 (in 1960 dollars, when an engineer earned $10,000/year). To
everyone's surprise, by the time the circuits were mass-produced, they had
become the least-expensive method of constructing digital logic. Improvements in
this technology have driven all subsequent improvements in cost.
With the rise of integrated circuits, reducing the absolute number of chips used
represented another way to save costs. The goal of a designer is not just to make
the simplest circuit, but to keep the component count down. Sometimes this results
in slightly more complicated designs with respect to the underlying digital logic but
nevertheless reduces the number of components, board size, and even power
consumption.
For example, in some logic families, NAND gates are the simplest digital gate to
build. All other logical operations can be implemented by NAND gates. If a circuit
already required a single NAND gate, and a single chip normally carried four
NAND gates, then the remaining gates could be used to implement other logical
operations like logical and. This could eliminate the need for a separate chip
containing those different types of gates.
The "reliability" of a logic gate describes its mean time between failure (MTBF).
Digital machines often have millions of logic gates. Also, most digital machines are
"optimized" to reduce their cost. The result is that often, the failure of a single logic
gate will cause a digital machine to stop working.
Digital machines first became useful when the MTBF for a switch got above a few
hundred hours. Even so, many of these machines had complex, well-rehearsed
repair procedures, and would be nonfunctional for hours because a tube burned-
out, or a moth got stuck in a relay. Modern transistorized integrated circuit logic
gates have MTBFs of nearly a trillion (1x10^12) hours, and need them because
they have so many logic gates.
The "fan out" describes how many logic inputs can be controlled by a single logic
output. The minimum practical fan out is about five. Modern electronic logic using
CMOS transistors for switches have fanouts near fifty, and can sometimes go
much higher.
The "switching speed" describes how many times per second an inverter (an
electronic representation of a "logical not" function) can change from true to false
and back. Faster logic can accomplish more operations in less time. Digital logic
first became useful when switching speeds got above fifty hertz, because that was
faster than a team of humans operating mechanical calculators. Modern electronic
digital logic routinely switches at five gigahertz (5x109 hertz), and some laboratory
systems switch at more than a terahertz (1x1012 hertz).
58
Non-electronic logic
Hydraulic, pneumatic and mechanical versions of logic gates exist and are used in
situations where electricity cannot be used. The first two types are considered
under the heading of fluidics. One application of fluidic logic is in military hardware
that is likely to be exposed to a nuclear electromagnetic pulse (nuclear EMP, or
NEMP) that would destroy any electrical circuits.
Another example is that if two particular enzymes are required to prevent the
construction of a particular protein, this is the equivalent of a biological "NAND"
gate. The term digital signal is used to refer to more than one concept. It can refer
to discrete-time signals that are digitized, or to the waveform signals in a digital
system.
Discrete-time signals
59
In conceptual summary, a digital signal is a quantized discrete-time signal; a
discrete-time signal is a sampled analog signal.
In the Digital Revolution, the usage of digital signals has increased significantly.
Many modern media devices, especially the ones that connect with computers use
digital signals to represent signals that were traditionally represented as
continuous-time signals; cell phones, music and video players, personal video
recorders, and digital cameras are examples.
Digital signal: 1) Low level, 2) High level, 3) Rising edge, and 4) Falling edge.
Template:Main
The clock signal is a special digital signal that is used to synchronize digital
circuits. The image shown can be considered the waveform of a clock signal. Logic
changes are triggered either by the rising edge or the falling edge.
60
Logic voltage levels
Hobbyist frequency counter circuit built almost entirely of TTL logic chips.
The two states of a wire are usually represented by some measurement of electric
current: Voltage is the most common, but current is used in some logic families. A
threshold is designed for each logic family. When below that threshold, the wire is
"low," when above "high." Digital circuits establish a "no man's area" or "exclusion
zone" that is wider than the tolerances of the components. The circuits avoid that
area, in order to avoid indeterminate results.
It is usual to allow some tolerance in the voltage levels used; for example, 0 to 2
volts might represent logic 0, and 3 to 5 volts logic 1. A voltage of 2 to 3 volts would
be invalid and would occur only in a fault condition or during a logic level transition,
as most circuits are not purely resistive, and therefore cannot instantly change
voltage levels. However, few logic circuits can detect such a fault, and most will
just choose to interpret the signal randomly as either a 0 or a 1.
The levels represent the binary integers or logic levels of 0 and 1. In active-high
logic, "low" represents binary 0 and "high" represents binary 1. Active-low logic
uses the reverse representation.
https://www.youtube.com/watch?v=c8A_v_hKC7U&list=PLiivzYNnIS6FIUtKiG5-
R3L8Sbx_jRv6B&index=2
61
http://www.ee.usyd.edu.au/tutorials/digital_tutorial/part3/TOC.htm
Sequential Circuits
Introduction
62
The block diagram shows that the external outputs in a sequential circuit are a
function not only of external inputs but also of the present state of the memory
elements. The next state of the memory elements is also a function of external
inputs and the present state. Thus a sequential circuit is specified by a time
sequence of inputs, outputs, and internal states.
Quiz 1
These short quizzes are to refresh on what you have learnt so far.
Sequential circuits are divided into two main types: synchronous and
asynchronous. Their classification depends on the timing of their signals.
Synchronous sequential circuits change their states and output values at discrete
instants of time, which are specified by the rising and falling edge of a free-running
clock signal. The clock signal is generally some form of square wave as shown in
Figure 2 below.
63
Figure 2. Clock Signal
From the diagram you can see that the clock period is the time between
successive transitions in the same direction, that is, between two rising or two
falling edges. State transitions in synchronous sequential circuits are made to take
place at times when the clock is making a transition from 0 to 1 (rising edge) or
from 1 to 0 (falling edge). Between successive clock pulses there is no change in
the information stored in memory.
The reciprocal of the clock period is referred to as the clock frequency. The clock
width is defined as the time during which the value of the clock signal is equal to 1.
The ratio of the clock width and clock period is referred to as the duty cycle. A
clock signal is said to be active high if the state changes occur at the clock's rising
edge or during the clock width. Otherwise, the clock is said to be active low.
Synchronous sequential circuits are also known as clocked sequential circuits.
The memory elements used in synchronous sequential circuits are usually flip-
flops. These circuits are binary cells capable of storing one bit of information. A flip-
flop circuit has two outputs, one for the normal value and one for the complement
value of the bit stored in it. Binary information can enter a flip-flop in a variety of
ways, a fact which give rise to the different types of flip-flops. For information on
the different types of basic flip-flop circuits and their logical properties, see the
previous tutorial on flip-flops.
64
Summary of the Types of Flip-flop Behaviour
All flip-flops can be divided into four basic types: SR, JK, D and T. They differ in
the number of inputs and in the response invoked by different value of input
signals. The four types of flip-flops are defined in Table 1.
FLIP-
FLIP-FLOP CHARACTERISTIC CHARACTERISTIC EXCITATION
FLOP
SYMBOL TABLE EQUATION TABLE
NAME
S R Q(next) Q Q(next) S R
0 0 Q 0 0 0 X
Q(next) = S + R'Q
SR 0 1 0 0 1 1 0
SR = 0 1 0 0 1
1 0 1
1 1 ? 1 1 X 0
J K Q(next) Q Q(next) J K
0 0 Q 0 0 0 X
JK 0 1 0 Q(next) = JQ' + K'Q 0 1 1 X
1 0 1 1 0 X 1
1 1 Q' 1 1 X 0
Q Q(next) D
D Q(next) 0 0 0
D 0 0 Q(next) = D 0 1 1
1 1 1 0 0
1 1 1
Q Q(next) T
T Q(next) 0 0 0
T 0 Q Q(next) = TQ' + T'Q 0 1 1
1 Q' 1 0 1
1 1 0
65
pantunfla, sandalia. Flip plop.
http://www.thefreedictionary.com/flip-flop
Each of these flip-flops can be uniquely described by its graphical symbol, its
characteristic table, its characteristic equation or excitation table. All flip-flops have
output signals Q and Q'.
The characteristic table in the third column of Table 1 defines the state of each
flip-flop as a function of its inputs and previous state. Q refers to the present state
and Q(next) refers to the next state after the occurrence of the clock pulse. The
characteristic table for the RS flip-flop shows that the next state is equal to the
present state when both inputs S and R are equal to 0. When R=1, the next clock
pulse clears the flip-flop. When S=1, the flip-flop output Q is set to 1. The equation
mark (?) for the next state when S and R are both equal to 1 designates an
indeterminate next state.
The characteristic table for the JK flip-flop is the same as that of the RS when J
and K are replaced by S and R respectively, except for the indeterminate case.
When both J and K are equal to 1, the next state is equal to the complement of the
present state, that is, Q(next) = Q'.
The next state of the D flip-flop is completely dependent on the input D and
independent of the present state.
The next state for the T flip-flop is the same as the present state Q if T=0 and
complemented if T=1.
The characteristic table is useful during the analysis of sequential circuits when the
value of flip-flop inputs are known and we want to find the value of the flip-flop
output Q after the rising edge of the clock signal. As with any other truth table, we
can use the map method to derive the characteristic equation for each flip-flop,
which are shown in the third column of Table 1.
During the design process we usually know the transition from present state to the
next state and wish to find the flip-flop input conditions that will cause the required
transition. For this reason we will need a table that lists the required inputs for a
given change of state. Such a list is called the excitation table, which is shown in
66
the fourth column of Table 1. There are four possible transitions from present state
to the next state. The required input conditions are derived from the information
available in the characteristic table. The symbol X in the table represents a "don't
care" condition, that is, it does not matter whether the input is 1 or 0.
State Table
The state table representation of a sequential circuit consists of three sections
labelled present state, next state and output. The present state designates the
state of flip-flops before the occurrence of a clock pulse. The next state shows the
states of flip-flops after the clock pulse, and the output section lists the value of the
output variables during the present state.
State Diagram
In addition to graphical symbols, tables or equations, flip-flops can also be
represented graphically by a state diagram. In this diagram, a state is represented
by a circle, and the transition between states is indicated by directed lines (or arcs)
connecting the circles. An example of a state diagram is shown in Figure 3 below.
67
Figure
3. State
Diagram
The binary number inside each circle identifies the state the circle represents. The
directed lines are labelled with two binary numbers separated by a slash (/). The
input value that causes the state transition is labelled first. The number after the
slash symbol / gives the value of the output. For example, the directed line from
state 00 to 01 is labelled 1/0, meaning that, if the sequential circuit is in a present
state and the input is 1, then the next state is 01 and the output is 0. If it is in a
present state 00 and the input is 0, it will remain in that state. A directed line
connecting a circle with itself indicates that no change of state occurs. The state
diagram provides exactly the same information as the state table and is obtained
directly from the state table.
Example: This example is taken from P. K. Lala, Practical Digital Logic Design and
Testing, Prentice Hall, 1996, p.155.
Consider a sequential circuit shown in Figure 4. It has one input x, one output Z
and two state variables Q1Q2 (thus having four possible present states 00, 01, 10,
11).
68
Figure 4.
A
Sequential
Circuit
Z = x*Q1
D1 = x' + Q1
D2 = x*Q2' + x'*Q1'
These equations can be used to form the state table. Suppose the present state
(i.e. Q1Q2) = 00 and input x = 0. Under these conditions, we get Z = 0, D1 = 1, and
D2 = 1. Thus the next state of the circuit D1D2 = 11, and this will be the present
state after the clock pulse has been applied. The output of the circuit
corresponding to the present state Q1Q2 = 00 and x = 1 is Z = 0. This data is
entered into the state table as shown in Table 2.
Present
Next State Output
State
x=0 x=1 x=0 x=1
Q1Q2
00 11 01 0 0
01 11 00 0 0
10 10 11 0 1
11 10 10 0 1
The state diagram for the sequential circuit in Figure 4 is shown in Figure 5.
69
Figure
5. State
Diagram
of
circuit
in
Figure
4.
SR
JK
70
D
You can see from the table that all four flip-flops have the same number of states
and transitions. Each flip-flop is in the set state when Q=1 and in the reset state
when Q=0. Also, each flip-flop can move from one state to another, or it can re-
enter the same state. The only difference between the four types lies in the values
of input signals that cause these transitions.
71
We start with the
logic schematic from
which we can derive
excitation equations
for each flip-flop
input. Then, to
obtain next-state
equations, we insert
the excitation
equations into the
characteristic
equations. The
output equations can
be derived from the
schematic, and once
we have our output
and next-state
equations, we can
generate the next-
state and output
tables as well as
state diagrams.
When we reach this
stage, we use either
the table or the state
diagram to develop a
timing diagram
which can be verified
through simulation.
Figure 6. Analysis
procedure of
sequential circuits.
72
Now let's look at some examples, using these procedures to analyse a sequential
circuit.
This example is taken from D. D. Gajski, Principles of Digital Design, Prentice Hall, 1997,
p.230.
Derive the state table and state diagram for the sequential circuit shown in Figure
7.
Figure 7.
Logic
schematic
of a
sequential
circuit.
SOLUTION:
STEP 1: First we derive the Boolean expressions for the inputs of each flip-flops
in the schematic, in terms of external input Cnt and the flip-flop outputs Q1 and Q0.
Since there are two D flip-flops in this example, we derive two expressions for D1
and D0:
These Boolean expressions are called excitation equations since they represent
the inputs to the flip-flops of the sequential circuit in the next clock cycle.
73
Q1(next) = D1 = Cnt'*Q1 + Cnt*Q1'*Q0 + Cnt*Q1*Q0'
STEP 3: Now convert these next-state equations into tabular form called the
next-state table.
Each row is corresponding to a state of the sequential circuit and each column
represents one set of input values. Since we have two flip-flops, the number of
possible states is four - that is, Q1Q0 can be equal to 00, 01, 10, or 11. These are
present states as shown in the table.
For the next state part of the table, each entry defines the value of the sequential
circuit in the next clock cycle after the rising edge of the Clk. Since this value
depends on the present state and the value of the input signals, the next state
table will contain one column for each assignment of binary values to the input
signals. In this example, since there is only one input signal, Cnt, the next-state
table shown has only two columns, corresponding to Cnt = 0 and Cnt = 1.
Note that each entry in the next-state table indicates the values of the flip-flops in
the next state if their value in the present state is in the row header and the input
values in the column header.
Each of these next-state values has been computed from the next-state equations
in STEP 2.
STEP 4: The state diagram is generated directly from the next-state table,
shown in Figure 8.
74
Figure
8. State
diagram
Each arc is labelled with the values of the input signals that cause the transition
from the present state (the source of the arc) to the next state (the destination of
the arc).
In general, the number of states in a next-state table or a state diagram will equal
2m , where m is the number of flip-flops. Similarly, the number of arcs will equal 2m
x 2k , where k is the number of binary input signals. Therefore, in the state diagram,
there must be four states and eight transitions. Following these transition arcs, we
can see that as long as Cnt = 1, the sequential circuit goes through the states in
the following sequence: 0, 1, 2, 3, 0, 1, 2, .... On the other hand, when Cnt = 0, the
circuit stays in its present state until Cnt changes to 1, at which the counting
continues.
To see how the states changes corresponding to the input signals Cnt, click on this
image.
Below, we show a timing diagram, representing four clock cycles, which enables us
to observe the behaviour of the counter in greater detail.
75
Figure
9.
Timing
Diagram
In this timing diagram we have assumed that Cnt is asserted in clock cycle 0 at t 0
and is disasserted in clock cycle 3 at time t4. We have also assumed that the
counter is in state Q1Q0 = 00 in the clock cycle 0. Note that on the clock's rising
edge, at t1, the counter will go to state Q1Q0 = 01 with a slight propagation delay;
in cycle 2, after t2, to Q1Q0 = 10; and in cycle 3, after t3 to Q1Q0 = 11. Since Cnt
becomes 0 at t4, we know that the counter will stay in state Q1Q0 = 11 in the next
clock cycle. To see the timing behaviour of the circuit click on this image
.
This example is taken from D. D. Gajski, Principles of Digital Design, Prentice Hall, 1997,
p.234.
76
Example 1.2
Derive the next state, the output table and the state diagram for the sequential
circuit shown in Figure 10.
Figure
10. Logic
schematic
of a
sequential
circuit.
SOLUTION:
The input combinational logic in Figure 10 is the same as in Example 1.1, so the
excitation and the next-state equations will be the same as in Example 1.1.
Excitation equations:
Next-state equations:
As this equation shows, the output Y will equal to 1 when the counter is in state
Q1Q0 = 11, and it will stay 1 as long as the counter stays in that state.
77
Next-state and output table:
Next State
Present State Output
Cnt=0 Cnt=1
Q1 Q0 Z
00 00 01 0
01 01 10 0
10 10 11 0
11 11 00 1
State diagram:
Figure
11. State
diagram
of
sequential
circuit in
Figure
10.
To see
how the
states
move
from one
to another
click on
the
image.
78
Timing diagram:
Figure 12.
Timing
diagram of
sequential
circuit in
Figure 10.
Click on
the image
to see its
timing
behaviour.
Note that the counter will reach the state Q1Q0 = 11 only in the third clock cycle,
so the output Y will equal 1 after Q0 changes to 1. Since counting is disabled in the
third clock cycle, the counter will stay in the state Q1Q0 = 11 and Y will stay
asserted in all succeeding clock cycles until counting is enabled again.
The recommended steps for the design of sequential circuits are set out below.
79
For information on state reduction.
80
Example 1.3 We wish to design a synchronous sequential circuit whose state
diagram is shown in Figure 13. The type of flip-flop to be use is J-K.
Figure
13.
State
diagram
From the state diagram, we can generate the state table shown in Table 9. Note
that there is no output section for this circuit. Two flip-flops are needed to represent
the four states and are designated Q0Q1. The input variable is labelled x.
Next State
Present State
x=0 x=1
Q0 Q1
00 00 01
01 10 01
10 10 11
11 11 00
We shall now derive the excitation table and the combinational structure. The table
is now arranged in a different form shown in Table 11, where the present state and
input variables are arranged in the form of a truth table. Remember, the excitable
for the JK flip-flop was derive in Table 1.
81
Table 10. Excitation table for JK flip-flop
Q Q(next) JK
0 0 0 X
0 1 1 X
1 0 X 1
1 1 X 0
Flip-flop Inputs
Present State Next State Input
J0K0 J1K1
Q0 Q1 Q0 Q1 X
00 00 0 0X 0X
00 01 1 0X 1X
01 10 0 1X X1
01 01 1 0X X0
10 10 0 X0 0X
10 11 1 X0 1X
11 11 0 X0 X0
11 00 1 X1 X1
In the first row of Table 11, we have a transition for flip-flop Q0 from 0 in the
present state to 0 in the next state. In Table 10 we find that a transition of states
from 0 to 0 requires that input J = 0 and input K = X. So 0 and X are copied in the
first row under J0 and K0 respectively. Since the first row also shows a transition
82
for the flip-flop Q1 from 0 in the present state to 0 in the next state, 0 and X are
copied in the first row under J1 and K1. This process is continued for each row of
the table and for each flip-flop, with the input conditions as specified in Table 10.
The simplified Boolean functions for the combinational circuit can now be derived.
The input variables are Q0, Q1, and x; the output are the variables J0, K0, J1 and
K1. The information from the truth table is plotted on the Karnaugh maps shown in
Figure 14.
J0 = Q1*x' K0 = Q1*x
Figure
15. Logic
diagram
of the
sequential
circuit.
83
Design of Sequential Circuits
This example is taken from P. K. Lala, Practical Digital Logic Design and Testing,
Prentice Hall, 1996, p.176.
Example 1.4 Design a sequential circuit whose state tables are specified in
Table 12, using D flip-flops.
0
0 0
0 1 1
1 0 0
1 1
1
Next step is to derive the excitation table for the design circuit, which is shown in
Table 14. The output of the circuit is labelled Z.
Flip-flop
Present State Next State Input Output
Inputs
Q0 Q1 Q0 Q1 x Z
D0 D1
00 00 0 0 0 0
00 01 1 0 1 0
01 00 0 0 0 0
01 10 1 1 0 0
10 11 0 1 1 0
84
10 10 1 1 0 0
11 00 0 0 0 0
11 01 1 0 1 1
Now plot the flip-flop inputs and output functions on the Karnaugh map to derive
the Boolean expressions, which is shown in Figure 16.
D0 = Q0*Q1' + Q0'*Q1*x
D1 = Q0'*Q1'*x + Q0*Q1*x + Q0*Q1'*x'
Z = Q0*Q1*x
85
Figure 17. Logic diagram of the sequential circuit.
Design of Counters
A sequential circuit that goes through a prescribed sequence of states upon the
application of input pulses is called a counter. The input pulses, called count
pulses, may be clock pulses. In a counter, the sequence of states may follow a
binary count or any other sequence of states. Counters are found in almost all
equipment containing digital logic. They are used for counting the number of
occurrences of an even and are useful for generating timing sequences to control
operations in a digital system.
Of the various sequences a counter may follow, the straight binary sequence is the
simplest and most straight forward. A counter that follows the binary sequence is
called a binary counter. An n-bit binary counter consists of n flip-flops and can
count in binary from 0 to 2n - 1.
Design of Counters
This example is taken from T. L. Floyd, Digital Fundamentals, Fourth Edition, Macmillan
Publishing, 1990, p.395.
Example 1.5 A counter is first described by a state diagram, which is shows the
sequence of states through which the counter advances when it is clocked. Figure
18 shows a state diagram of a 3-bit binary counter.
Figure 18.
State
diagram of
a 3-bit
binary
counter.
86
The circuit has no inputs other than the clock pulse and no outputs other than its
internal state (outputs are taken off each flip-flop in the counter). The next state of
the counter depends entirely on its present state, and the state transition occurs
every time the clock pulse occurs. Figure 19 shows the sequences of count after
each clock pulse.
Once the sequential circuit is defined by the state diagram, the next step is to
obtain the next-state table, which is derived from the state diagram in Figure 18
and is shown in Table 15.
87
Since there are eight states, the number of flip-flops required would be three. Now
we want to implement the counter design using JK flip-flops.
Next step is to develop an excitation table from the state table, which is shown in
Table 16.
0 0 0 0 0 1 0X 0X 1X
0 0 1 0 1 0 0X 1X X1
0 1 0 0 1 1 0X X0 1X
0 1 1 1 0 0 1X X1 X1
1 0 0 1 0 1 X0 0X 1X
1 0 1 1 1 0 X0 1X X1
1 1 0 1 1 1 X0 X0 1X
1 1 1 0 0 0 X1 X1 X1
Now transfer the JK states of the flip-flop inputs from the excitation table to
Karnaugh maps to derive a simplified Boolean expression for each flip-flop input.
This is shown in Figure 20.
88
Figure
20.
Karnaugh
maps
The 1s in the Karnaugh maps of Figure 20 are grouped with "don't cares" and the
following expressions for the J and K inputs of each flip-flop are obtained:
J0 = K0 = 1
J1 = K1 = Q0
J2 = K2 = Q1*Q0
The final step is to implement the combinational logic from the equations and
connect the flip-flops to form the sequential circuit. The complete logic of a 3-bit
binary counter is shown in Figure 21.
Figure
21.
Logic
diagram
of a 3-
bit
binary
counter
89
Design of Counters
This example is taken from M. M. Mano, Digital Design, Prentice Hall, 1984, p.243.
Example 1.6 Design a counter specified by the state diagram in Example 1.5
using T flip-flops. The state diagram is shown here again in Figure 22.
Figure 22.
State
diagram of
a 3-bit
binary
counter.
Now derive the excitation table from the state table, which is shown in Table 17.
0 0 1 0 1 0 0 1 1
0 1 0 0 1 1 0 0 1
0 1 1 1 0 0 1 1 1
1 0 0 1 0 1 0 0 1
90
1 0 1 1 1 0 0 1 1
1 1 0 1 1 1 0 0 1
1 1 1 0 0 0 1 1 1
Next step is to transfer the flip-flop input functions to Karnaugh maps to derive a
simplified Boolean expressions, which is shown in Figure 23.
Figure
23.
Karnaugh
maps
T0 = 1; T1 = Q0; T2 = Q1*Q0
Finally, draw the logic diagram of the circuit from the expressions obtained. The
complete logic diagram of the counter is shown in Figure 24.
Figure 24.
Logic
diagram of
3-bit
binary
counter.
To see the timing and state transitions of the counter, click on this image.
91
Now that you have reached the end of the tutorial, you should be able to
understand the basic concept of sequential circuits. You should be able to analyse
and design a basic sequential circuit. Now you can practice some of the exercises
using the analysis and design procedures shown in the examples.
Exercises
You can try some of these exercises which covers the analysis and design of
sequential circuits.
Figure
1.1
Figure
1.2
92
Figure
1.3
4. Derive the state output and state diagran for the sequential circuit shown in
Figure 1.4.
Figure
1.4
D1 = Q1 + x'*Q2
D2 = x*Q1' + x'*Q2
Z = x'*Q1*Q2 + x*Q1'*Q2'
Derive the state table and draw the state diagram of the circuit.
Table 6.1
93
10 11 10 0 0
11 00 01 0 1
10. Design a counter with the following binary sequence: 1, 2, 5, 7 and repeat.
Use JK flip-flops.
12. Design a counter that counts in the sequence 0, 1, 3, 6, 10, 15, using four a)
D, b) SR, c) JK and d) T flip-flops.
DICTIONARY
http://www.thefreedictionary.com/flip-flop
flip-flop (fl p fl p ) n.
1. The movement or sound of repeated flapping.
2. Informal A reversal, as of a stand or position: a foreign policy flip-flop.
3. A backless, often foam rubber sandal held to the foot at the big toe by means of a thong.
4. A backward somersault or handspring.
5. Electronics An electronic circuit or mechanical device capable of assuming either of two stable
states, especially a computer circuit used to store a single bit of information.
v. flip-flopped, flip-flop·ping, flip-flops
v.intr.
1. To move back and forth between two conditions or circumstances, sometimes repeatedly: "The
weather has flip-flopped between sweltering heat and violent storms" (New York Times).
2. To reverse a stand or position: "With the board having flip-flopped over zoning issues in the last
several years, residents are looking to this fall's election for clarity" (Eugene L. Meyer).
3. To execute a backward somersault or handspring.
v.tr.
To move from one position to the reverse or opposite: The coach flip-flopped the linemen.
94
flip -flop per n.
The American Heritage® Dictionary of the English Language, Fourth Edition copyright
©2000 by Houghton Mifflin Company. Updated in 2009. Published by Houghton Mifflin
Company. All rights reserved.
flip-flop n
2. (Electronics) Also called: bistable an electronic device or circuit that can assume either of two
stable states by the application of a suitable pulse
5. (Clothing & Fashion) a rubber-soled sandal attached to the foot by a thong between the big toe
and the next toeAlso called (US, Canadian, Austral, and NZ): thong
adv
flip′-flop`
2. a backward somersault.
95
3. Also called flip′-flop` cir`cuit. an electronic circuit having two stable conditions, each one
corresponding to one of two alternative input signals.
5. a flat backless shoe or slipper, esp. one of rubber with a thong between the first two toes.
v.i.
6. to perform a flip-flop.
[1655–65]
Random House Kernerman Webster's College Dictionary, © 2010 K Dictionaries Ltd. Copyright
2005, 1997, 1991 by Random House, Inc. All rights reserved.
flip-flop
Past participle: flip-flopped
Gerund: flip-flopping
Imperative
flip-flop
deciding, decision making - the cognitive process of reaching a decision; "a good
executive must be good at decision making"
thong
96
3. flip-flop - an electronic circuit that can assume either of two stable states
circuit, electric circuit, electrical circuit - an electrical device that provides a path for
electrical current to flow
change by reversal, reverse, turn - change to the contrary; "The trend was reversed"; "the
tides turned against him"; "public opinion turned when it was revealed that the president
had an affair with a White House intern"
KKKKKKKKKKKKKKKKKKKK
www.miniinthebox.com/Placas_Arduino
http://www.taringa.net/comunidades/arduinga/4518720/Principales-comandos-C-C-de-
Arduino.html
http://www.arduino.cc/en/Reference/HomePage
Arduino programs can be divided in three main parts: structure, values (variables and constants),
and functions.
Principales comandos
(C/C++) de Arduino
Functions
97
Variables Digital I/O
Structure
Constants pinMode()
setup() digitalWrite()
loop() HIGH | LOW digitalRead()
INPUT | OUTPUT |
Control Structures INPUT_PULLUP Analog I/O
LED_BUILTIN
true | false
if analogReference()
integer constants
if…else analogRead()
floating point
for analogWrite() - PWM
constants
switch case
while Due & Zero only
do… while Data Types
break analogReadResolution()
continue void analogWriteResolution()
return boolean
char
goto Advanced I/O
unsigned char
Further Syntax byte
tone()
int
noTone()
unsigned int
; (semicolon) shiftOut()
word
{} (curly braces) shiftIn()
long
// (single line pulseIn()
unsigned long
comment)
short
/* */ (multi-line Time
float
comment)
double
#define millis()
string - char array
#include micros()
String - object
array delay()
Arithmetic Operators delayMicroseconds()
Conversion
= (assignment Math
operator)
char()
+ (addition) min()
byte()
- (subtraction) max()
int()
* (multiplication) abs()
word()
/ (98ivisión) constrain()
long()
% (modulo) map()
float()
pow()
sqrt()
Comparison Operators
Variable Scope & Trigonometry
Qualifiers
== (equal to)
sin()
¡= (not equal to)
98
< (less 99iv) cos()
> (greater 99iv) variable scope tan()
<= (less than or static
equal to) volatile Random Numbers
>= (greater than or const
equal to) randomSeed()
Utilities random()
Boolean Operators
sizeof() Bits and Bytes
&& (and) PROGMEM
|| (or) lowByte()
¡ (not) highByte()
bitRead()
Pointer Access Operators bitWrite()
bitSet()
* dereference bitClear()
operator bit()
& reference operator
External Interrupts
Bitwise Operators
attachInterrupt()
& (bitwise and) detachInterrupt()
| (bitwise or)
^ (bitwise xor) Interrupts
~ (bitwise not)
<< (bitshift left) interrupts()
>> (bitshift right) noInterrupts()
Communication
Serial
Stream
Compound Operators
99
bitwise and)
|= (compound
bitwise or)
while:
Se ejecuta continuamente hasta que la expresión dentro del paréntesis pasa a ser falsa.
while(operación booleana){
acción
break:
Es usado para salir de los bucles do, for, o while, pasando por alto la condición normal del bucle. Es
usado también para salir de una estructura de control switch.
digitalWrite:
Escribe un valor HIGH (5V o 3.3V) o LOW (0V, tierra) hacia un pin digital.
digitalWrite(PIN, HIGH/LOW)
digitalRead:
Lee el valor de un pin digital especificado (HIGH o LOW).
digitalRead(PIN)
analogRead:
Lee el valor de tensión en el pin analógico especificado. La placa Arduino posee 6 canales (8
canalaes en el Mini y Nano y 16 en el Mega) conectados a un conversor analógico digital de 10
bits. Esto significa que convertirá tensiones entre 0 y 5 voltios a un número entero entre 0 y 1023.
100
Esto proporciona una resolución en la lectura de: 5 voltios / 1024 unidades, es decir, 0.0049 voltios
(4.9 mV) por unidad.
El conversor tarda aproximadamente 100 microsegundos (0.0001 segundos) en leer una entrada
analógica por lo que se puede llevar una tasa de lectura máxima aproximada de 10.000 lecturas
por segundo.
analogRead(PIN)
analogReference:
DEFAULT: Es el valor de referencia analógico que viene por defecto que de 5 voltios en placas
Arduino de y de 3.3 voltios en placas Arduino que funcionen con 3.3 voltios.
INTERNAL: Es una referencia de tensión interna de 1.1 voltios en el ATmega168 o ATmega328 y de
2.56 voltios en el ATmega8.
EXTERNAL: Se usará una tensión de referencia externa que tendrá que ser conectada al pin AREF.
101