找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 8031|回复: 7
打印 上一主题 下一主题
收起左侧

51单片机制作MP3 电路图 源代码

  [复制链接]
跳转到指定楼层
楼主
下面是MP3的电路图,有单片机部分的图和电源部分的电路



这是压缩包文件 包含源代码2种格式的电路图:
下载地址: 51单片机作MP3.zip (1.23 MB, 下载次数: 76)

源码预览scheduler.c :
  1. /*C**************************************************************************
  2. * NAME:         scheduler.c
  3. *----------------------------------------------------------------------------
  4. * Copyright (c) 2003 Atmel.
  5. *----------------------------------------------------------------------------
  6. * RELEASE:      snd1c-refd-nf-4_0_3      
  7. * REVISION:     1.8     
  8. *----------------------------------------------------------------------------
  9. * PURPOSE:
  10. * This file contains the scheduler routines
  11. *
  12. * NOTES:
  13. * Configuration:
  14. *   - SCH_TYPE in scheduler.h header file
  15. *   - SCH_TIMER in scheduler.h header file
  16. * Global Variables:
  17. *   - gl_cpt_tick: byte in data space
  18. *   - gl_kbd_tick: byte in data space
  19. *   - gl_mem_tick: byte in data space
  20. *
  21. *****************************************************************************/

  22. /*_____ I N C L U D E S ____________________________________________________*/

  23. #include "config.h"                         /* system definition */
  24. #include "lib_mcu\timer\timer_drv.h"        /* timer definition */
  25. #include "scheduler.h"                      /* scheduler definition */


  26. /*_____ M A C R O S ________________________________________________________*/


  27. /*_____ D E F I N I T I O N ________________________________________________*/

  28. extern  data    Byte    gl_cpt_tick;        /* general tick counter */
  29. extern  data    Byte    gl_kbd_tick;        /* keypad tick counter */
  30. extern  data    Byte    gl_mem_tick;        /* memory tick counter */
  31. extern  data    Byte    gl_led_tick;        /* led tick counter */
  32. extern  idata   Uint16  gl_act_tick;        /* led tick counter */

  33. #if (SCH_TYPE != SCH_FREE)
  34.   bit   sch_tick_flag;
  35. #endif


  36. /*_____ D E C L A R A T I O N ______________________________________________*/

  37. static  void sch_time_init (void);


  38. /*F**************************************************************************
  39. * NAME:     sch_scheduler_init
  40. *----------------------------------------------------------------------------
  41. * PARAMS:
  42. *
  43. * return:
  44. *----------------------------------------------------------------------------
  45. * PURPOSE:
  46. *   Scheduler initialization
  47. *----------------------------------------------------------------------------
  48. * EXAMPLE:
  49. *----------------------------------------------------------------------------
  50. * NOTE:
  51. *   Task_x_init() and Task_x_fct() are defined in scheduler.h
  52. *----------------------------------------------------------------------------
  53. * REQUIREMENTS:
  54. *****************************************************************************/
  55. void sch_scheduler_init (void)
  56. {
  57.   Task_1_init();  
  58.   Task_2_init();  
  59.   Task_3_init();  
  60.   Task_4_init();  
  61.   Task_5_init();  
  62.   Task_6_init();  
  63.   Task_7_init();  
  64.   Task_8_init();  
  65.   Task_9_init();  
  66.   Task_10_init();
  67. #if (SCH_TYPE != SCH_FREE)
  68.   sch_tick_flag = FALSE;
  69. #endif
  70.   sch_time_init();                /* start time base */
  71. }


  72. /*F**************************************************************************
  73. * NAME:     sch_scheduler
  74. *----------------------------------------------------------------------------
  75. * PARAMS:
  76. *
  77. * return:
  78. *----------------------------------------------------------------------------
  79. * PURPOSE:
  80. *   Task execution scheduler
  81. *----------------------------------------------------------------------------
  82. * EXAMPLE:
  83. *----------------------------------------------------------------------------
  84. * NOTE:
  85. *----------------------------------------------------------------------------
  86. * REQUIREMENTS:
  87. *****************************************************************************/
  88. void sch_scheduler (void)
  89. {
  90.   while (1)
  91.   {
  92.     Task_1_fct();
  93.     Sch_call_next_task();

  94.     Task_2_fct();
  95.     Sch_call_next_task();

  96.     Task_3_fct();
  97.     Sch_call_next_task();
  98.   
  99.     Task_4_fct();
  100.     Sch_call_next_task();
  101.   
  102.     Task_5_fct();
  103.     Sch_call_next_task();
  104.   
  105.     Task_6_fct();
  106.     Sch_call_next_task();
  107.   
  108.     Task_7_fct();
  109.     Sch_call_next_task();
  110.   
  111.     Task_8_fct();
  112.     Sch_call_next_task();
  113.   
  114.     Task_9_fct();
  115.     Sch_call_next_task();
  116.   
  117.     Task_10_fct();
  118.     Sch_call_next_task();

  119.     Sch_new_schedule();
  120.   }
  121. }


  122. /*F**************************************************************************
  123. * NAME:    sch_default_fct
  124. *----------------------------------------------------------------------------
  125. * PARAMS:
  126. *
  127. * return:
  128. *----------------------------------------------------------------------------
  129. * PURPOSE:
  130. *   This function does nothing
  131. *----------------------------------------------------------------------------
  132. * EXAMPLE:
  133. *----------------------------------------------------------------------------
  134. * NOTE:
  135. *----------------------------------------------------------------------------
  136. * REQUIREMENTS:
  137. *****************************************************************************/
  138. void sch_default_fct (void)
  139. {
  140. }


  141. #if (SCH_TIMER == SCH_TIMER0)
  142. /*F**************************************************************************
  143. * NAME:     sch_time_init
  144. *----------------------------------------------------------------------------
  145. * PARAMS:
  146. *
  147. * return:
  148. *----------------------------------------------------------------------------
  149. * PURPOSE:
  150. *   Scheduler time base (timer 0) initialization
  151. *----------------------------------------------------------------------------
  152. * EXAMPLE:
  153. *----------------------------------------------------------------------------
  154. * NOTE:
  155. *   mode 16-bit Timer, Time counter
  156. *   T0_PRIO to be defined in config.h
  157. *   TIM_LOW & TIM_HIGH defined in scheduler.h
  158. *----------------------------------------------------------------------------
  159. * REQUIREMENTS:
  160. *****************************************************************************/
  161. void sch_time_init (void)
  162. {
  163.   T0_init(T0_NOT_GATED, T0_TIMER, T0_MODE_1);
  164.   TL0 = TIM_LOW;
  165.   TH0 = TIM_HIGH;
  166.   t0_set_prio(T0_PRIO);         /* set-up priority */
  167.   T0_enable_int();              /* enable interrupt */
  168.   T0_start();                   /* start time base */
  169. }

  170. /*F**************************************************************************
  171. * NAME:     sch_timer_int
  172. *----------------------------------------------------------------------------
  173. * PARAMS:
  174. *
  175. * return:
  176. *----------------------------------------------------------------------------
  177. * PURPOSE:
  178. *   Timer 0 interrupt function
  179. *----------------------------------------------------------------------------
  180. * EXAMPLE:
  181. *----------------------------------------------------------------------------
  182. * NOTE:
  183. *   IRQ_T0 defined in extsnd1.h
  184. *----------------------------------------------------------------------------
  185. * REQUIREMENTS:
  186. ******************************************************************************/
  187. Interrupt (sch_timer_int(void), IRQ_T0)
  188. {
  189. //  T0_stop();                    /* stop timer */
  190.   TL0 = TIM_LOW;                /* reload timer */
  191.   TH0 = TIM_HIGH;
  192. //  T0_start();                   /* restart timer */

  193. #if (SCH_TYPE != SCH_FREE)
  194.   sch_tick_flag = TRUE;
  195. #endif
  196.   /* increment task tick counters */
  197.   gl_cpt_tick++;                /* general timer */
  198.   gl_kbd_tick++;                /* keyboard timer */
  199.   gl_mem_tick++;                /* memory timer */
  200.   gl_led_tick++;                /* LED timer */
  201.   gl_act_tick++;                                /* Inactivity TIMER */


  202. }


  203. #elif (SCH_TIMER == SCH_TIMER1)
  204. /*F**************************************************************************
  205. * NAME:     sch_time_init
  206. *----------------------------------------------------------------------------
  207. * PARAMS:
  208. *
  209. * return:
  210. *----------------------------------------------------------------------------
  211. * PURPOSE:
  212. *   Scheduler time base (timer 1) initialization
  213. *----------------------------------------------------------------------------
  214. * EXAMPLE:
  215. *----------------------------------------------------------------------------
  216. * NOTE:
  217. *   mode 16-bit Timer, Time counter
  218. *   T1_PRIO to be defined in config.h
  219. *   TIM_LOW & TIM_HIGH defined in scheduler.h
  220. *----------------------------------------------------------------------------
  221. * REQUIREMENTS:
  222. *****************************************************************************/
  223. void sch_time_init (void)
  224. {
  225.   T1_init(T1_NOT_GATED, T1_TIMER, T1_MODE_1);
  226.   TL1 = TIM_LOW;
  227.   TH1 = TIM_HIGH;
  228.   t1_set_prio(T1_PRIO);         /* set-up priority */
  229.   T1_enable_int();              /* enable interrupt */
  230.   T1_start();                   /* start time base */
  231. }

  232. /*F**************************************************************************
  233. * NAME:     sch_timer_int
  234. *----------------------------------------------------------------------------
  235. * PARAMS:
  236. *
  237. * return:
  238. *----------------------------------------------------------------------------
  239. * PURPOSE:
  240. *   Timer 1 interrupt function
  241. *----------------------------------------------------------------------------
  242. * EXAMPLE:
  243. *----------------------------------------------------------------------------
  244. * NOTE:
  245. *   IRQ_T1 defined in extsnd1.h
  246. *----------------------------------------------------------------------------
  247. * REQUIREMENTS:
  248. *****************************************************************************/
  249. Interrupt (sch_timer_int(void), IRQ_T1)
  250. {
  251. //  T1_stop();                    /* stop timer */
  252.   TL1 = TIM_LOW;                /* reload timer */
  253.   TH1 = TIM_HIGH;
  254. //  T1_start();                   /* restart timer */

  255. #if (SCH_TYPE != SCH_FREE)
  256.   sch_tick_flag = TRUE;
  257. #endif

  258.   gl_cpt_tick++;
  259. }


  260. #elif (SCH_TIMER == SCH_TIMER2)
  261. /*F**************************************************************************
  262. * NAME:     sch_time_init
  263. *----------------------------------------------------------------------------
  264. * PARAMS:
  265. *
  266. * return:
  267. *----------------------------------------------------------------------------
  268. * PURPOSE:
  269. *   Scheduler time base (timer 2) initialization
  270. *----------------------------------------------------------------------------
  271. * EXAMPLE:
  272. *----------------------------------------------------------------------------
  273. * NOTE:
  274. *   mode 16-bit auto-reload
  275. *   T2_PRIO to be defined in config.h
  276. *   TIM_LOW & TIM_HIGH defined in scheduler.h
  277. *----------------------------------------------------------------------------
  278. * REQUIREMENTS:
  279. *****************************************************************************/
  280. void sch_time_init (void)
  281. {
  282.   T2_init(T2_AUTO_RELOAD, T2_TIMER, T2_NOT_GATED);
  283.   RCAP2L = TIM_LOW;
  284.   RCAP2H = TIM_HIGH;
  285.   t2_set_prio(T2_PRIO);         /* set-up priority */
  286.   T2_enable_int();              /* enable interrupt */
  287.   T2_start();                   /* start time base */
  288. }

  289. /*F**************************************************************************
  290. * NAME:     sch_timer_int
  291. *----------------------------------------------------------------------------
  292. * PARAMS:
  293. *
  294. * return:
  295. *----------------------------------------------------------------------------
  296. * PURPOSE:
  297. *   Timer 2 interrupt function
  298. *----------------------------------------------------------------------------
  299. * EXAMPLE:
  300. *----------------------------------------------------------------------------
  301. * NOTE:
  302. *   IRQ_T2 defined in extsnd1.h
  303. *----------------------------------------------------------------------------
  304. * REQUIREMENTS:
  305. ******************************************************************************/
  306. Interrupt (sch_timer_int(void), IRQ_T2)
  307. {
  308.   TF2 = 0;                      /* ack interrupt */

  309. #if (SCH_TYPE != SCH_FREE)
  310.   sch_tick_flag = TRUE;
  311. #endif
  312.   gl_cpt_tick++;
  313. }
  314. #endif
复制代码


评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏4 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:194847 发表于 2017-5-25 23:56 | 只看该作者
支持楼主,厉害
回复

使用道具 举报

板凳
ID:223086 发表于 2017-7-28 20:50 | 只看该作者
可以给我一份发到邮箱吗  谢谢!!!!
2369562408@qq.com
回复

使用道具 举报

地板
ID:37147 发表于 2017-7-29 08:42 | 只看该作者
2369562408 发表于 2017-7-28 20:50
可以给我一份发到邮箱吗  谢谢!!!!

自己下载不行吗
回复

使用道具 举报

5#
ID:196311 发表于 2017-7-29 11:23 | 只看该作者
非常强大,支持楼主,顶起
回复

使用道具 举报

6#
ID:244589 发表于 2017-11-14 09:12 | 只看该作者
周鹏 发表于 2017-7-29 08:42
自己下载不行吗

他没有黑币了,又不舍得买
回复

使用道具 举报

7#
ID:319334 发表于 2018-6-7 09:49 | 只看该作者
有YS-M3语音模块的电路原理图么
回复

使用道具 举报

8#
ID:26275 发表于 2018-6-13 22:43 | 只看该作者
想问下,这个支持哪些音频格式的文件,单个文件支持多大的?  几十上百m的CD格式的能行吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表