main.ls 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. 1 ; C Compiler for STM8 (COSMIC Software)
  2. 2 ; Parser V4.8.32 - 23 Mar 2010
  3. 3 ; Generator V4.3.4 - 23 Mar 2010
  4. 2696 bsct
  5. 2697 0000 _version:
  6. 2698 0000 02 dc.b 2
  7. 2826 ; 24 void main() {
  8. 2828 switch .text
  9. 2829 0000 _main:
  10. 2831 0000 5206 subw sp,#6
  11. 2832 00000006 OFST: set 6
  12. 2835 ; 25 int i = 0,j=0;
  13. 2837 0002 5f clrw x
  14. 2838 0003 1f03 ldw (OFST-3,sp),x
  15. 2841 0005 5f clrw x
  16. 2842 0006 1f05 ldw (OFST-1,sp),x
  17. 2843 ; 26 CLK_CKDIVR = 0x08; //设置系统时钟为8MHZ
  18. 2845 0008 350850c6 mov _CLK_CKDIVR,#8
  19. 2846 ; 28 CLK_ICKR = 0x08; //打开低速时钟源
  20. 2848 000c 350850c0 mov _CLK_ICKR,#8
  21. 2849 ; 29 CFG_GCR |= 0x01; //禁止SWIM,复用PD1
  22. 2851 0010 72107f60 bset _CFG_GCR,#0
  23. 2852 ; 30 GPIO_INIT();
  24. 2854 0014 cd0000 call _GPIO_INIT
  25. 2856 ; 47 IWDG_INIT();
  26. 2858 0017 cd0000 call _IWDG_INIT
  27. 2860 ; 49 TIM1_PWM_INIT();
  28. 2862 001a cd0000 call _TIM1_PWM_INIT
  29. 2864 ; 50 TIM4_INIT();
  30. 2866 001d cd0000 call _TIM4_INIT
  31. 2868 ; 52 ADC_INIT();
  32. 2870 0020 cd0000 call _ADC_INIT
  33. 2872 ; 53 IIC_Init();
  34. 2874 0023 cd0000 call _IIC_Init
  35. 2876 ; 54 _asm("rim"); //开总中断
  36. 2879 0026 9a rim
  37. 2881 ; 55 stm8_data.version = version;
  38. 2883 0027 450000 mov _stm8_data,_version
  39. 2884 ; 56 IIC_Init();
  40. 2886 002a cd0000 call _IIC_Init
  41. 2889 002d a605 ld a,#5
  42. 2890 002f 6b02 ld (OFST-4,sp),a
  43. 2891 0031 L7771:
  44. 2892 ; 57 INITTASKS(); //初始化任务函数
  45. 2894 0031 7b02 ld a,(OFST-4,sp)
  46. 2895 0033 5f clrw x
  47. 2896 0034 97 ld xl,a
  48. 2897 0035 58 sllw x
  49. 2898 0036 5a decw x
  50. 2899 0037 5a decw x
  51. 2900 0038 905f clrw y
  52. 2901 003a ef00 ldw (_timers,x),y
  53. 2904 003c 0a02 dec (OFST-4,sp)
  54. 2907 003e 0d02 tnz (OFST-4,sp)
  55. 2908 0040 26ef jrne L7771
  56. 2909 0042 L1102:
  57. 2910 ; 59 RUNTASK(safeTask,0);
  58. 2912 0042 be00 ldw x,_timers
  59. 2913 0044 2611 jrne L7202
  60. 2916 0046 cd0000 call _safeTask
  61. 2918 0049 1f01 ldw (OFST-5,sp),x
  62. 2920 004b 2004 jra L3202
  63. 2921 004d L7102:
  64. 2924 004d 1e01 ldw x,(OFST-5,sp)
  65. 2925 004f bf00 ldw _timers,x
  66. 2926 0051 L3202:
  67. 2929 0051 be00 ldw x,_timers
  68. 2930 0053 1301 cpw x,(OFST-5,sp)
  69. 2931 0055 26f6 jrne L7102
  70. 2932 0057 L7202:
  71. 2933 ; 60 RUNTASK(safeIot,1);
  72. 2935 0057 be02 ldw x,_timers+2
  73. 2936 0059 2611 jrne L5402
  74. 2939 005b cd0000 call _safeIot
  75. 2941 005e 1f01 ldw (OFST-5,sp),x
  76. 2943 0060 2004 jra L1402
  77. 2944 0062 L5302:
  78. 2947 0062 1e01 ldw x,(OFST-5,sp)
  79. 2948 0064 bf02 ldw _timers+2,x
  80. 2949 0066 L1402:
  81. 2952 0066 be02 ldw x,_timers+2
  82. 2953 0068 1301 cpw x,(OFST-5,sp)
  83. 2954 006a 26f6 jrne L5302
  84. 2955 006c L5402:
  85. 2956 ; 61 RUNTASK(getvbat,2);
  86. 2958 006c be04 ldw x,_timers+4
  87. 2959 006e 2611 jrne L3602
  88. 2962 0070 cd0000 call _getvbat
  89. 2964 0073 1f01 ldw (OFST-5,sp),x
  90. 2966 0075 2004 jra L7502
  91. 2967 0077 L3502:
  92. 2970 0077 1e01 ldw x,(OFST-5,sp)
  93. 2971 0079 bf04 ldw _timers+4,x
  94. 2972 007b L7502:
  95. 2975 007b be04 ldw x,_timers+4
  96. 2976 007d 1301 cpw x,(OFST-5,sp)
  97. 2977 007f 26f6 jrne L3502
  98. 2978 0081 L3602:
  99. 2979 ; 62 RUNTASK(control_task,3);
  100. 2981 0081 be06 ldw x,_timers+6
  101. 2982 0083 2611 jrne L1012
  102. 2985 0085 cd0000 call _control_task
  103. 2987 0088 1f01 ldw (OFST-5,sp),x
  104. 2989 008a 2004 jra L5702
  105. 2990 008c L1702:
  106. 2993 008c 1e01 ldw x,(OFST-5,sp)
  107. 2994 008e bf06 ldw _timers+6,x
  108. 2995 0090 L5702:
  109. 2998 0090 be06 ldw x,_timers+6
  110. 2999 0092 1301 cpw x,(OFST-5,sp)
  111. 3000 0094 26f6 jrne L1702
  112. 3001 0096 L1012:
  113. 3002 ; 63 RUNTASK(fsl_task,4);
  114. 3004 0096 be08 ldw x,_timers+8
  115. 3005 0098 26a8 jrne L1102
  116. 3008 009a cd0000 call _fsl_task
  117. 3010 009d 1f01 ldw (OFST-5,sp),x
  118. 3012 009f 2004 jra L3112
  119. 3013 00a1 L7012:
  120. 3016 00a1 1e01 ldw x,(OFST-5,sp)
  121. 3017 00a3 bf08 ldw _timers+8,x
  122. 3018 00a5 L3112:
  123. 3021 00a5 be08 ldw x,_timers+8
  124. 3022 00a7 1301 cpw x,(OFST-5,sp)
  125. 3023 00a9 26f6 jrne L7012
  126. 3024 00ab 2095 jra L1102
  127. 3058 xdef _main
  128. 3059 xref.b _stm8_data
  129. 3060 xref _ADC_INIT
  130. 3061 xref _IIC_Init
  131. 3062 xref _GPIO_INIT
  132. 3063 xref _TIM4_INIT
  133. 3064 xref _TIM1_PWM_INIT
  134. 3065 xref _fsl_task
  135. 3066 xref _control_task
  136. 3067 xref _getvbat
  137. 3068 xref _safeIot
  138. 3069 xref _safeTask
  139. 3070 xref _IWDG_INIT
  140. 3071 xdef _version
  141. 3072 switch .ubsct
  142. 3073 0000 _timers:
  143. 3074 0000 000000000000 ds.b 10
  144. 3075 xdef _timers
  145. 3095 end