****************************************************** * Applying the frequency counter v0.3 as of 9.1.2009 * ****************************************************** Chapters: --------- 1. Adjustments prior to assembling 2. During programming 3. Measuring modes 3.1 Measuring modes 3.2 Displaying measuring modes 4. Display versions 4.1 Display on 2-line-LCDs 4.2 Display on a single-line-LCD 4.3 Display on 16-/20-character-displays 4.4 Display 8-character-displays 5. Display on the serial interface 5.1 Commands on the serial interface 5.2 Format of voltage- and frequency output 1. Adjustments prior to assembling ---------------------------------- The following adjustments have to be made prior to assembling the source code in the file fcountV03.asm: - The switches debug and debugpulse must be set to 0. - If an LCD is attached, cDisplay must be set to 1, otherwise to 0. - If the attached LCD has 8 characters per line, cDisplay8 must be set to 1. If a 16- or 20- character-per-line-display is used, cDisplay8 must be set to 0. - If the attached LCD can only display a single line, cDisplay2 must be set to 0. If two or more lines can be displayed, cDisplay2 must be set to 1. - If the serial interface is attached, cUart must be set to 1. If no serial interface is attached or serial interfacing is not wanted, set cUart to 0. - If the prescaler by 16 is attached to another port bit as PC5, specify pPresc and pPrescD as well as bPresc accordingly. - If the processor clock is driven different than at 16 MHz, this frequency has to be written to cFreq. - If the serial interface should work at a baudrate different than with 9600 Bd, cBaud has to be adjusted accordingly. - If the hardware prescaler for measuring voltages is different than with the two resistors of 1M, the two values in cR1 and cR2 have to be changed accordingly. If the displayed voltages are dif- ferent from the applied voltages, adjust cRin: smaller values for cRin yield a higher voltage on the display, larger values a lower voltage. 2. During programming --------------------- - The fuses "Ext.Crystal/Resonator HighFreq.; Start-up time: 16K CK + 64 ms "CKSEL=1111 SUT=11]" and CKOPT must be set, all other internal and external clock fuses must be cleared. The screenshots show the fuses (FusesPony.gif, FusesStudio1.gif and FusesStudio2.gif). 3. Measuring modes ------------------ 3.1 Measuring modes The measuring mode is selected with the voltage divider or variable resistor. Following modes can be selected: 0: Measuring frequency with prescaler, gate time 0,25 s, result in Hz 1: Measuring frequency without prescaler, gate time 0,25 s, result in Hz 2: Measuring frequency as period measurement with calcu- lation to frequency, result as 0.01 Hz reswp. 0.001 Hz 3: Rounds-per-Minute measurement, without prescaler, via period measurement with conversion to RPM, result in rpm 4: Period length of complete cycle, result in microseconds 5: Period length of high-period, result in microseconds 6: Period length of low-period, result in microseconds 7: Period portion of high-period, result in 0,1% 8: Period portion of low-period, result in 0,1% 9: Voltage measuring only, result in 0,001 Volts Selection of mode Modus 9 (potentiometer to the right) switches frequency/time/period measurement off. 3.2 Displaying measuring modes The measuring mode is displayed on the beginning of the first LCD line with a letter and an equal sign (format "X="). With an 8-character-LCD attached, these two characters are displayed only if the result of the measurement is small enough and allows this. During display, the following abbreviations for the mode are used: - "F=": Frequency in Hz, measured with prescaler, resolution +/- 32 Hz - "f=": Frequency in Hz, measured withput prescaler, resolution +/- 4 Hz - "v=": Frequency in Hz with smaller decimals, measured via time, resolution +/- 0,01 Hz - "u=": Rounds per minute, measured via time, resolution +/- 1 Upm - "t=": Cycle duration in mikrosekunden, resolution +/- 1 microseconds - "h=": Duration of a high-period, resolution +/- 1 microseconds - "l=": Duration of a low-period, resolution +/- 1 microseconds - "P=": Period portion of a high-period in %, resolution +/- 0,1% - "p=": Period portion of a low-period in %, resolution +/- 0,1% - "U=": Voltage on the input, resolution depends from the resistor pair on the input, at (1M + 1M) approx. 4 millivolts. 4. Display versions ------------------- The update of the LCD is depending from the mode: in frequency measuring modes the interval is 0.25 seconds, in period measurements it is depending from the duration of measuring period. 4.1 Display on 2-line-LCDs Depending from the selected mode, the first LCD line displays the frequency, the time or the period portion. The second line displays the measured voltage. With a double line LCD with more than 8 characters per line, the measuring mode (0..9) is displayed at the end of the second line. 4.2 Display on a single-line-LCD In modes 0..8 the LCD shows the results of frequency, time or period portion measurements. In mode 9, the voltage is displayed. 4.3 Display on 16-/20-character-displays The display is complete, with mode, thousands and decimal separators as well as the dimension. Mode Format ----------------------- 0 "F=99,999,999 Hz " 1 "f= 9,999,999 Hz " 2 "v= 9,999.999 Hz " 3 "u= 9,999,999 rpm" 4 "t=99,999,999 us " 5 "h=99,999,999 us " 6 "l=99,999,999 us " 7 "P=100,0% " 8 "p=100,0% " 9 "U=9,999V " 4.4 Display with 8-character-displays Period portions and voltages are displayed complete. Display in other modes are shortened. Suppressed are: - the output of thousands separarors, - the output of the dimension, - if required, the equal-sign and the character for mode recognition. The output displays - frequencies in Hz - rps as rpm - times in microseconds. Mode Format short Format long ---------------------------- 0 "F=999999" "99999999" 1 "f=999999" "99999999" 2 "v=999999" "99999999" 3 "u=999999" "99999999" 4 "t=999999" "99999999" 5 "h=999999" "99999999" 6 "l=999999" "99999999" 7 "P=100,0%" "P=100,0%" 8 "p=100,0%" "p=100,0%" 9 "U=9,999V" "U=9,999V" 5. Display on the serial interface ---------------------------------- The serial interface sends the following text after a reset: ************************************************* * Frequency- and voltmeter (C)2005 by g.schmidt * ************************************************* Commands: elp i> 5.1 Commands on the serial interface The following commands are implementiert: u : Output voltage off U : Output voltage on U=123 : Interval for voltage output 123 cycles f : Output frequency off F : Output frequency on F=123 : Interval for frequency output 123 cycles p : Output the currently selected intervals h, ? : Output help information 5.2 Format of voltage- and frequency output The output of voltages ins in the format "U=4,958V" The output of frequencies is depending from the selected mode, e.g. in mode 0: "F=1.234.567 Hz"