I cant seem to figure out how to get part 2 and 3 of my code working for my ECE
ID: 3757597 • Letter: I
Question
I cant seem to figure out how to get part 2 and 3 of my code working for my ECE Lab and need help!
Language is C/C++
2) Change your program to read data typed from the serial monitor, and restart the sequence
whenever an R is typed.
3) Change the program to send out the letter 'Z' every 500 milliseconds, then use the logic analyzerto measure the time required to send the nine bits as shown in Figure 3-2. From thismeasurement, compute the Baud rate. Be sure to document your measurement via a screen shotof the Logic Analyzer.
Heres the code that I have:
unsigned long timer;
char letter = 'A';
int number = 1;
void setup() { //sets time to baud at 9600 milliseconds
Serial.begin(9600);
timer = millis();
}
void loop() {
if (millis() - timer >= 500) {
timer = timer + 500;
//Adds one to every letter so it goes to the next one
if (letter =='Z') {
//prints letter
Serial.print(letter);
letter = 'A';
}
else {
Serial.print(letter);
letter = letter + 1;
}
//tells the program when it reaches 9 to reset back to 0
if (number == 10) {
number = 0;
}
//prints number
Serial.print(number);
number = number + 1;
}
if (Serial.available() >= letter) {
char inByte = Serial.read();
letter = 'A';
number = 0;
}
}
Also there is a question that I do not know how to answer:
Questions:
How well does the measured baud rate match with the programmed rate?
Thank you for your help and advance!
Explanation / Answer
CODE :
2)
3)
#include<time.h>
clock_t start,finish;
double total;
start = clock();
do stuff;
finish = clock(); total = (double) (finish - start) / (double) CLK_TCK
printf("Total = %f ",total);
The measured band rate match with the programmed rate as a method for determining whether a baud rate of a frequency modulated (FM) signal received by a receiver matches a predetermined baud rate (520). A parameter other than the baud rate is detected (560) and used to confirm whether baud rate detection should be made (570), or whether if made, is reliable. The parameter is frequency deviation of the received FM signal, or other suitable parameters of the received FM signal.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.