FOR THE LPC1768 answer the following Q1: Write the memory address for Port 1 FIO
ID: 3678878 • Letter: F
Question
FOR THE LPC1768 answer the following
Q1: Write the memory address for Port 1 FIO1DIR, FIO1MASK, FIO1PIN, FIO1SET, FIO1CLR.
FIO1DIR: _________________ FIO1MASK: ________________
FIO1PIN: __________________ FIO1SET: _________________
FIO1CLR: _________________
Q2: Write a short C code to define Port 1 Pin 28 as output.
___________________________________________________________
Q3: Write a short C code to set (assign 1) and reset (assign 0) port 1 pin 28. To set port 1 pin 28, is there another way to do it?
Set port 1 pin 28 : __________________________________________
Clr port 1 pin 28: __________________________________________
Q4: Assume that the system CPU clock is 100 Mhz, and the CPU clock is selected for LPC1768 system tick source, what is the maximum time period that the system tick can count? What is the time constant to be loaded into the system tick register if 10ms counting time period is needed?
Max counting time: ________________________________________________________
Time constant for 10 ms period: _____________________
Q5: The PCONP register allows turn off selected peripheral functions for the purpose of saving power. Find out the memory address of PCONP. Write a short C code to enable GPIO clock.
PCONP Memory address: _______________________________
Enable GPIO clock: ____________________________________
Explanation / Answer
5.....C code to enable GPIO clock
int main(void){
int *crh;
int *odr;
int *apb2enr;
int i;
crh=(int*)(0x40010C04);
odr=(int*)(0x40010C0C);
apb2enr=(int*)0x40021018;
*apb2enr|=0x0008;
*crh=0x33333333;
for(;;){
for(i=0;i<0x40000;i++){
}
*odr=0x0000aaaa;
for(i=0;i<0x40000;i++){
}*odr=0x00005555;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.