📄 main.lst
字号:
495 6 ShakeStopCounter=0x00; // restart stop detect step
496 6 }
497 5
498 5 }
499 4
500 4 // threshold for "Backward", X > -2.5G, similar with "Forward"
501 4 else if((DataX>0x140) &&(DataX<0x8000))
502 4 {
503 5
504 5 if(ShakeDetectStep==0x00)
505 5 {
506 6 LastShakeStatus=ShakeStatus;
507 6 ShakeStatus=0x10;
508 6
ARM COMPILER V2.42, main 11/08/08 15:14:09 PAGE 9
509 6 if(LastShakeStatus==ShakeStatus)
510 6 {
511 7
512 7 if(ShakeDetectCounter>1)
513 7 {
514 8 ShakeDetectStep=0x01;
515 8 ShakeDetectCounter=0x00;
516 8 ShakeStopCounter=0x00;
517 8 PutChar(ShakeStatus);
518 8 }
519 7 else ShakeDetectCounter++;
520 7 }
521 6 else
522 6 {
523 7 if(ShakeDetectCounter==0)
524 7 LastShakeStatus=ShakeStatus;
525 7 else
526 7 {
527 8 ShakeDetectStep=0x01;
528 8 ShakeStopCounter=0x00;
529 8 ShakeStatus=0x00;
530 8 ShakeDetectCounter=0x00;
531 8 }
532 7 }
533 6
534 6 }
535 5
536 5 else
537 5 {
538 6 ShakeStopCounter=0x00;
539 6 }
540 5
541 5 }
542 4
543 4 // -1.5G < X <1.5G, shreshold for stop detect
544 4 else if((DataX<0xC0) || (DataX>0xFF3F))
545 4 {
546 5 if(ShakeDetectStep==0x01) // in stop detect step now
547 5 {
548 6 if(ShakeStopCounter>40) // time counter overflow, means "Stop" status hold for a certain time
549 6 {
550 7 ShakeStatus=0x00; // stop detected, clear status
551 7 ShakeDetectStep=0x00; // start to shake direction detect step for next shake
552 7 ShakeStopCounter=0x00; // clear ShakeStopCounter
553 7 ShakeDetectCounter=0x00; // clear ShakeDetectCounter
554 7 PutChar(ShakeStatus); // send status to PC demo
555 7 }
556 6 else ShakeStopCounter++;
557 6 }
558 5 else ShakeStopCounter=0x00; // not in stop detect step
559 5
560 5
561 5 }
562 4 else ShakeStopCounter=0x00; // exceed shreshold for stop detec
563 4
564 4 }
565 3
566 3 Delay(1,50); // delay a short time for next read for interrupt register
567 3 }
568 2
569 2 }
570 1
571 1 }
ARM COMPILER V2.42, main 11/08/08 15:14:09 PAGE 10
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN CODE16 (I2C_WRITE_REGISTER?T)
EXTERN CODE16 (I2C_READ_REGISTER?T)
EXTERN NUMBER (__startup)
*** PUBLICS:
PUBLIC PutChar?T
PUBLIC DisplayChar?T
PUBLIC IRQ_Handler?A
PUBLIC UART_Initiate?T
PUBLIC I2C1_Initiate?T
PUBLIC ADuC7026_Initiate?T
PUBLIC ADXL345_Initiate?T
PUBLIC Delay?T
PUBLIC main
PUBLIC DataX1
PUBLIC DataX2
PUBLIC DataY1
PUBLIC DataY2
PUBLIC DataZ1
PUBLIC DataZ2
PUBLIC DataX
PUBLIC DataY
PUBLIC DataZ
PUBLIC DevID
PUBLIC Interrupt
PUBLIC RotateStatus
PUBLIC LastRotateStatus
PUBLIC TapStatus
PUBLIC ShakeStatus
PUBLIC LastShakeStatus
PUBLIC ShakeDetectStep
PUBLIC RotateCounter
PUBLIC TapCounter
PUBLIC ShakeDetectCounter
PUBLIC ShakeStopCounter
PUBLIC IsStart
*** DATA SEGMENT '?DT0?main':
00000000 DataX:
00000000 DS 4
00000004 DataY:
00000004 DS 4
00000008 DataZ:
00000008 DS 4
0000000C RotateCounter:
0000000C DS 4
00000010 TapCounter:
00000010 DS 4
00000014 ShakeDetectCounter:
00000014 DS 4
00000018 ShakeStopCounter:
00000018 DS 4
0000001C DataX1:
0000001C DS 1
0000001D DataX2:
0000001D DS 1
0000001E DataY1:
0000001E DS 1
0000001F DataY2:
0000001F DS 1
00000020 DataZ1:
00000020 DS 1
ARM COMPILER V2.42, main 11/08/08 15:14:09 PAGE 11
00000021 DataZ2:
00000021 DS 1
00000022 DevID:
00000022 DS 1
00000023 Interrupt:
00000023 DS 1
00000024 RotateStatus:
00000024 DS 1
00000025 LastRotateStatus:
00000025 DS 1
00000026 TapStatus:
00000026 DS 1
00000027 ShakeStatus:
00000027 DS 1
00000028 LastShakeStatus:
00000028 DS 1
00000029 ShakeDetectStep:
00000029 DS 1
0000002A IsStart:
0000002A DS 1
*** CODE SEGMENT '?PR?PutChar?T?main':
35: void PutChar( char Data)
00000000 1C01 MOV R1,R0 ; Data
00000002 ---- Variable 'Data' assigned to Register 'R1' ----
37: COMTX=Data;
00000002 1C08 MOV R0,R1 ; Data
00000004 0601 LSL R1,R0,#0x18 ; Data
00000006 0E09 LSR R1,R1,#0x18
00000008 4800 LDR R0,=0xFFFF0700
0000000A 6001 STR R1,[R0,#0x0]
38: while(!(0x020==(COMSTA0 & 0x020))) {;}
0000000C L_1:
0000000C 4800 LDR R0,=0xFFFF0714
0000000E 6800 LDR R0,[R0,#0x0]
00000010 2120 MOV R1,#0x20
00000012 4208 TST R0,R1
00000014 D0FA BEQ L_1 ; T=0x0000000C
39: }
00000016 4770 BX R14
00000018 ENDP ; 'PutChar?T'
*** CODE SEGMENT '?PR?DisplayChar?T?main':
42: void DisplayChar( char Data)
00000000 1C02 MOV R2,R0 ; Data
00000002 ---- Variable 'Data' assigned to Register 'R2' ----
43: {
00000002 ; SCOPE-START
46: Temp=Data>>4; //Send high byte
00000002 1C10 MOV R0,R2 ; Data
00000004 0601 LSL R1,R0,#0x18 ; Data
00000006 0E09 LSR R1,R1,#0x18
00000008 0909 LSR R1,R1,#0x4
0000000A 0609 LSL R1,R1,#0x18
0000000C 0E09 LSR R1,R1,#0x18
0000000E ---- Variable 'Temp' assigned to Register 'R1' ----
47: if(Temp<0x0A)
0000000E 1C08 MOV R0,R1 ; Temp
00000010 0600 LSL R0,R0,#0x18 ; Temp
00000012 0E00 LSR R0,R0,#0x18
00000014 280A CMP R0,#0xA
00000016 DA06 BGE L_5 ; T=0x00000026
49: COMTX=0x30+Temp;
00000018 1C08 MOV R0,R1 ; Temp
0000001A 0603 LSL R3,R0,#0x18 ; Temp
0000001C 0E1B LSR R3,R3,#0x18
0000001E 3330 ADD R3,#0x30
ARM COMPILER V2.42, main 11/08/08 15:14:09 PAGE 12
00000020 4800 LDR R0,=0xFFFF0700
00000022 6003 STR R3,[R0,#0x0]
50: }
00000024 E005 B L_10 ; T=0x00000032
00000026 L_5:
53: COMTX='\A'-0x0A+Temp;
00000026 1C08 MOV R0,R1 ; Temp
00000028 0603 LSL R3,R0,#0x18 ; Temp
0000002A 0E1B LSR R3,R3,#0x18
0000002C 3337 ADD R3,#0x37
0000002E 4800 LDR R0,=0xFFFF0700
00000030 6003 STR R3,[R0,#0x0]
55: while(!(0x020==(COMSTA0 & 0x020))) {;}
00000032 L_10:
00000032 L_7:
00000032 4800 LDR R0,=0xFFFF0714
00000034 6800 LDR R0,[R0,#0x0]
00000036 2320 MOV R3,#0x20
00000038 4218 TST R0,R3
0000003A D0FA BEQ L_7 ; T=0x00000032
57: Temp=Data&0x0F; //Send low byte
0000003C 1C10 MOV R0,R2 ; Data
0000003E 0601 LSL R1,R0,#0x18 ; Data
00000040 0E09 LSR R1,R1,#0x18
00000042 200F MOV R0,#0xF
00000044 4001 AND R1,R0
00000046 0609 LSL R1,R1,#0x18
00000048 0E09 LSR R1,R1,#0x18
58: if(Temp<0x0A)
0000004A 1C08 MOV R0,R1 ; Temp
0000004C 0600 LSL R0,R0,#0x18 ; Temp
0000004E 0E00 LSR R0,R0,#0x18
00000050 280A CMP R0,#0xA
00000052 DA06 BGE L_11 ; T=0x00000062
60: COMTX=0x30+Temp;
00000054 1C08 MOV R0,R1 ; Temp
00000056 0602 LSL R2,R0,#0x18 ; Temp
00000058 0E12 LSR R2,R2,#0x18
0000005A 3230 ADD R2,#0x30
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -