题目内容

选出适合Allen和Sara的匹配字母。A. eat more vegetables and fruitsB. go outside with classmatesC. do some exerciseD. eat regular mealsE. eat a balanced dietF. drink less than 2 cups of coffee every dayFor Allen(1)For Sara (2)

查看答案
更多问题

木地板的铺设方式有____和____两种。

一般楼地板由____和____组成。

以下代码实现了Time1中断。1)试参考这些代码,改Time1中断为PWM2中断,控制LED灯闪亮及蜂鸣器声响(实验成功后记录现象说明修改方法)?2)试解读这些代码的功能,假设定时器时钟源PCLK频率为150MHz,试修改代码使蜂鸣器不断发出1秒响停3秒的声音?#include "s5p6818.h"extern void printf (const char *fmt, ...);void led_d7_toggle(void);void do_irq(void){ unsigned int num_irq;static unsigned int irq_cnt=0;// 获取中断号num_irq = GICC_IAR & (0x3FF << 0);switch(num_irq){case 56:{GICD_ICPENDER.ICPENDER1 = GICD_ICPENDER.ICPENDER1 | (0x1 << 24);irq_cnt++;printf("timer irq %d\r\n",irq_cnt);//led灯闪烁led_d7_toggle();//清空定时器1中断标志位TIMER.TINT_CSTAT |=(1<<6);}break;default:break;}// 清除所有中断GICC_EOIR = GICC_EOIR & (~(0x3FF << 0)) | num_irq;}//全局中断控制分配初始化void gic_dist_init(void){//GIC监测外设中断并将挂起中断转达到CPU接口的控制位,为0即关闭GICD_CTRL = 0x0;//具体的中断使能控制位,占1比特。为1即打开GICD_ISENABLER.ISENABLER1 = GICD_ISENABLER.ISENABLER1 | (0x1 << 24);//具体的中断优先级控制位,占8比特。数值小优先级高。GICD_IPRIORITYR.IPRIORITYR14 = GICD_IPRIORITYR.IPRIORITYR14 & (~(0xFF << 0)) | (56 << 0);//具体的中断目标分配控制位,占8比特。为1即选中该CPUGICD_ITARGETSR.ITARGETSR14 = GICD_ITARGETSR.ITARGETSR14 & (~(0xFF << 0)) | (0x1 << 0);//具体的中断模式控制位,占2比特GICD_ICFGR.ICFGR3 = GICD_ICFGR.ICFGR3 & (~(0x3 << 16));//打开分配器总开关GICD_CTRL = 0x1;}void gic_cpu_init(void){GICC_PMR = 0xf0;GICC_CTRL = 0x1;}void s5p6818_irq_init(void){gic_dist_init();gic_cpu_init();}void Timer_init(void){// Timer1,作定时器中断// 2. 设置一级预分频值为249(250分频)TIMER.TCFG0 = (TIMER.TCFG0 & (~(0xFF << 0))) | (249 << 0);// 3. 设置二级与分频值,进行16分频TIMER.TCFG1 = (TIMER.TCFG1 & (~(0xF << 4))) | (0x4 << 4);// 4. 设置TIMER1的最终周期;TIMER.TCNTB1 = 37500;// 6. 打开手动加载TIMER.TCON = TIMER.TCON | (0x1 << 9);// 7. 关闭手动加载TIMER.TCON = TIMER.TCON & (~(0x1 << 9));// 8. 打开自动加载TIMER.TCON = TIMER.TCON | ((0x1 << 11));TIMER.TINT_CSTAT |=(1<<6)|(1<<1);// 9. 使能TIMER定时器TIMER.TCON = TIMER.TCON | ((0x1 << 8));}void led_d7_toggle(void){GPIOB.OUT = GPIOB.OUT ^ (0x1<<26);}void Led_Init(void){// 1. 设置引脚功能为GPIO功能,查看芯片手册2.3.1章节GPIOB.ALTFN1 = GPIOB.ALTFN1 & (~(0x3 << 20));GPIOB.ALTFN1 = GPIOB.ALTFN1 | (0x1 << 20);// 2. 设置引脚为输出功能GPIOB.OUTENB = GPIOB.OUTENB | (0x1 << 26);GPIOB.OUT = GPIOB.OUT & (~(0x1 << 26));}int main(void){printf("Hello Teacher.He\r\n");printf("This is timer irq test\r\n");Led_Init();s5p6818_irq_init();Timer_init();while(1){}return 0;}

もどる

A. 戻る
B. 帰る
C. 起きる
D. 残る

答案查题题库