1 The objective of this problem is to measure the frequency of a square wave con
ID: 667275 • Letter: 1
Question
1 The objective of this problem is to measure the frequency of a square wave connected to IC1. You may use only IC1 and OC5 (i.e., no other 9S12 I/O feature or external device is allowed). The frequency range is 0 to 200 Hz, and the resolution is 0.01 Hz. For example, if the frequency is 56.783 Hz, then your software will set the global Freq to 5678. The C program in Example 6.10 measures frequency with units of 0.1 Hz. Make modifications to this program so that the resolution is improved to 0.01 Hz. Don't worry about frequencies above 200 Hz.
Explanation / Answer
The below code is used to measure the frequency of a Square wave. Make slight modifications to this code and Run it. #include #define lcd PORTD #define rs RE0 #define en RE1 #define trrs TRISE0 #define tren TRISE1 unsigned char cal=0; unsigned char lsb=0; unsigned char msb=0; unsigned char mmb=0; unsigned int temp=0; unsigned int tp=0; unsigned char ton=0; unsigned char toff=0; lcd_delay() { unsigned char i; for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.