41081 Chapter Notes - Chapter 7: Pulse-Width Modulation, Duty Cycle, Universal Asynchronous Receiver-Transmitter

36 views2 pages
5 Jun 2018
School
Department
Course
Professor
Chapter 7 Peripherals
Pulse Width Modulation
A periodic signal is where the pattern repeats.
The duty cycle is the percentage of time the signal is high during the period. A signal
with a duty cycle of 50% is called a square wave.
A pulse width modulator (PWM) is a programmable component that generates
pulses to achieve a specified period and duty cycle.
A use of a PWM is to control a DC motor. The motor will spin when the input is 1 and
coast when the input is 0. A PWM can be used to achieve the desired spinning
speed.
O aeage, a PWMs output i tes of eegy, is euialet to the output’s duty
cycle.
UARTs
To conserve limited output pins, microcontrollers typically include a hardware device
called a UART that automatically transmits 8 bits of data serially over a single pin.
UART stands for Universal Asynchronous Receiver/Transmitter
When dealing with UARTs, receive is written as rx and transmit is written as tx.
The UART ust e atiated y the uild i RIM“ futio UARTon().
Analog-Digital Conversion
An analog-to-digital converter (ADC) converts an analog signal to a digital signal,
which a microcontroller program can use.
An analog signal is a voltage whose value varies continuously over time.
A digital signal is a series of bits whose binary values represent the voltage level at a
given time.
A mixed-signal device has a mix of analog and digital inputs and outputs.
A common approach to converting an analog signal to a digital one is through the
method of successive approximation, where a controller repeatedly guesses a value,
using a comparator to determine whether the next guess should be higher or lower.
Task Scheduler
Converting different period tasks to C
Different period tasks can be converted to C via a method that uses new variables
for counting timer ticks.
The timer period can be set to some small value, and then the appropriate number
of tie tiks a e outed to deteie hethe to all a task’s tik futio.
The timer period must evenly divide all tasks periods.
Creating a tasks structure in C
A struct is a C construct that allows several variables to be grouped together under a
single name. It is defined as follows:
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Document Summary

Pulse width modulation: a periodic signal is where the pattern repeats, the duty cycle is the percentage of time the signal is high during the period. The motor will spin when the input is 1 and coast when the input is 0. A pwm can be used to achieve the desired spinning speed: o(cid:374) a(cid:448)e(cid:396)age, a pwms output i(cid:374) te(cid:396)(cid:373)s of e(cid:374)e(cid:396)gy, is e(cid:395)ui(cid:448)ale(cid:374)t to the output"s duty cycle. Creating a tasks structure in c: a struct is a c construct that allows several variables to be grouped together under a single name. It is defined as follows: typedef defines a new data type and variables can be defined as being of the new type, the fields of the struct can be read using dot notation. Code for a simpler cooperative task scheduler: by expressing the task structure as a for loop, it can be scaled easily for more tasks.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers