📄 scar.lst
字号:
0578: DECFSZ 77,F
0579: GOTO 578
057A: NOP
.................... value = read_adc();
057B: BSF 1F.2
057C: BTFSC 1F.2
057D: GOTO 57C
057E: MOVF 1E,W
057F: MOVWF 7A
0580: BSF 03.5
0581: MOVF 1E,W
0582: MOVWF 58
0583: MOVF 7A,W
0584: MOVWF 59
.................... setup_adc( ADC_OFF );
0585: BCF 03.5
0586: MOVF 1F,W
0587: ANDLW 38
0588: MOVWF 1F
.................... return value;
0589: BSF 03.5
058A: MOVF 58,W
058B: MOVWF 78
058C: MOVF 59,W
058D: MOVWF 79
.................... }
058E: BCF 03.5
058F: RETLW 00
....................
.................... void ReverseCar()
.................... {
.................... int16 j;
.................... for(i=0;i<135;i++) //135000 = 90 degree
*
04A6: CLRF 21
04A7: CLRF 20
04A8: MOVF 21,F
04A9: BTFSS 03.2
04AA: GOTO 4C9
04AB: MOVF 20,W
04AC: SUBLW 86
04AD: BTFSS 03.0
04AE: GOTO 4C9
.................... {for(j=0;j<1000;j++)
04AF: BSF 03.5
04B0: CLRF 4F
04B1: CLRF 4E
04B2: MOVF 4F,W
04B3: SUBLW 03
04B4: BTFSS 03.0
04B5: GOTO 4C4
04B6: BTFSS 03.2
04B7: GOTO 4BC
04B8: MOVF 4E,W
04B9: SUBLW E7
04BA: BTFSS 03.0
04BB: GOTO 4C4
.................... {
.................... motorA_Backward();
04BC: BCF 03.5
04BD: CALL 497
.................... motorB_Forward();
04BE: CALL 42E
.................... }
04BF: BSF 03.5
04C0: INCF 4E,F
04C1: BTFSC 03.2
04C2: INCF 4F,F
04C3: GOTO 4B2
.................... }
04C4: BCF 03.5
04C5: INCF 20,F
04C6: BTFSC 03.2
04C7: INCF 21,F
04C8: GOTO 4A8
.................... }
04C9: RETLW 00
....................
.................... /*
.................... void BackBySensor()
.................... {
.................... int16 value0,value1,value2,value3;
.................... int16 IrSensorValue=0x00; //0 or 1
....................
.................... while(true)
.................... {
.................... IrSensorValue=0x00;
.................... value0 = read_IrSensor(0);
.................... value1 = read_IrSensor(1);
.................... value2 = read_IrSensor(2);
.................... value3 = read_IrSensor(3);
.................... IrSensorValue = ((value0<200 ??0x08:0) | IrSensorValue); //sensor0 1 2 3
.................... IrSensorValue = ((value1<200 ??0x04:0) | IrSensorValue); // 白 黑 黑 白
.................... IrSensorValue = ((value2<200 ??0x02:0) | IrSensorValue); // 0 1 1 0
.................... IrSensorValue = ((value3<200 ??0x01:0) | IrSensorValue); //
....................
....................
.................... if( IrSensorValue == 0x06 ) //0000 0110
.................... {
.................... GoBack();
.................... }
.................... if( IrSensorValue == 0x02 ) //0000 0010
.................... {
.................... brakeA();
.................... motorB_Backward();
.................... }
.................... if (IrSensorValue == 0x04 ) //0000 0100
.................... {
.................... motorA_Backward();
.................... brakeB();
.................... }
.................... if( IrSensorValue == 0x0f) //0000 1111
.................... {
.................... return;
.................... }
.................... }
.................... }
.................... */
....................
.................... #include <string.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STRING
.................... #define _STRING
.................... #include <stddef.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STDDEF
....................
.................... #define _STDDEF
....................
.................... #if sizeof(int *)==1
.................... #define ptrdiff_t int
.................... #else
.................... #define ptrdiff_t long
.................... #endif
....................
.................... #define size_t int
.................... #define wchar_t char
.................... #define NULL 0
....................
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)
....................
.................... #endif
....................
.................... #include <ctype.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _CTYPE
.................... #define _CTYPE
....................
.................... #define islower(x) isamoung(x,"abcdefghijklmnopqrstuvwxyz")
.................... #define isupper(x) isamoung(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
.................... #define isalnum(x) isamoung(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isalpha(x) isamoung(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isdigit(x) isamoung(x,"0123456789")
.................... #define isspace(x) (x==' ')
.................... #define isxdigit(x) isamoung(x,"0123456789ABCDEFabcdef")
.................... #define iscntrl(x) (x<' ')
.................... #define isprint(x) (x>=' ')
.................... #define isgraph(x) (x>' ')
.................... #define ispunct(x) ((x>' ')&&!isalnum(x))
....................
.................... #endif
....................
....................
....................
....................
....................
.................... //////////////////////////////////////////////
.................... //// Uncomment the following define to ////
.................... //// allow some functions to use a ////
.................... //// quicker algorithm, but use more ROM ////
.................... //// ////
.................... //// #define FASTER_BUT_MORE_ROM ////
.................... //////////////////////////////////////////////
....................
....................
....................
.................... /*Copying functions*/
.................... /* standard template:
.................... void *memmove(void *s1, void *s2, size_t n).
.................... Copies max of n characters safely (not following ending '\0')
.................... from s2 in s1; if s2 has less than n characters, appends 0 */
....................
.................... char *memmove(void *s1,char *s2,size_t n)
.................... {
.................... char *sc1;
.................... char *sc2;
.................... sc1=s1;
.................... sc2=s2;
.................... if(sc2<sc1 && sc1 <sc2 +n)
.................... for(sc1+=n,sc2+=n;0<n;--n)
.................... *--sc1=*--sc2;
.................... else
.................... for(;0<n;--n)
.................... *sc1++=*sc2++;
.................... return s1;
.................... }
.................... /* Standard template: char *strcpy(char *s1, const char *s2)
.................... copies the string s2 including the null character to s1*/
....................
.................... char *strcpy(char *s1, char *s2)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s2 != 0; s++, s2++)
.................... *s = *s2;
.................... return(s1);
.................... }
.................... /* compiler ignored the name 'strcpy()'; perhaps, it's reserved??
.................... Standard template: char *strcpy(char *s1, const char *s2)
.................... copies the string s2 including the null character to s1*/
....................
.................... char *strcopy(char *s1, char *s2)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s2 != 0; s++, s2++)
.................... *s = *s2;
.................... return(s1);
.................... }
....................
.................... /* standard template:
.................... char *strncpy(char *s1, const char *s2, size_t n).
.................... Copies max of n characters (not following ending '\0')
.................... from s2 in s1; if s2 has less than n characters, appends 0 */
....................
.................... char *strncpy(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
....................
.................... for (s = s1; n > 0 && *s2 != '\0'; n--)
.................... *s++ = *s2++;
.................... for (; n > 0; n--)
.................... *s++ = '\0';
....................
.................... return(s1);
.................... }
.................... /***********************************************************/
....................
.................... /*concatenation functions*/
.................... /* standard template: char *strcat(char *s1, const char *s2)
.................... appends s2 to s1*/
....................
.................... char *strcat(char *s1, char *s2)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s != '\0'; ++s);
.................... while(*s2 != '\0')
.................... {
.................... *s = *s2;
.................... ++s;
.................... ++s2;
.................... }
....................
.................... *s = '\0';
.................... return(s1);
.................... }
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n)
.................... appends not more than n characters from s2 to s1*/
....................
.................... char *strncat(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s != '\0'; ++s);
.................... while(*s2 != '\0' && 0<n)
.................... {
.................... *s = *s2;
.................... ++s;
.................... ++s2;
.................... --n;
.................... }
....................
.................... *s = '\0';
.................... return(s1);
.................... }
....................
.................... /***********************************************************/
....................
.................... /*comparison functions*/
.................... /* standard template: signed int memcmp(void *s1, void *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int memcmp(void * s1,char *s2,size_t n)
.................... {
.................... char *su1, su2;
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n)
.................... {
.................... if(*su1!=*su2)
.................... return ((*su1<*su2)??1:+1);
.................... }
.................... return 0;
.................... }
.................... /* standard template: int strcmp(const char *s1, const char *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int strcmp(char *s1, char *s2)
.................... {
.................... for (; *s1 == *s2; s1++, s2++)
*
08E4: MOVF 4E,W
08E5: MOVWF 04
08E6: MOVF 00,W
08E7: MOVWF 50
08E8: MOVF 4F,W
08E9: MOVWF 04
08EA: MOVF 00,W
08EB: SUBWF 50,W
08EC: BTFSS 03.2
08ED: GOTO 0FA
.................... if (*s1 == '\0')
.................... return(0);
08EE: MOVF 4E,W
08EF: MOVWF 04
08F0: MOVF 00,F
08F1: BTFSS 03.2
08F2: GOTO 0F6
08F3: MOVLW 00
08F4: MOVWF 78
08F5: GOTO 108
08F6: MOVF 4E,W
08F7: INCF 4E,F
08F8: INCF 4F,F
08F9: GOTO 0E4
.................... return((*s1 < *s2) ??-1: 1);
08FA: MOVF 4E,W
08FB: MOVWF 04
08FC: MOVF 00,W
08FD: MOVWF 50
08FE: MOVF 4F,W
08FF: MOVWF 04
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -