📄 sci.ls
字号:
1935 013b b6fe ld a,_PrintSignedChar$L-2
1936 013d b700 ld c_x,a
1937 013f beff ld x,_PrintSignedChar$L-1
1938 0141 9f ld a,x
1939 0142 a001 sub a,#1
1940 0144 b7ff ld _PrintSignedChar$L-1,a
1941 0146 2402 jrnc L63
1942 0148 3afe dec _PrintSignedChar$L-2
1943 014a L63:
1944 014a a62d ld a,#45
1945 014c L5221:
1946 014c bf01 ld c_x+1,x
1947 014e 92c700 ld [c_x.w],a
1948 ; 97 SCI_PutString( s+1 );
1950 0151 b6ff ld a,_PrintSignedChar$L-1
1951 0153 befe ld x,_PrintSignedChar$L-2
1952 0155 4c inc a
1953 0156 2601 jrne L04
1954 0158 5c inc x
1955 0159 L04:
1957 ; 98 }
1960 0159 cc0205 jp _SCI_PutString
2093 ; 109 void SCI_Init ( SCI_Type_Param1 Init_Value1, SCI_Type_Param2 Init_Value2)
2093 ; 110 {
2094 switch .text
2096 xref.b _SCI_Init$L
2097 015c _SCI_Init:
2099 015c b700 ld _SCI_Init$L,a
2101 ; 113 SCICR1 = SCI_DEFAULT_PARAM1; /*Load Default value*/
2103 015e 4f clr a
2104 015f b71b ld _SCICR1,a
2105 ; 114 SCICR2 = SCI_DEFAULT_PARAM2;
2107 0161 b71c ld _SCICR2,a
2108 ; 115 temp = SCISR; /*Clear all the flags in Status register*/
2110 0163 b618 ld a,_SCISR
2111 ; 116 temp = SCIDR;
2113 0165 b619 ld a,_SCIDR
2114 ; 117 SCIDR = SCI_DEFAULT_PARAM1;
2116 0167 4f clr a
2117 0168 b719 ld _SCIDR,a
2118 ; 118 SCICR1 |= Init_Value1; /*Sets SCI in the required mode*/
2120 016a b61b ld a,_SCICR1
2121 016c ba00 or a,_SCI_Init$L
2122 016e b71b ld _SCICR1,a
2123 ; 119 SCICR2 |= Init_Value2;
2125 0170 b61c ld a,_SCICR2
2126 0172 ba01 or a,_SCI_Init$L+1
2127 0174 b71c ld _SCICR2,a
2128 ; 120 SCI_Pol_Stat = SCI_Error = 0; /*Initializes globalvariables*/
2130 0176 4f clr a
2131 0177 c7000b ld L7401_SCI_Error,a
2132 017a c70000 ld L7601_SCI_Pol_Stat,a
2133 ; 121 SCI_Tx_Buff = 0;
2135 017d c70005 ld L7501_SCI_Tx_Buff,a
2136 ; 122 SCI_Tx_String = 0;
2138 0180 c70004 ld L1601_SCI_Tx_String,a
2139 ; 123 SCI_Rx_Buff = SCI_Rx_String = 0;
2141 0183 c70001 ld L5601_SCI_Rx_String,a
2142 0186 c70002 ld L3601_SCI_Rx_Buff,a
2143 0189 c70003 ld L3601_SCI_Rx_Buff+1,a
2144 ; 124 }
2147 018c 81 ret
2202 ; 132 void SCI_Mode(SCI_Mode_Type SCI_Mode_Param)
2202 ; 133 {
2203 switch .text
2205 xref.b _SCI_Mode$L
2206 018d _SCI_Mode:
2209 ; 134 SCICR2 |= SCI_Mode_Param; /*Selects Transmitter or Receiver mode*/
2211 018d ba1c or a,_SCICR2
2212 018f b71c ld _SCICR2,a
2213 ; 135 }
2216 0191 81 ret
2262 ; 143 void SCI_Forced_Clear_Flag( void )
2262 ; 144 {
2263 switch .text
2265 xref.b _SCI_Forced_Clear_Flag$L
2266 0192 _SCI_Forced_Clear_Flag:
2269 ; 147 Temp_Variable = SCICR2;
2271 0192 b61c ld a,_SCICR2
2272 0194 b7ff ld _SCI_Forced_Clear_Flag$L-1,a
2273 ; 148 SCICR2 = 0x00;
2275 0196 4f clr a
2276 0197 b71c ld _SCICR2,a
2277 ; 149 temp = SCISR; /*Clears all flags in status register*/
2279 0199 b618 ld a,_SCISR
2280 ; 150 SCIDR = 0x00;
2282 019b 4f clr a
2283 019c b719 ld _SCIDR,a
2284 ; 151 SCICR2 = Temp_Variable;
2286 019e b6ff ld a,_SCI_Forced_Clear_Flag$L-1
2287 01a0 b71c ld _SCICR2,a
2288 ; 152 }
2291 01a2 81 ret
2371 ; 161 void SCI_IT_Enable ( SCI_IT_Type SCI_IT_Param)
2371 ; 162 {
2372 switch .text
2374 xref.b _SCI_IT_Enable$L
2375 01a3 _SCI_IT_Enable:
2377 01a3 b700 ld _SCI_IT_Enable$L,a
2379 ; 163 SCICR1 |= (unsigned char)(SCI_IT_Param & SCI_PARITY_ERROR);
2381 01a5 a401 and a,#1
2382 01a7 ba1b or a,_SCICR1
2383 01a9 b71b ld _SCICR1,a
2384 ; 165 SCICR2 |= (unsigned char)(SCI_IT_Param & (~SCI_PARITY_ERROR)) ;
2386 01ab b600 ld a,_SCI_IT_Enable$L
2387 01ad a4fe and a,#254
2388 01af ba1c or a,_SCICR2
2389 01b1 b71c ld _SCICR2,a
2390 ; 166 }
2393 01b3 81 ret
2575 ; 175 void SCI_Select_Baudrate (SCI_Baudrate_Type Baudrate_Presc)
2575 ; 176 {
2576 switch .text
2578 xref.b _SCI_Select_Baudrate$L
2579 01b4 _SCI_Select_Baudrate:
2581 01b4 b700 ld _SCI_Select_Baudrate$L,a
2583 ; 177 SCIBRR =0x00;
2585 01b6 4f clr a
2586 01b7 b71a ld _SCIBRR,a
2587 ; 178 SCIBRR |= Baudrate_Presc; /*Loads the required value in SCIBRR*/
2589 01b9 b61a ld a,_SCIBRR
2590 01bb ba00 or a,_SCI_Select_Baudrate$L
2591 01bd b71a ld _SCIBRR,a
2592 ; 179 }
2595 01bf 81 ret
2639 ; 205 void SCI_PutByte (unsigned char Tx_DATA)
2639 ; 206 {
2640 switch .text
2642 xref.b _SCI_PutByte$L
2643 01c0 _SCI_PutByte:
2645 01c0 b700 ld _SCI_PutByte$L,a
2647 ; 210 temp = SCISR; /*Loads the byte to be transmitted*/
2649 01c2 b618 ld a,_SCISR
2650 ; 211 SCIDR = Tx_DATA;
2652 01c4 b600 ld a,_SCI_PutByte$L
2653 01c6 b719 ld _SCIDR,a
2654 ; 221 }
2657 01c8 81 ret
2681 ; 229 BOOL SCI_IsTransmitCompleted(void)
2681 ; 230 {
2682 switch .text
2683 01c9 _SCI_IsTransmitCompleted:
2686 ; 232 if(SCISR & SCISR_TC_OR) /*Checks if transmission is completed*/
2688 01c9 0d1803 btjf _SCISR,#6,L3451
2689 ; 234 return (TRUE);
2691 01cc a601 ld a,#1
2694 01ce 81 ret
2695 01cf L3451:
2696 ; 238 return(FALSE);
2698 01cf 4f clr a
2701 01d0 81 ret
2737 ; 275 void SCI_IT_Disable(SCI_IT_Type SCI_IT_Param)
2737 ; 276 {
2738 switch .text
2740 xref.b _SCI_IT_Disable$L
2741 01d1 _SCI_IT_Disable:
2743 01d1 b700 ld _SCI_IT_Disable$L,a
2745 ; 277 SCICR2 &= (unsigned char)(~(SCI_IT_Param & (~SCI_PARITY_ERROR)));
2747 01d3 a4fe and a,#254
2748 01d5 43 cpl a
2749 01d6 b41c and a,_SCICR2
2750 01d8 b71c ld _SCICR2,a
2751 ; 279 SCICR1 &= (unsigned char)(~(SCI_IT_Param & SCI_PARITY_ERROR));
2753 01da b600 ld a,_SCI_IT_Disable$L
2754 01dc a401 and a,#1
2755 01de 43 cpl a
2756 01df b41b and a,_SCICR1
2757 01e1 b71b ld _SCICR1,a
2758 ; 280 }
2761 01e3 81 ret
2816 ; 290 void SCI_PutBuffer (const unsigned char *PtrtoBuffer, unsigned char NbOfBytes)
2816 ; 291 {
2817 switch .text
2819 xref.b _SCI_PutBuffer$L
2820 01e4 _SCI_PutBuffer:
2822 01e4 b701 ld _SCI_PutBuffer$L+1,a
2823 01e6 bf00 ld _SCI_PutBuffer$L,x
2825 01e8 2016 jra L7161
2826 01ea L3161:
2827 ; 296 temp = SCISR;
2829 01ea b618 ld a,_SCISR
2830 01ec b7ff ld _SCI_PutBuffer$L-1,a
2831 ; 297 SCIDR = *PtrtoBuffer; /*Loads the byte to be transmitted*/
2833 01ee 92c600 ld a,[_SCI_PutBuffer$L.w]
2834 01f1 b719 ld _SCIDR,a
2836 01f3 L7261:
2837 ; 298 while (!(SCI_IsTransmitCompleted()));
2839 01f3 add4 call _SCI_IsTransmitCompleted
2841 01f5 4d tnz a
2842 01f6 27fb jreq L7261
2843 ; 300 PtrtoBuffer++; /*Moves the pointer to the next location*/
2845 01f8 3c01 inc _SCI_PutBuffer$L+1
2846 01fa 2602 jrne L46
2847 01fc 3c00 inc _SCI_PutBuffer$L
2848 01fe L46:
2849 ; 294 for (; NbOfBytes > 0 ; NbOfBytes--)
2851 01fe 3a02 dec _SCI_PutBuffer$L+2
2852 0200 L7161:
2855 0200 3d02 tnz _SCI_PutBuffer$L+2
2856 0202 26e6 jrne L3161
2857 ; 313 }
2860 0204 81 ret
2915 ; 322 void SCI_PutString(const unsigned char *PtrtoString)
2915 ; 323 {
2916 switch .text
2918 xref.b _SCI_PutString$L
2919 0205 _SCI_PutString:
2921 0205 b701 ld _SCI_PutString$L+1,a
2922 0207 bf00 ld _SCI_PutString$L,x
2924 ; 324 unsigned char Val = *PtrtoString, temp;
2926 0209 92c600 ld a,[_SCI_PutString$L.w]
2927 020c b7ff ld _SCI_PutString$L-1,a
2929 020e 2019 jra L07
2930 0210 L1661:
2931 ; 329 Val= *PtrtoString;
2933 0210 92c600 ld a,[_SCI_PutString$L.w]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -