MBES - Lab 9 PDF
MBES - Lab 9 PDF
MBES - Lab 9 PDF
- __________________________________
- __________________________________
- __________________________________
- __________________________________
- __________________________________
- __________________________________
- __________________________________
- __________________________________
- __________________________________
- __________________________________
- __________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
9.3 PRCEDURE
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
Student Workbook EE-07310: Microprocessor based Embedded Systems
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
- Complete code
pwm.c
#include "main.h"
#include "PWM.h"
void PWM_Init(void)
{
RCC_APB2ENR |= 0x0000080C; // Enable clock to GPIO port A, B & Timer 1
TIM1_EGR = 0x0001; /* Reinitialize the couner & gen updates of the registers*/
Student Workbook EE-07310: Microprocessor based Embedded Systems
TIM1_BDTR = 0x8000; /* MOE - Main output enabled - page 268 ref manual*/
TIM1_CR1 |= 1; /* Timer starts - counter enabled*/
}
pwm.h
#ifndef _PWM_H_
#define _PWM_H_
void PWM_Init(void);
void Duty_Vary_Ch_1(int Dc);
#endif
main.c
#include "main.h"
#include "PWM.h"
void SystemInit(void)
{}
void Cyclic_Start(const unsigned short PERIOD)
{ RCC_APB1ENR |= 0x00000001;
TIM2_CR1 = 0;
TIM2_CNT = 0;
TIM2_PSC = 7999;
if(PERIOD > 1)
{
TIM2_ARR = (PERIOD-1);
}
else
{
TIM2_ARR = 1;
}
TIM2_CR1 = 0x0001;
}
void Cyclic_Wait(void)
{
while((TIM2_SR & 0x00000001)==0)
{
}
TIM2_SR = 0;
}
// delay function end
int main(void)
{
int Dc=0;
PWM_Init();
Cyclic_Start(10);
Student Workbook EE-07310: Microprocessor based Embedded Systems
while(1)
{
Duty_Vary_Ch_1(10000);
Cyclic_Wait();
}
return(1);
}
1 10% 270.9
2 20% 502.6
3 30% 729.1
4 40% 931.3
5 50% 1124
6 60% 1324
7 70% 1523
8 80% 1726
9 90% 1916
10 100% 2077
- Duty Cycle 1
Student Workbook EE-07310: Microprocessor based Embedded Systems
- Duty Cycle 2
Speed on meter Duty Cycle on Oscilloscope
- Duty Cycle 3
Speed on meter Duty Cycle on Oscilloscope
- Duty Cycle 4
Student Workbook EE-07310: Microprocessor based Embedded Systems
- Duty Cycle 5
Speed on meter Duty Cycle on Oscilloscope
- Duty Cycle 6
Speed on meter Duty Cycle on Oscilloscope
- Duty Cycle 7
Student Workbook EE-07310: Microprocessor based Embedded Systems
- Duty Cycle 8
Speed on meter Duty Cycle on Oscilloscope
- Duty Cycle 9
Speed on meter Duty Cycle on Oscilloscope
- Duty Cycle 10
Student Workbook EE-07310: Microprocessor based Embedded Systems
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
This open–ended lab also qualifies as a Complex Engineering Problem as it meets the
criterion 1 and criterion 3.
Student Workbook EE-07310: Microprocessor based Embedded Systems
Extent of stakeholder
Involve diverse groups of stakeholders with widely
7 involvement and level of ☐
varying needs.
conflicting requirements
Safety Assesses and Assesses and complies Assesses and complies Assesses and
Instructions complies with all with most EHS with some EHS complies with ☐
(PLO6) EHS instructions instructions while in instructions while in few EHS
A4 while in lab lab lab instructions in lab
Does not exhibit
Exhibits exemplary Makes an effort to professional
Professional Exhibits professional
professional ethics exhibit professional ethics while
Ethics ethics while dealing
while dealing with
with fellow students,
ethics while dealing dealing with ☐
(PLO8) fellow students, lab with fellow students, fellow students,
A3 lab staff and instructor
staff and instructor lab staff and instructor lab staff and
all the time
all the time all the time instructor all the
time
Consistently shows
Shows some
full preparation by
Consistently shows full preparation which is Shows very little
Contribution completing all
preparation by mostly at superficial or no preparation
(PLO9) agreed tasks and
completing all agreed level in completing a in completing a
A5 provides additional
tasks and work requires task and work requires task and work
resources for the
Affective