找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 8764|回復(fù): 7
打印 上一主題 下一主題
收起左側(cè)

51單片機(jī)制作MP3 電路圖 源代碼

  [復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
下面是MP3的電路圖,有單片機(jī)部分的圖和電源部分的電路



這是壓縮包文件 包含源代碼2種格式的電路圖:
下載地址: 51單片機(jī)作MP3.zip (1.23 MB, 下載次數(shù): 76)

源碼預(yù)覽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
復(fù)制代碼


評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏4 分享淘帖 頂 踩

相關(guān)帖子

回復(fù)

使用道具 舉報(bào)

8#
ID:26275 發(fā)表于 2018-6-13 22:43 | 只看該作者
想問(wèn)下,這個(gè)支持哪些音頻格式的文件,單個(gè)文件支持多大的?  幾十上百m的CD格式的能行嗎?
回復(fù)

使用道具 舉報(bào)

7#
ID:319334 發(fā)表于 2018-6-7 09:49 | 只看該作者
有YS-M3語(yǔ)音模塊的電路原理圖么
回復(fù)

使用道具 舉報(bào)

6#
ID:244589 發(fā)表于 2017-11-14 09:12 | 只看該作者

他沒有黑幣了,又不舍得買
回復(fù)

使用道具 舉報(bào)

5#
ID:196311 發(fā)表于 2017-7-29 11:23 | 只看該作者
非常強(qiáng)大,支持樓主,頂起
回復(fù)

使用道具 舉報(bào)

地板
ID:37147 發(fā)表于 2017-7-29 08:42 | 只看該作者
2369562408 發(fā)表于 2017-7-28 20:50
可以給我一份發(fā)到郵箱嗎  謝謝。。。

自己下載不行嗎
回復(fù)

使用道具 舉報(bào)

板凳
ID:223086 發(fā)表于 2017-7-28 20:50 | 只看該作者
可以給我一份發(fā)到郵箱嗎  謝謝。。!
2369562408@qq.com
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:194847 發(fā)表于 2017-5-25 23:56 | 只看該作者
支持樓主,厲害
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表