[quote=ba6qh/qrp]频率计用着很方便,想请问楼主,这个加4mhz的中频应该如何设置?[/quote]
请您参考一下:
adding or subtracting an offset frequency
if the counter is used in a shortwave receiver or transceiver, you may want to add or subtract an offset value from the measured frequeny. the offset frequency is the same as the intermediate frequency in many cases, because the counter is usually connected to the receivers vfo (variable frequency oscillator). for this purpose, a programming mode (aka "setup mode") has been implemented in the firmware so you can enter an offset frequency without reprogramming (or even reassembling) the pic firmware.
the signal ra5 (pin 4 of the pic 16f628) will is used to switch from normal counter mode into programming mode. usually the level on ra5 is high because it is connected to the supply voltage via pullup resistor (10k to 22k). if you will never need to add or subtract a frequency offset, connect it permanently with the supply voltage (there must be a defined level on ra5, unfortunately it has no internal pullup resistor). by pulling ra5 low (connect pin 4 and pin 5 of the pic with a small screwdriver), the firmware will be instructed to use the currently measured frequency as the new offset value. in other words, you must apply the offset frequency to the counter's input, wait until the value is displayed correctly, and then enter the programming mode as explained below.
the program flow chart on the left shows how to enter programming mode, how to select a menu, and how to execute the associated function. to enter programming mode, press and hold the programming key (or connect pin 4 and 5 of the pic with a small screwdriver), until the pic shows "prog" on the led display. then release the "key". you are now in the first menu of the programming mode.
to select the next menu, press the key for a short time (less than a second). to execute the selected function, press the key for a longer time (more than a second). the menu functions are :
"quit" : aborts programming mode without changing anything.
"add" : saves the previously measured frequency permanently, so it will be added in future.
"sub" : saves the previously measured frequency permanently, so it will be subtracted in future.
"zero" : sets the frequency offset to zero, so the display will show the measured frequency without offset. the previously programmed offset will be lost.
"table": allows you to select a predefined offset value from a table. the table itself is also located in the pic's data eeprom, so you may find different values in it. when skipping through the table, the frequencies are shown in numeric form, like 455.0 (khz), 4.1943 (mhz), 4.4336 (mhz), 10.700 (mhz). after selecting an entry (long keypress), you will be taken back to the main menu to select "add" or "subtract".
"psave" / "nopsv": turns the power-saving on/off. in power-saving mode, the display is turned off after 15 seconds of no "significant" change in frequency, and on again as soon as the frequency changes by more than a few dozen hertz (in the 3..4 mhz measuring range). added in may 2006 for battery-powered equipment like qrp transceivers.
note:
there may be more menu items than shown here, but the principle remains the same.
the frequency offset values are saved as a 32-bit integer numbers in the pic's data eeprom (at the eeprom's first four memory locations, high-byte first, low-byte last). if you have no signal generator to produce the offset frequency for programming, or cannot tap the bfo frequency of your homebrew shortware receiver, you can enter the offset value with a suitable pic programmer (like dl4yhf's winpic). use a scientific pocket calculator to convert the frequency (in hertz, positive or negative) into a hexadecimal number, and enter this value in the pic programmer's eeprom data memory window. if you use winpic, enable the hex editor before typing the values into the memory window. some examples:
4.194304 mhz : add= 00 40 00 00 subtract= ff c0 00 00 (yes, so simple)
4.433619 mhz : add= 00 43 a6 d3 subtract= ff bc 59 2d
0.455000 mhz : add= 00 06 f1 58 subtract= ff f9 0e a8
10.70000 mhz : add= 00 a3 44 e0 subtract= ff 5c bb 20
if the subtracted offset is higher than the counter's input frequency, the result of the subtraction is negative. the frequency counter makes the result positive before displaying it. this way, you can use the counter also in receivers where f_if = f_rx + f_lo, or f_rx = f_if - f_lo which means increasing lo frequency means decreasing rx frequency (the counter will seem to "run backwards" but that's no mistake).
example for dl2yeo's 30 meter band qrp transceiver: f_rx = f_lo - f_if = 14.314 mhz - 4.194 mhz = 10.120 mhz, which is the calculation inside the counter (f_lo=measured input, f_rx=display value, f_if=programmed offset). if you don't need the 10-mhz-digit on the display, set the offset to -14.194 mhz instead of -4.194 mhz. this will give better display resolution, so you only need 4 digits (f_rx=10.120 mhz will be displayed as 120.0 khz, which is sufficient because the receiver's tuning range is only 20 khz anyway).
some commonly used if frequencies can be recalled from the "table" menu, so you don't have to measure or enter them yourself. please contact me if you are one of those qrp homebrewers and want to have other frequencies in the built-in 'standard if table'.