0% found this document useful (0 votes)
14 views

Assignment 1

Uploaded by

floydmustang1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Assignment 1

Uploaded by

floydmustang1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

FACULTY OF ENGINEERING AND THE BUILT ENVIROMENT DEPARTMENT OF

ELECTRICAL ENGINEERING TECHNOLOGY


Surname and initials: Madiope, T
Student number: 221158199
Module name: Digital Systems 2B
Module code: DIGELB2
Assignment name: File Dump
Lecturer: Dr J. Venter
Table of Contents
Introduction....................................................................................................................................... 2
Circuit diagrams of all constructed circuits ........................................................................................ 2
Explanation of circuit operation ......................................................................................................... 2
Components list ................................................................................................................................. 2
Measurements and analysis results of circuit operation ...................................................................... 3
Conclusion ........................................................................................................................................ 6

1
Introduction
Universal Serial Asynchronous Receiver Transmitter (USART) is a serial communication protocol. It
is used to serially receive or transmit data at a specific baud rate. Baud rate is the time taken to
transmit or receive data in a communication channel.
In this practical, a Liquid Crystal Display (LCD) screen will be used along with the Arduino. The
LCD will display that the file that will be changed has been received and changed, and then
transmitted back to the PC.

Circuit diagrams of all constructed circuits

Figure 1: Circuit Diagram

Explanation of circuit operation

In the circuit diagram a potentiometer is present to adjust the contrast of the LCD screen. Two tactile
push buttons are used to change and transmit the changed file to the PC. Digital pins 4 to 7 are used to
transfer data from the Arduino to the LCD.
Since the power supply is from the computer, the serial monitor can be seen on the computer.

Components list
1. Potentiometer
2. Jumper wires
3. Tactile push button × 2
4. 10kΩ resistor × 2
5. 220Ω resistor
6. Arduino Uno ATmega328
7. PC/Computer (power supply)

2
Measurements and analysis results of circuit operation
CODE:
#include <LiquidCrystal.h>
#include <string.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

int button1 = 1;
int button2 = 2;

int button1_State = 0;
int button2_State = 0;

int state = 0;
bool has_written_to_pc = false;

void setup()
{
pinMode(button1, INPUT);
pinMode(button2, INPUT);
lcd.begin(16, 2);
Serial.begin(9600);

// write to PC
Serial.println("I, #Student name and surname, are happy to have face to face classes in Digital
Systems B2.");
Serial.println("My student number is #student number");
Serial.println("My goal for the post-pandemic phase of my studies are #goal.");
}

void loop()
{
// stage 0 - means file is sent from PC - waiting for user to push button
state=0;

3
button1_State = digitalRead(button1);
if (button1_State == HIGH)
{
state = 1;
}
button2_State = digitalRead(button2);
if (button2_State == HIGH)
{
state = 2;
}

lcd.clear();
lcd.setCursor(0, 0);
lcd.print("File received!");
delay(5000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Press 1st pushbutton to change txt");
for (int i = 0; i < 20; i++)
{
lcd.scrollDisplayLeft();
delay(500);
}

delay(2);

switch (state){
case 1:
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Change has been made!");

for (int i = 0; i < 10; i++)


{
4
lcd.scrollDisplayLeft();
delay(500);
}

lcd.clear();
lcd.setCursor(0, 0);
has_written_to_pc = false;
lcd.print("Press 2nd pushbutton to send file back to PC");
for (int i = 0; i < 28; i++)
{
lcd.scrollDisplayLeft();
delay(500);
}

delay(5);
break;
case 2:
Serial.println("");
Serial.println("I, Madiope, T, are happy to have face to face classes in Digital Systems B2.");
Serial.println("My student number is 221158199");
Serial.println("My goal for the post-pandemic phase of my studies are get my honors");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("file sent to PC");
for (int i = 0; i < 10; i++)
{
lcd.scrollDisplayLeft();
delay(500);
}
break;
}
}

5
OUTPUT:

Figure 2: Output Serial Monitor

Analysis
Once the command or code is executed at first, it never repeats. Some modifications to the code were
implemented, however none were successful. Using an LCD shield and a separate LCD screen seems
to produce a valid output. Theoretically, since the shield pushbuttons share one analog pin, that could
be the fault.

Conclusion
It is wiser not to use a shield for this practical. Serial library and Liquid Crystal library were used to
perform the practical. The LCD screen indicated that the file was received, changed and transferred
back to the PC with the changes being implemented.

You might also like