[↑ Projects index]
Objective: To produce an FM radio receiver which should be -
For about ten years after the introduction of the transistor into domestic radio receivers in the late 1950s, the circuit design of such radios followed that of the preceding era when thermionic valves were used in a standard pattern of
A student might reasonably meet the specification with such a design. However, the required variable capacitors and 'IF transformers' are now expensive and hard to obtain.
The first use of integrated circuits was to implement the same superheterodyne method. The old discriminator, however, was replaced by a phase lock loop. Tuning was achieved by a variable capacitance diode. A student trying to pursue a design using these ICs will discover that they are largely obsolete.
The next step in the evolution of the FM receiver was to implement the local oscillator using a digitally programmable frequency synthesizer. This mandated digital control of tuning and then also other functions such as volume control
Today, portability in radio receivers has become a primary requirement. They tend to be integrated within mobile phones and MP3 players as 'add-on' features. The Airoha chip exemplifies this philosophy, having very low battery drain (10 mA) and a very small package (4 mm square).
To assist groups having no clear idea how the objectives are to be achieved there exists a suggested reference design. This is
The AR1010 uses a 24-lead QFN package. Until it becomes possible within
FEPS to mount QFN packages on a PCB, a commercially made 'breakout
board' with an AR1010 ready soldered is chosen. This has,
unfortunately, a connection spacing of 2 mm that is inconvenient when
2.54 mm pitch prototype matrix board is used. To circumvent this
problem, an adaptor board has been designed to convert the spacing. In
addition a few components have been added to assist with integration
into the rest of the radio.
A problem with the overall receiver design is that the LCD prefers a
high drive voltage (e.g. 5V) to achieve best contrast. The AR1010, on
the other hand, is happiest with with 3.3 volts. Although the data
sheet mentions an absolute maximum Vdd of 5.5 volts, the bus interface
is specified no higher than 3.6 volts. If the AR1010 is powered at 5
volts it will get hot, and may die. A 3.3 volt regulator is
highly recommended. The LE33CZ regulator IC is
suitable, as is the discrete circuit shown in Fig. 3.
Figure 5 shows one arrangement of the I2C interconnections betwen the three main functional blocks. Using a five way connector the AR1010 can be commanded either from the USB to I2C converter or from the PIC, depending on which set of header pins is chosen. D3 and D4 prevent the 4.5 volt I2C signals from the PIC driving the AR1010 above its limit. Unfortunately, the PIC then sees signals only 73% of its Vdd. This should still be a valid logic '1'.
The particular microcontroller chosen for the reference design, the PIC18LF6490, includes hardware support for liquid crystal displays. In fact, it can drive LCDs that are more sophisticated ('multiplexed') than the 3.5 digit x 7-segment Varitronix display.
About all you need for a working display is to connect the 'backplane'
electrode to the COM0 drive from the PIC, and then connect the separate
segment electrodes to a sub-set of the 32 SEGnn drives. On the
prototype, the assigment of display segments to drive lines from the PIC
proved awkward in software. It would be more convenient to map all
seven segments plus the DP from one digit to one 8-bit register in the
PIC, and to maintain the same mapping for the other digits also.
Connect the LCDbias3 pin to Vdd.
The audio amplifier /
headphone driver stage is trivial. The only point to note is that the
outputs from the AR1010 have DC bias which must be removed with coupling
capacitors. The internal volume adjustment in the AR1010 has been found
to be capable of adequate performance, and may be used in place of a
Pushbutton switch input
is quite trivial. It would be possible to save a couple of I/O pins by
using a 3 x 3 switch matrix, but that's really more trouble than it's worth.
Some of the ports may be configured to operate pull-up resistors internal
to the PIC, but this was not attempted on the prototype.
To assist development of the project, groups have access to -
It is not expected that the circuit be 'fully
engineered'. Instead, 'prototype' construction methods are acceptable.
The PIC18LF6490 is available surface mounted on an adaptor for 0.1 inch
pitch pin spacing. The adaptor board may be 'old style' (produced
in-house) or bought in. Tracks on the latter will be similar to those
shown at Fig. 1. This version has provision for a connection directly
to the PICkit 3 debugger.
Pin 6 of the debugger is not used. By default, however, it may be connected to port RB5 onthe PIC. Break the track if you wish to make use of RB5.
The AR1010 comes ready surface-mounted on a 'breakout board'. Bizarrely, this uses 2 millimetre pitch pads. Groups choosing to mount this onto 0.1 inch pitch stripboard or 'breadboard' can still do so via short lengths of tinned copper wire. Groups in years past tended to perch the AR1010 three inches up in the air. The electrical performance of that arrangement was as wobbly as its mechanical.
The ' Electronics Prototype System' may be used if groups wish to 'package' the circuit with its I/O sub-assemblies.
Groups may make use of the 'enamel wiring pen' method as a
speedier or more flexible alternative to PCB production.
The pushbutons are used in a conventional arrangement whereby PIC inputs are pulled up to Vcc via a 10k resistor and pulled down to Vss via a button whilst it is pushed. Debounce is done in the firmware.
|Vss||9||-|| 1, 4, 6, 8,|
9, 11, 13, 15
Note on LCD function: The PIC is capable of driving more sophisticated displays with more segments than the simple 'seven-segment' variety available in the lab. For the latter type you should wire the PIC for a 'static' biasing arrangement.
The table below shows the originally chosen mapping between the PIC's segment driver pins and the LCD. This proved awkward to implement in firmware. You should consider a simpler scheme.
|PIC name|| PIC
|Qty||Cost||Part desc||Distrib||Dst. No.|
|1||16.56||USB-I2C module||Robot Electronics||USB to I2C Interface|
|1||5.98||FM Receiver Module||SparkFun||WRL-08770|
|1||0.89||Audio amp||RS Comp||177-5216|
|1||20.87||VHF distribution amplifier||Ocall||4255811|
Firmware for the PIC18F6490 may be derived from the Visual C software supplied to run as a console mode application under Windows. The crucial section which initialises the AR1010 register set can be left largely intact. However, some modifications must be made to the code:
signed ints (16 bits). The Microchip C18 compiler may treat the same strings as
characters (8 bits). For example -
Partly complete firmware is available here for MPLAB (updated 20100310), or here for MPLABX (updated 20140128) This requires routines to be added for reading the pushbuttons and writing to the LCD. It does not, at present, attempt to save power by putting the PIC to 'sleep' mode. There is no 'autorepeat' on button pushes. There is no station autotune. There is no readout of volume level.
For 2013, the IDE is being switched from MPLAB to the newer MPLABX on all labs machines. If you must use the previous MPLAB then please see below.
MPLABX and the XC8 C-compiler should be installed by lab staff prior to the project time. Unless you have previous experience of development under MPLABX then you may wish to build at least one of the sample programs for the PIC18F45K20 demo board supplied by Microchip. Known good hardware and firmware gives your first code its best chance of running straight away. The original MPLAB C source code needs minor changes to allow it to run under MPLABX :
MPLABX project files are given for the updated versions of the C source
code examples. See directory XC8Lessons. You should try building at
least one project using File: New Project
Follow the sequence of dialogs presented to specify Standalone Project, Advanced 8-bit MCUs, Device: PIC18F45K20, Compiler: XC8. Give your project a name and location on E:.
Once you have a new, empty project appearing under the Projects tab, find its Source Files section and add to that your *.c source(s). You should not need to explicitly specify the locations of *.h headers #included by your code. MPLABX should find them on its own.
Go to File: Project Properties and select Option Categories: Power. Check the box to Power target circuit from PICKit3 at 3.25 volts. Note: you are limited to a supply draw of 30 mA or less when using the PICKit3 to power your target board.
Connect the demo board to the PICKit3 either directly, or (preferably) using the 6-way lead, taking care to align pin 1 at each end. You can then try to Run: Run Main Project. If the project build succeeds then, in the Output window you should now see the message Device ID Revision = 00000018 or similar. This is confirmation that communication with the PIC has been established. It is unlikely that a Run will succeed without that response.
It is advisable to turn the debugger power off before (dis)connecting
the target board or the debugger.
MPLAB has been superseeded as the current Microchip IDE by MPLABX (see above).
If you have a ready made 'project file', e.g. pic2fm.mcp, then you may be able to use that with the particular version of MPLAB and directory structure of the PC you are now using. If not, then it is best to create a project from scratch, for which some configuration is required before successful code can be executed.
It's probably best to start with the PICKit3 disconnected. Start MPLAB using the desktop icon . Then choose menu Project : Project Wizard. Select PIC18F6490 from the drop-down list. the Active Toolsuite should be set to the mplabc18 toolsuite, Microchip C18 Toolsuite in the drop-down. It will reference a file such as C:\Program Files\Microchip\mplabc18\v3.40\mpasm\mpasmwin.exe or similar. If any component of mplabc18 cannot be found then it will be marked with a . Fix each one by browsing to the corresponding file in the mplabc18 directory.
name your new project file in a suitable directory (perhaps somewhere within MyDocuments\...) where you have already placed a main.c source file (together with other source or header files only) which you to the project. You do not need to have a processor-specific header file (e.g. PIC18F6490.h) in your project directory; it will be obtained from the built-in library once the path for that is set up. Header files in the project directory should not need to be added explicitly. you now with the Wizard.
If you cannot at this stage see separate windows titled Project and Output then Choose menu View : Project and Output
Choose menu Debugger : Select Tool : PICKit3
If the large button in the toolbar shows then change that to .
Choose menu Debugger : Settings ... and select the tab. Adjust the slider to 3.25 volts and check the box. Note: you are limited to a supply draw of 30 mA or less when using the PICKit3 to power your target board.
Choose menu Project : Build Options : Project
Then hit the tab for Directories, and select
Assemble/Compile/Link in the Project
Directory. In the Show Directories for:
drop down pick Include Search Path. Browse
Pick Library Search Path and browse to C:\Program Files\Microchip\mplabc18\v3.40\lib.
Now you can menu Project : Save Project, and then in the project directory you should see files pic2fm.mcp, pic2fm.mcw and pic2fm.mcs.
You should now be able to Project : Build All. After a successful compile and link you should see main.o, pic2fm.cof, pic2fm.hex and pic2fm.map. files in your project directory.
Connect your target board to the debugger using the six-way cable, taking care to align the connector correctly. Now connect the debugger onto the USB bus. In the Output window you should see a message appear PICKit3 Connected -
If, in the toolbar, the Power button is still 'grayed' then hit it whereupon it should turn green:
In the Output window you should now see the Device ID Revision = 00000018 or similar. This message is confirmation that you have succeeded in establishing communication with the PIC. Hit the Program button to transfer code into your microcontroller chip. Then click the Run button to begin code execution or debug.
It is advisable to turn the debugger power off before disconnecting the
target board or the debugger.
These tips apply to the reference design. Customised designs may need different procedures. Don't assume that anything is correct; measure it, preferably using an oscilloscope with a high impedance probe.
Last modified: 2014 February 13th.