实例介绍
【核心代码】
void main(void) { //自行添加代码 uint16 x,i; int sin_data[2000]={0}; FS_1S = 0; FS_10S = 0; x =0; DisableInterrupts; //禁止总中断 //按键IO口初始化 INIT_KEY_IO(); uart_init(UART4,115200); hw_pit_init(PIT0,bus_clk_khz/100); //初始化PIT0,定时时间为: 1000ms hw_pit_init(PIT1,bus_clk_khz); //初始化PIT0,定时时间为: 1000ms hw_enable_pit_int(PIT0); //开pit中断 hw_enable_pit_int(PIT1); //开pit中断 //DAC初始化 hw_dac_init(0,1); hw_dac_convert(0,2048); EnableInterrupts; //开总中断 while(1) { if(FS_1S){FS_1S = 0;} if(FS_10S > 40000) {break;} } LCD_init(UART4); LCD_MAIN(1,1,1,1,buf); while(1) { if(1 == Scn_Key) { Scan_Key(); //按键扫描模块 Scn_Key = 0; } //按键处理 KEY_FUN(); //波形输出 if(ONE_BO == 1) { for(i=0;i<2000;i ) { sin_data[i] = (int)((cos(i*0.00314))*fuzhi*Menu3_Data) 2047; } while(1) { if(FS_1S) { FS_1S = 0; hw_dac_convert(0,sin_data[x]); x ; if(x>1999){x= 0;hw_dac_convert(0,2047);break;} } } ONE_BO = 0; } } }
【源码目录】
k60-DAC
├── Debug
│ ├── Exe
│ │ ├── k60.hex
│ │ ├── k60.out
│ │ └── k60.sim
│ ├── List
│ │ └── k60.map
│ └── Obj
│ ├── KEY.o
│ ├── LCD_Drv.o
│ ├── LCD_MENU.o
│ ├── LED.o
│ ├── NRF905.o
│ ├── adc.o
│ ├── alloc.o
│ ├── arm_cm4.o
│ ├── assert.o
│ ├── crt0.o
│ ├── delay.o
│ ├── gpio.o
│ ├── hw_dac.o
│ ├── io.o
│ ├── isr.o
│ ├── k60.pbd
│ ├── main.o
│ ├── mcg.o
│ ├── memtest.o
│ ├── pit.o
│ ├── printf.o
│ ├── queue.o
│ ├── rtc.o
│ ├── spi.o
│ ├── start.o
│ ├── startup.o
│ ├── stdlib.o
│ ├── sysinit.o
│ ├── uart.o
│ ├── uif.o
│ ├── vectors.o
│ └── wdog.o
├── Release
│ ├── Exe
│ ├── List
│ └── Obj
│ ├── LCD_MENU.o
│ ├── k60.pbd
│ └── memtest.o
├── config files
│ ├── 128KB_Pflash.icf
│ ├── 128KB_Pflash_128KB_Dflash.icf
│ ├── 128KB_Ram.icf
│ ├── 256KB_Pflash.icf
│ ├── 256KB_Pflash_256KB_Dflash.icf
│ ├── 32KB_Ram.icf
│ ├── 512KB_Pflash.icf
│ ├── 64KB_Pflash_64KB_Dflash.icf
│ └── 64KB_Ram.icf
├── k60.dep
├── k60.ewd
├── k60.ewp
├── k60.eww
├── settings
│ ├── k60.cspy.bat
│ ├── k60.dbgdt
│ ├── k60.dni
│ ├── k60.wsdt
│ └── k60_Debug.jlink
└── src
├── LIB
│ ├── arm_common_tables.h
│ ├── arm_math.h
│ ├── core_cm0.h
│ ├── core_cm3.h
│ ├── core_cm4.h
│ ├── core_cm4_simd.h
│ ├── core_cmFunc.h
│ ├── core_cmInstr.h
│ └── iar_cortexM4l_math.a
├── app
│ ├── iar.h
│ ├── include.h
│ ├── isr.c
│ ├── isr.h
│ └── main.c
├── common
│ ├── alloc.c
│ ├── assert.c
│ ├── assert.h
│ ├── common.h
│ ├── io.c
│ ├── io.h
│ ├── memtest.c
│ ├── memtest.h
│ ├── printf.c
│ ├── queue.c
│ ├── queue.h
│ ├── startup.c
│ ├── startup.h
│ ├── stdlib.c
│ ├── stdlib.h
│ ├── uif.c
│ └── uif.h
├── cpu
│ ├── arm_cm4.c
│ ├── arm_cm4.h
│ ├── crt0.s
│ ├── cw_crt0.s
│ ├── dma_channels.h
│ ├── headers
│ │ ├── MK10DZ10.h
│ │ ├── MK20DZ10.h
│ │ ├── MK30DZ10.h
│ │ ├── MK40DZ10.h
│ │ ├── MK50DZ10.h
│ │ ├── MK51DZ10.h
│ │ ├── MK52DZ10.h
│ │ ├── MK53DZ10.h
│ │ └── MK60DZ10.h
│ ├── start.c
│ ├── start.h
│ ├── sysinit.c
│ ├── sysinit.h
│ ├── vectors.c
│ └── vectors.h
├── drivers
│ ├── KEY
│ │ ├── KEY.c
│ │ └── KEY.h
│ ├── LCD
│ │ ├── LCD_Drv.c
│ │ ├── LCD_Drv.h
│ │ ├── LCD_MENU.c
│ │ └── LCD_MENU.h
│ ├── LED
│ │ ├── LED.C
│ │ └── LED.H
│ ├── adc
│ │ ├── adc.c
│ │ ├── adc.h
│ │ └── adc_cfg.h
│ ├── dac
│ │ ├── hw_dac.c
│ │ └── hw_dac.h
│ ├── delay
│ │ ├── delay.c
│ │ └── delay.h
│ ├── exti
│ │ ├── exti.c
│ │ └── exti.h
│ ├── fire_drivers_cfg.h
│ ├── gpio
│ │ ├── gpio.c
│ │ ├── gpio.h
│ │ └── gpio_cfg.h
│ ├── lptmr
│ │ ├── lptmr.c
│ │ └── lptmr.h
│ ├── mcg
│ │ ├── Fire_kinetis_MCG_CFG.h
│ │ ├── mcg.c
│ │ ├── mcg.h
│ │ └── mcg_cfg.h
│ ├── pit
│ │ ├── pit.c
│ │ └── pit.h
│ ├── pmc
│ │ ├── pmc.c
│ │ └── pmc.h
│ ├── rtc
│ │ ├── rtc.c
│ │ └── rtc.h
│ ├── spi
│ │ ├── NRF905.C
│ │ ├── NRF905.h
│ │ ├── spi.c
│ │ └── spi.h
│ ├── uart
│ │ ├── uart.c
│ │ └── uart.h
│ └── wdog
│ ├── wdog.c
│ └── wdog.h
├── platforms
│ ├── k40_tower.h
│ ├── k53_tower.h
│ ├── k60_fire.h
│ └── k60_tower.h
├── projects
│ ├── fire_Input_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_PWM_Input_PIT_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_adc_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_cmsis_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_exti_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_gpio_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_i2c_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_led_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_pit_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_pwm_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_spi_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_uart_int_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_uart_loop_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ ├── fire_uart_send_demo
│ │ ├── include.h
│ │ ├── isr.c
│ │ ├── isr.h
│ │ └── main.c
│ └── fire_ucos_led_demo
│ ├── include.h
│ ├── isr.c
│ ├── isr.h
│ └── main.c
└── uCOS-II
├── App
│ ├── BSP.c
│ ├── BSP.h
│ ├── CFG
│ │ ├── app_cfg.h
│ │ └── os_cfg.h
│ ├── app.c
│ ├── app.h
│ └── app_hooks.c
├── Ports
│ ├── os_cpu.h
│ ├── os_cpu_a.asm
│ ├── os_cpu_c.c
│ └── os_dbg.c
└── Source
├── os_core.c
├── os_flag.c
├── os_mbox.c
├── os_mem.c
├── os_mutex.c
├── os_q.c
├── os_sem.c
├── os_task.c
├── os_time.c
├── os_tmr.c
└── ucos_ii.h
55 directories, 235 files
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论