The serial port of the microcontroller provides the easiest way by which the user and the microcontroller can write their data in the same medium and both can read each other’s data. The LCD module makes an embedded system completely independent with which the system can take analog or digital input on its input pins and display the corresponding output in its own screen along with generating other kind of outputs.The serial communication port is one of the communication medium available in almost all microcontrollers. It is the most effective communication method available with a microcontroller. The serial port of the microcontroller provides the easiest way by which the user and the microcontroller can write their data in the same medium and both can read each other’s data. When the serial port of the microcontroller is connected to the PC and the incoming and outgoing data is monitored using software and displayed in a window, it forms the simplest text user interface (TUI) setup for the microcontroller.
The Arduino board is built around an AVR microcontroller and it has all the required circuitary to get the built-in AVR microcontroller running. The Arduino can communicate with the other devices using its digital I/O, serial port, I2C port, SPI port etc. Any AVR microcontroller based board which follows the standard Arduino schematic and is flashed with the Arduino bootloader can be called an Arduino board. The Arduino IDE is so simple to use that anyone who has basic knowledge of c programming can quickly get started with it. The project on Getting started with Arduino explains about the steps required to get start with an Arduino board.
Fig. 4: External USB to TTL converter board for programming Arduino and serial communication
Project Source Code
### /*================================= EG LABS ======================================= Receive a character through the serial port of the PC and display the same cahracter in a 16*2 LCD along with glowing an LED each time The circuit: * LED attached from pin 5 to ground through a 1K resistor LCD: * LCD RS pin to digital pin 12 * LCD Enable pin to digital pin 11 * LCD D4 pin to digital pin 5 * LCD D5 pin to digital pin 4 * LCD D6 pin to digital pin 3 * LCD D7 pin to digital pin 2 * LCD R/W pin to ground * 10K resistor: * ends to +5V and ground * wiper to LCD pin 3 * LED anode attached to digital output 6 * LED cathode attached to ground through a 1K resistor //================================= EG LABS =======================================*/ // include the library code: #include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // give the pin a name: int led = 6; // incoming byte char inByte; void setup() { // initialize the led pin as an output. pinMode(led, OUTPUT); // set up the LCD's number of columns and rows: lcd.begin(16, 2); // initialize the serial communications: Serial.begin(9600); } void loop() { // if we get a valid byte, read analog ins: if(Serial.available()) { // get incoming byte: inByte = Serial.read(); // send the same character to the LCD lcd.clear(); lcd.setCursor(7, 0); lcd.write(inByte); // glow the LED digitalWrite(led, HIGH); delay(200); } else digitalWrite(led, LOW); } ###
Circuit Diagrams
Project Components
Project Video
Filed Under: Arduino Projects
Filed Under: Arduino Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.