uarst.s
上传用户:xulicw
上传日期:2014-06-22
资源大小:133k
文件大小:2k
源码类别:

单片机开发

开发平台:

C++ Builder

  1. .module uarst.c
  2. .area text(rom, con, rel)
  3. .dbfile E:5按键_SD卡MP3程序uarst.c
  4. .dbfunc e uart0_init _uart0_init fV
  5. .even
  6. _uart0_init::
  7. .dbline -1
  8. .dbline 17
  9. ; /************************************************************/
  10. ; /*          UARST Code for   M32L     */
  11. ; /*    By   pasyong */
  12. ; /*    2006-4 */
  13. ; /*    Base ICC6.31A         */
  14. ; /************************************************************/
  15. ; #include <iom32v.h>
  16. ; #include <macros.h>
  17. ; #include <stdio.h>
  18. ; //UART0 initialize
  19. ; // desired baud rate: 9600
  20. ; // actual: baud rate:9600 (0.0%)
  21. ; // char size: 8 bit
  22. ; // parity: Disabled
  23. ; void uart0_init(void)
  24. ; {
  25. .dbline 18
  26. ;  UCSRB = 0x00; //disable while setting baud rate
  27. clr R2
  28. out 0xa,R2
  29. .dbline 19
  30. ;  UCSRA = 0x00;
  31. out 0xb,R2
  32. .dbline 20
  33. ;  UCSRC = BIT(URSEL) | 0x06;
  34. ldi R24,134
  35. out 0x20,R24
  36. .dbline 21
  37. ;  UBRRL = 0x2F; //set baud rate lo
  38. ldi R24,47
  39. out 0x9,R24
  40. .dbline 22
  41. ;  UBRRH = 0x00; //set baud rate hi
  42. out 0x20,R2
  43. .dbline 23
  44. ;  UCSRB = 0x18;
  45. ldi R24,24
  46. out 0xa,R24
  47. .dbline -2
  48. .dbline 24
  49. ; }
  50. L1:
  51. .dbline 0 ; func end
  52. ret
  53. .dbend
  54. .dbfunc e Puts _Puts fV
  55. ;              s -> R20,R21
  56. .even
  57. _Puts::
  58. xcall push_gset1
  59. movw R20,R16
  60. .dbline -1
  61. .dbline 27
  62. ; //串口输出字符串
  63. ; void Puts( unsigned char *s)
  64. ; { 
  65. xjmp L4
  66. L3:
  67. .dbline 29
  68. .dbline 30
  69. movw R30,R20
  70. ldd R16,z+0
  71. xcall _putchar
  72. .dbline 31
  73. subi R20,255  ; offset = 1
  74. sbci R21,255
  75. .dbline 32
  76. L4:
  77. .dbline 28
  78. ;   while (*s) 
  79. movw R30,R20
  80. ldd R2,z+0
  81. tst R2
  82. brne L3
  83. .dbline -2
  84. .dbline 33
  85. ;       {
  86. ;   putchar(*s);
  87. ;   s++;
  88. ;       }
  89. ; }
  90. L2:
  91. xcall pop_gset1
  92. .dbline 0 ; func end
  93. ret
  94. .dbsym r s 20 pc
  95. .dbend