Professional Documents
Culture Documents
Experiment - 3: Name of The Experiment
Experiment - 3: Name of The Experiment
Submitted By:
Nikhil Kumar Agrawal(2015MT60562)
Ajay Yadav(2015MT60551)
Aim
Creating a simple function generator using UART and PWM to
show different waveforms on LCD matrix keeping a constant time
scale.
Apparatus
• Arduino Board
• GLCD
• Bread Board
• Connecting wires
• Push button
• Op-amp 741
• Potentiometer
Challenges faced:
• We faced challenge in installing the GLCD library as this was
the first time we got to use Arduino board
• We got the error stk500_getsync() several times which occurs
when we upload the code while Arduino is connected to
GLCD.
• Wiring the GLCD with Arduino board was a difficult task.
Block Diagram:
Flow chart:
Circuit Diagrams:
Square wave generated on a screen. Look for appendix A1 for it’s code.
Appendix:
A1. Code for Square Wave
#include <openGLCD.h>
#include <math.h>
int i=0;
int j=1;
int amp =15;
void setup()
{
// Initialize the GLCD
GLCD.Init();
}
void loop()
{
if(i>=127){
i=0;
j=1;
}
GLCD.SetDot(i,32+amp*j,BLACK);
i = i+1;
if(i%amp == 0){
j=-j;
for(int k =32-amp;k<=32+amp;k++){
GLCD.SetDot(i,k,BLACK);
}
}
}
void loop()
{
if(x>=127){
x=0;
j=1;
}
y = abs((x++ % 30)-15);
GLCD.SetDot(x,22+y,BLACK);
}
void loop()
{
if(i>=127){
i=0;
}
GLCD.SetDot(i,32+10*sin(60*i/3.14),BLACK);
i = i+1;
}