1 lho 13 the 8051cf020 and the university daughter card
TRANSCRIPT
![Page 1: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/1.jpg)
1
LHO 13
The 8051CF020 and the University Daughter Card
![Page 2: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/2.jpg)
2
Resources
• https://www.silabs.com/Support%20Documents/TechnicalDocs/C8051F02x.pdf
• University Daughter Card User Manual
• Embedded_Programming_Textbook.zip
![Page 3: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/3.jpg)
3
Peak throughput 25 MIPS
FLASH program memory 64 K
On-chip data RAM 4352 bytes
Full-duplex UARTS x 2
16-bit timers x 5
Digital I/O ports 64-pin
12-bit 100 ksps ADC 8 channels
8-bit 500 ksps ADC 8 channels
DAC resolution 12-bit
DAC outputs x 2
Analog comparators x 2
Interrupts 2 levels
PCA (programmable counter arrays) 5 channels
Internal oscillator 25 Mhz
Debug circuitry
![Page 4: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/4.jpg)
4Standard 8051
![Page 5: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/5.jpg)
5C8051F020
![Page 6: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/6.jpg)
6
![Page 7: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/7.jpg)
7
![Page 8: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/8.jpg)
8
![Page 9: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/9.jpg)
9
I/O Ports• Ports 0, 1, 2 and 3 are bit- and byte-addressable• Four additional ports (4, 5, 6 and 7) are byte-addressable
only• There are a total of 64 general purpose port I/O pins• Access to the ports is possible through reading and
writing the corresponding port data registers (P0, P1, etc.)
• All port pins are 5 V tolerant and support configurable input/output modes and weak pull-ups
• In addition, the pins on Port 1 can be used as analog inputs to ADC1
![Page 10: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/10.jpg)
10
The Digital Crossbar• The digital crossbar is
essentially a large digital switching network that allows mapping of internal digital peripherals to the pins on Ports 0 to 3
• This is achieved by configuring the crossbar control registers XBR0, XBR1 and XBR2
• Allows the system designer to select the exact mix of GPIO and digital resources needed for the particular application
![Page 11: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/11.jpg)
11
12-Bit Analog-to-Digital Converter (ADC0)
• On-chip 12-bit successive approximation register (SAR) analog-to-digital converter (ADC0)
• 9-channel input multiplexer and programmable gain amplifier
• The ADC is configured via its associated special function registers
• One input channel is tied to an internal temperature sensor, while the other 8 channels are available externally
![Page 12: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/12.jpg)
12
8-Bit Analog-to-Digital Converter (ADC1)• On-board 8-bit SAR analog-to-digital converter (ADC1)• Port 1 can be configured for analog input• 8-channel input multiplexer and programmable gain amplifier• The ADC is configurable via its configuration SFRs
![Page 13: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/13.jpg)
13
Digital-to-Analog Converters
• Two 12-bit digital-to- analog converters: DAC0 and DAC1
• The DAC voltage reference is supplied via the dedicated VREFD input pin
• The DACs are especially useful as references for the comparators
![Page 14: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/14.jpg)
14
Comparators
• There are two analog comparators on chip: CP0 and CP1
• The comparators have software programmable hysteresis
• Generate an interrupt on its rising edge, falling edge or both
• The comparators' output state can also be polled in software and programmed to appear on the lower port I/O pins via the crossbar
![Page 15: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/15.jpg)
15
Voltage Reference for ADC and DAC • A voltage reference has to be
used when operating the ADC and DAC
• Three external voltage reference input pins: VREF0, VREF1 and VREFD
• ADC0 may also reference the DAC0 output internally
• ADC1 may also reference the analog power supply voltage (AV+)
![Page 16: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/16.jpg)
16
Internal Voltage Reference Generator
• The internal voltage reference circuit consists of a 1.2 V band-gap voltage reference generator and a gain-of-two output buffer amplifier (2.4 V output)
• The internal reference may be routed via the VREF pin to external system components or to the voltage reference input pins
• The reference control register, REF0CN, enables/disables the internal reference generator and selects the reference inputs for ADC0 and ADC1
![Page 17: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/17.jpg)
17
ToolStick UniDC Hardware Overview
I/O PinsP0[7..2], P1, P2
PotentiometerLinear output that sweeps from 0V to 3.3V
Target MCU C8051F020
Power LEDIndicates
3.3V is available
Reset Switch
Analog I/O Pins
Push-button SwitchesP5[3..0]
LEDsP5[7..4]
DIP Switches P4
Crystal22.1184 MHz
Prototype Area
![Page 18: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/18.jpg)
18
Handling The ToolStick
• Caution: The modular ToolStick components are not encased in plastic. This makes both the base adapter (BA) and the daughter cards (DC) susceptible to electrostatic discharge (ESD) damage.
• Follow these recommendations to protect the hardware– Never connect or disconnect a ToolStick daughter card from the base adapter
while connected to a PC
– Always connect or disconnect a ToolStick by holding the large plastic connector or the edges of the boards
– Be careful when using the mechanical components, such as the potentiometers, so as to not stress the connectors
![Page 19: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/19.jpg)
19
Handling The ToolStick
The Wrong way to hold the ToolStick
![Page 20: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/20.jpg)
20
Handling The ToolStick
The Correct way to hold the ToolStick
![Page 21: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/21.jpg)
21
![Page 22: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/22.jpg)
22
![Page 23: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/23.jpg)
23
Consider a simple program#include <c8051f020.h> // SFR declarationsextern void Init(void); // in udc_init,cextern void wr_leds(unsigned char); // in unc_init.cextern unsigned char rd_buttons(void); // in unc_init.cvoid main (void){ Init(); // call to external function initialize UDC while(1) { wr_leds(rd_buttons()); // call external functions }}
![Page 24: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/24.jpg)
24
//udc_init.c - version 1.0#include <c8051f020.h> // SFR declarations//----------------------------------------------------// Init - Configure UDC// Returns : None// Parameters : None//-----------------------------------------------------void Ext_Osc_Init(void); // switch clock to XTALvoid init_crossbar(void);void init_ports(void);
![Page 25: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/25.jpg)
25
void Init (void){// Disable interrupts EA = 0;// Disable watchdog timer WDTCN = 0xde; WDTCN = 0xad;// Enable crossbar switch init_crossbar();// Set up ports init_ports(); Ext_Osc_Init(); // Use external XTAL}
![Page 26: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/26.jpg)
26
![Page 27: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/27.jpg)
27
//-----------------------------------------------------------------------------// Init_crosbar - Configure crossbar switch// Returns : None// Parameters : None//-----------------------------------------------------------------------------void init_crossbar (void){ XBR0 = 0x04; // Enable UART 0 TX to P0.0, RX to P0.1 XBR1 = 0x80; // Output system clock to P0.2 P74OUT = 0x08; // Set P5(7_4) to push pull output XBR2 = 0x40; // Enable cross bar}
![Page 28: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/28.jpg)
28
XBR2 = 0x40; // Enable cross bar
![Page 29: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/29.jpg)
29
XBR0 = 0x04; // Enable UART 0 TX to P0.0, RX to P0.1
![Page 30: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/30.jpg)
30XBR1 = 0x80; // Output system clock to P0.2
![Page 31: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/31.jpg)
31
P74OUT = 0x08; // Set P5(7_4) to push pull output
![Page 32: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/32.jpg)
32XBR2 = 0x40; // Enable cross bar
![Page 33: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/33.jpg)
33
void init_ports(void){ P0MDOUT = 0x04; //Set P0.2 (sys clk) to push pull for fast rise time P1MDOUT = 0x00; P2MDOUT = 0xFF; //Set P2 to push pull for fast rise times P3MDOUT = 0x00; P5 = 0x0f; //TURN ON LEDS}
![Page 34: 1 LHO 13 The 8051CF020 and the University Daughter Card](https://reader035.vdocuments.site/reader035/viewer/2022062321/56649ef05503460f94c01202/html5/thumbnails/34.jpg)
34
unsigned char rd_buttons(void){ unsigned char btns; btns = (~P5) & 0x0f; return(btns);}
void wr_leds(unsigned char leds){ P5 = (leds << 4) | 0x0f;}