main.ls 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. 2684 bsct
  5. 2685 0000 _version:
  6. 2686 0000 02 dc.b 2
  7. 2815 ; 24 void main() {
  8. 2817 switch .text
  9. 2818 0000 _main:
  10. 2820 0000 5206 subw sp,#6
  11. 2821 00000006 OFST: set 6
  12. 2824 ; 25 int i = 0,j=0;
  13. 2826 0002 5f clrw x
  14. 2827 0003 1f03 ldw (OFST-3,sp),x
  15. 2830 0005 5f clrw x
  16. 2831 0006 1f05 ldw (OFST-1,sp),x
  17. 2832 ; 26 CLK_CKDIVR = 0x08; //设置系统时钟为8MHZ
  18. 2834 0008 350850c6 mov _CLK_CKDIVR,#8
  19. 2835 ; 28 CLK_ICKR = 0x08; //打开低速时钟源
  20. 2837 000c 350850c0 mov _CLK_ICKR,#8
  21. 2838 ; 29 CFG_GCR |= 0x01; //禁止SWIM,复用PD1
  22. 2840 0010 72107f60 bset _CFG_GCR,#0
  23. 2841 ; 30 GPIO_INIT();
  24. 2843 0014 cd0000 call _GPIO_INIT
  25. 2845 ; 47 IWDG_INIT();
  26. 2847 0017 cd0000 call _IWDG_INIT
  27. 2849 ; 49 TIM1_PWM_INIT();
  28. 2851 001a cd0000 call _TIM1_PWM_INIT
  29. 2853 ; 50 TIM4_INIT();
  30. 2855 001d cd0000 call _TIM4_INIT
  31. 2857 ; 51 TIM2_INIT();
  32. 2859 0020 cd0000 call _TIM2_INIT
  33. 2861 ; 52 ADC_INIT();
  34. 2863 0023 cd0000 call _ADC_INIT
  35. 2865 ; 53 IIC_Init();
  36. 2867 0026 cd0000 call _IIC_Init
  37. 2869 ; 54 _asm("rim"); //开总中断
  38. 2872 0029 9a rim
  39. 2874 ; 55 stm8_data.version = version;
  40. 2876 002a 450000 mov _stm8_data,_version
  41. 2877 ; 56 IIC_Init();
  42. 2879 002d cd0000 call _IIC_Init
  43. 2882 0030 a605 ld a,#5
  44. 2883 0032 6b02 ld (OFST-4,sp),a
  45. 2884 0034 L3771:
  46. 2885 ; 57 INITTASKS(); //初始化任务函数
  47. 2887 0034 7b02 ld a,(OFST-4,sp)
  48. 2888 0036 5f clrw x
  49. 2889 0037 97 ld xl,a
  50. 2890 0038 58 sllw x
  51. 2891 0039 5a decw x
  52. 2892 003a 5a decw x
  53. 2893 003b 905f clrw y
  54. 2894 003d ef00 ldw (_timers,x),y
  55. 2897 003f 0a02 dec (OFST-4,sp)
  56. 2900 0041 0d02 tnz (OFST-4,sp)
  57. 2901 0043 26ef jrne L3771
  58. 2902 0045 L5002:
  59. 2903 ; 59 RUNTASK(safeTask,0);
  60. 2905 0045 be00 ldw x,_timers
  61. 2906 0047 2611 jrne L3202
  62. 2909 0049 cd0000 call _safeTask
  63. 2911 004c 1f01 ldw (OFST-5,sp),x
  64. 2913 004e 2004 jra L7102
  65. 2914 0050 L3102:
  66. 2917 0050 1e01 ldw x,(OFST-5,sp)
  67. 2918 0052 bf00 ldw _timers,x
  68. 2919 0054 L7102:
  69. 2922 0054 be00 ldw x,_timers
  70. 2923 0056 1301 cpw x,(OFST-5,sp)
  71. 2924 0058 26f6 jrne L3102
  72. 2925 005a L3202:
  73. 2926 ; 60 RUNTASK(safeIot,1);
  74. 2928 005a be02 ldw x,_timers+2
  75. 2929 005c 2611 jrne L1402
  76. 2932 005e cd0000 call _safeIot
  77. 2934 0061 1f01 ldw (OFST-5,sp),x
  78. 2936 0063 2004 jra L5302
  79. 2937 0065 L1302:
  80. 2940 0065 1e01 ldw x,(OFST-5,sp)
  81. 2941 0067 bf02 ldw _timers+2,x
  82. 2942 0069 L5302:
  83. 2945 0069 be02 ldw x,_timers+2
  84. 2946 006b 1301 cpw x,(OFST-5,sp)
  85. 2947 006d 26f6 jrne L1302
  86. 2948 006f L1402:
  87. 2949 ; 61 RUNTASK(getvbat,2);
  88. 2951 006f be04 ldw x,_timers+4
  89. 2952 0071 2611 jrne L7502
  90. 2955 0073 cd0000 call _getvbat
  91. 2957 0076 1f01 ldw (OFST-5,sp),x
  92. 2959 0078 2004 jra L3502
  93. 2960 007a L7402:
  94. 2963 007a 1e01 ldw x,(OFST-5,sp)
  95. 2964 007c bf04 ldw _timers+4,x
  96. 2965 007e L3502:
  97. 2968 007e be04 ldw x,_timers+4
  98. 2969 0080 1301 cpw x,(OFST-5,sp)
  99. 2970 0082 26f6 jrne L7402
  100. 2971 0084 L7502:
  101. 2972 ; 62 RUNTASK(control_task,3);
  102. 2974 0084 be06 ldw x,_timers+6
  103. 2975 0086 2611 jrne L5702
  104. 2978 0088 cd0000 call _control_task
  105. 2980 008b 1f01 ldw (OFST-5,sp),x
  106. 2982 008d 2004 jra L1702
  107. 2983 008f L5602:
  108. 2986 008f 1e01 ldw x,(OFST-5,sp)
  109. 2987 0091 bf06 ldw _timers+6,x
  110. 2988 0093 L1702:
  111. 2991 0093 be06 ldw x,_timers+6
  112. 2992 0095 1301 cpw x,(OFST-5,sp)
  113. 2993 0097 26f6 jrne L5602
  114. 2994 0099 L5702:
  115. 2995 ; 63 RUNTASK(fsl_task,4);
  116. 2997 0099 be08 ldw x,_timers+8
  117. 2998 009b 26a8 jrne L5002
  118. 3001 009d cd0000 call _fsl_task
  119. 3003 00a0 1f01 ldw (OFST-5,sp),x
  120. 3005 00a2 2004 jra L7012
  121. 3006 00a4 L3012:
  122. 3009 00a4 1e01 ldw x,(OFST-5,sp)
  123. 3010 00a6 bf08 ldw _timers+8,x
  124. 3011 00a8 L7012:
  125. 3014 00a8 be08 ldw x,_timers+8
  126. 3015 00aa 1301 cpw x,(OFST-5,sp)
  127. 3016 00ac 26f6 jrne L3012
  128. 3017 00ae 2095 jra L5002
  129. 3051 xdef _main
  130. 3052 xref.b _stm8_data
  131. 3053 xref _ADC_INIT
  132. 3054 xref _IIC_Init
  133. 3055 xref _GPIO_INIT
  134. 3056 xref _TIM4_INIT
  135. 3057 xref _TIM2_INIT
  136. 3058 xref _TIM1_PWM_INIT
  137. 3059 xref _fsl_task
  138. 3060 xref _control_task
  139. 3061 xref _getvbat
  140. 3062 xref _safeIot
  141. 3063 xref _safeTask
  142. 3064 xref _IWDG_INIT
  143. 3065 xdef _version
  144. 3066 switch .ubsct
  145. 3067 0000 _timers:
  146. 3068 0000 000000000000 ds.b 10
  147. 3069 xdef _timers
  148. 3089 end