
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















1
In this chapter the reader will learn general information about:
2
4
Example: Setting Port 4 bit 1 as output
PORT4.PDR.BIT.B1 = 1;
Port Input Register (PIDR) is used to read the state of a pin
Example: Reading the state of port 4, bit 1and, if it is high, make port D bit 0 high
if(PORT4.PIDR.BIT.B1 == 1) PORTD.PODR.BIT.B0 = 1;
Open Drain Control Registers (ODR0/ODR1) Selects the output pin as either CMOS or NMOS open drain
Pull-Up Resistor Control Register (PCR) Used to enable pull-up MOS for a particular pin of a port
Drive Capacity Control Register (DSCR) This register is used to switch the drive capacity of a port
There are two ways in which you can interface an LED with a microcontroller:
The microprocessor is sourcing current to an LED.
Turning on this LED requires a logical HIGH signal on the output pin.
The microprocessor is sinking current from the LED.
Turning on the LED requires a logical LOW on the output pin.
We often find the need for using a Keypad in various applications, The easiest way to use it is using a matrix of switches.
Keypads work as a matrix of buttons. In the previous example: The top three output pins are used as the columns of the matrix A button is placed in the circuit at each intersection of a column and a row One at a time, the output pins turn on and each of the input pins is read. If an input is detected, the microprocessor can determine which button on the keypad had been pressed.
Analog Signals must be converted to digital values so that the microcontrollers can process them.
Analog to Digital converters are used to convert analog signals to digital values and Digital to Analog converters are used to convert Digital signals to appropriate analog values.
ADC is a device that converts a continuous physical quantity (usually voltage) to a digital number that represents the quantity's amplitude.
The number of bits binary number helps determine the resolution or precision of the reading
Types of ADC: Flash Successive approximation ADC Ramp
17
In systems that control audio, speed, or even light levels; digital output from a microprocessor must be converted into an analog signal.
There are several different methods for converting digital signals to analog.
Resistor Networks Binary Weighted DACs R-2R DAC
19
20