Three State Logic Application
Three State Logic Application
AUTOMATION ENGINEERING
SUBJECT:
Digital Systems and Reconfigurable Logic 1
Practice:
“Three-state logic application and primary memory by using sequential digital
systems”
NAME:
Cruz Salinas Samantha.
DOSSIER: 269972
PRESENTED TO:
Dr. Juvenal Rodríguez Reséndiz.
Content
Goal....................................................................................................................................... 3
Methodology.........................................................................................................................3
Results................................................................................................................................... 7
Conclusion.............................................................................................................................7
Goal
To perform the skills in the digital systems environment by learning the concepts of three-
state logic, programming, and bidirectional busses.
Methodology
Materials
Implementation
For the practical part we review the datasheets of the integrated circuits.
The pinout of the octal latch is:
The truth table is as follows:
And finally, we reviewed the recommended operating conditions, such as the supply
voltage range of 2V to 6V.
In the part of the octal buffer we also saw the recommended operating conditions:
Code
The code we developed for reading and writing to the same 8-bit port creating a
bidirectional bus is as follows:
#include "Arduino.h"
#define ENABLE_LATCH_PIN 3
#define ENABLE_BUFFER_PIN 2
// Define the display patterns for each digit
const byte displayPatterns[16] = {
0b00111111, // 0
0b00000110, // 1
0b01011011, // 2
0b01001111, // 3
0b01100110, // 4
0b01101101, // 5
0b01111101, // 6
0b00000111, // 7
0b01111111, // 8
0b01101111, // 9
0b01110111, // A
0b01111100, // B
0b00111001, // C
0b01011110, // D
0b01111001, // E
0b01110001 // F}
void setup() {
Serial.begin(9600);
for (int i = 4; i < 12; i++) {
pinMode(i, INPUT);}
pinMode(ENABLE_LATCH_PIN, OUTPUT);
pinMode(ENABLE_BUFFER_PIN, OUTPUT);}
void loop() {
int receivedBits = 0;
for (int i = 4; i < 12; i++) { // Set pins D4 to D11 as inputs again
pinMode(i, INPUT); }
delayMicroseconds(20);
digitalWrite(ENABLE_BUFFER_PIN, LOW); // Enable buffering
receivedBits = digitalRead(4) * 8 + digitalRead(5) * 4 + digitalRead(6) * 2 + digitalRead(7);
delay(20);
digitalWrite(ENABLE_BUFFER_PIN, HIGH); // Disable buffering
for (int i = 4; i < 12; i++) { // Set pins D4 to D11 as Output
pinMode(i, OUTPUT);}
delayMicroseconds(20);
// Display the received bits
if (receivedBits >= 0 && receivedBits < 16) {
displayDigit(displayPatterns[receivedBits]);}
digitalWrite(ENABLE_LATCH_PIN, HIGH);
delay(50);
digitalWrite(ENABLE_LATCH_PIN, LOW);
Serial.println(receivedBits);
delay(20);}
void displayDigit(byte pattern) {
// Display the pattern on pins D4 to D11
for (int i = 4; i < 12; i++) {
digitalWrite(i, pattern & 0x01); // Set the pin according to the least significant bit of the
pattern
pattern >>= 1; // Shift the pattern to the right}}
To connect all these components to the microcontroller we use the next diagram:
Circuit image
Results
Conclusion
In this practice, we successfully demonstrated the creation of a bidirectional bus using a
microcontroller interfaced with digital logic components. By initializing the system and
setting up the microcontroller's port pins as inputs and outputs, we were able to establish
bidirectional communication.
The key steps included:
- Initializing the system and configuring input/output settings.
- Setting an 8-bit port as inputs to read data from an external source.
- Employing control signals to enable specific operations (latching and buffering) using the
74LS244 and HCT573 components respectively.
- Continuously reading 8-bit data from the bidirectional bus and processing it based on
predefined logic using a switch-case structure.
- Switching the port from input to output mode as needed to write data back to the bus.
This exercise illustrates practical aspects of sequential digital systems, emphasizing the
integration of microcontroller programming with hardware components to create efficient
bidirectional data transfer. By implementing this project, we gain insights into real-world
applications of digital logic and microcontroller interfacing techniques, which are
fundamental in various embedded systems and electronic devices. The ability to read and
write from the same port facilitates versatile data communication and control, enabling
sophisticated functionalities in digital systems.