Arduino Forum

Topics => Education and Teaching => Topic started by: GolamMostafa on Mar 09, 2019, 06:32 am

Title: Let us Learn UART Port based Serial Data Communication by Solving Questions
Post by: GolamMostafa on Mar 09, 2019, 06:32 am
The following diagram depicts the conceptual view of Serial Data Communication between UNO and NANO using Hardware UART Port (UART Port) and Software UART Port (SUART Port).
(https://forum.arduino.cc/index.php?action=dlattach;topic=602446.0;attach=298475)

Please download the attached pdf file for questions along with selective answers. Criticisms and comments are welcomed.

Exercise-1 for the readers:  Write program to achieve the following objectives.
Enter 12x56y in the InputBox of Serial Monitor-1 using Keyboard of the PC, click on the Send Button of Serial Monitor-1; check that --
12
56
have appeared on the OutputBox of Serial Monitor-2.
Solution: (... in progress)
//Codes for UNO -- the Sender:
Code: [Select]
#include<SoftwareSerial.h>  //this file is needed to create Software UART Port (UART Port)
SoftwareSerial SUART(2, 3);  //SRX-pin = DPin-2 (Digital Pin-2 of UNO), STX-pin = DPin-3;

void setup()
{
    Serial.begin(9600); //UART Port is enabled at Bd = 9600
    SUART.begin(9600): //SUART Port is enabled at speed 9600
}

void loop()
{

}

Exercise-2 for the readers:  Write program to achieve the following objectives.
(1)  Use DVM (Digital Volt Meter) to measure DC voltages at A0-pin and A1-pin at the UNO (sender) side and record it as 2.35 and 4.15 (for example). These values will appear on Serial Monitor-2 in the following format:
Voltage received from A0-pin of UNO: xx.xx V       Voltage received from A1-pin of UNO: xx.xx V  

(2)  Slowly vary the Pots (R1 and R2) at the UNO side; check that the readings of Serial Monitor-2 changes accordingly.

Edit:  In view of Post#1.
Title: Re: Let us Learn UART Port based Serial Data Communication by Solving Questions
Post by: J-M-L on Apr 29, 2019, 01:46 am
#onclude<SoftwareSerial.h>  //this file is needed to create Software UART Port (UART Port)
SofywareSerial SUART(2, 3);  //SRX-pin = DPin-2 (Digital Pin-2 of UNO), STX-pin = DPin-3;
didn't you test if it would even compile ?
Title: Re: Let us Learn UART Port based Serial Data Communication by Solving Questions
Post by: GolamMostafa on Apr 29, 2019, 07:26 am
I acknowledge with great honor your spirit for right education and learning. Your meticulous observations are helpful to remain alert for the future. I am correcting the typo mistakes of the referred post.