KeyScan.lst
上传用户:xhjmsc
上传日期:2019-09-13
资源大小:389k
文件大小:23k
- ##############################################################################
- # #
- # IAR MSP430 C/EC++ Compiler V2.10A/W32 23/Apr/2007 18:04:11 #
- # Copyright 1996-2003 IAR Systems. All rights reserved. #
- # #
- # __rt_version = 1 #
- # __double_size = 32 #
- # __reg_r4 = free #
- # __reg_r5 = free #
- # __pic = no #
- # Source file = E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # filesKeyScan.c #
- # Command line = -I "C:Program FilesIAR SystemsEmbedded Workbench #
- # 3.2430INC" -I "C:Program FilesIAR #
- # SystemsEmbedded Workbench 3.2430INCCLIB" -lCN #
- # E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # DebugList -lA E:projectFaxProgramVson_Bryan_Fax_ #
- # Conexant_070423DebugList -o #
- # E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # DebugObj -z2 --no_cse --no_unroll --no_inline #
- # --no_code_motion --debug -e #
- # E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # filesKeyScan.c #
- # List file = E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # DebugListKeyScan.lst #
- # Object file = E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # DebugObjKeyScan.r43 #
- # #
- # #
- ##############################################################################
- E:projectFaxProgramVson_Bryan_Fax_Conexant_070423filesKeyScan.c
- 1 /***************************************
- 2 Program: Key Scan
- 3 Author: Bryan Cai
- 4 Date: 2007.04.11
- 5 ***************************************/
- 6
- 7 #include "includeH.h"
- In segment DATA16_AN, at 0x20
- unsigned char const volatile __data P1IN
- P1IN:
- 000000 DS8 1
- 8
- In segment CODE, align 2, keep-with-next
- 9 void KeyScan(void)
- KeyScan:
- 10 {
- 000000 0A12 PUSH.W R10
- 11 unsigned char ucKeyValue=0xff;
- 000002 7A43 MOV.B #0xff, R10
- 12 //unsigned char ucBlockCnt=0;
- 13 //unsigned char ucRxIndex=0;
- 14 //unsigned int wPageAddress=0;
- 15 //Ring Number+-
- 16 if (((KEY_PORT_IN & bitKeyRingNumDec) != bitKeyRingNumDec) ||
- 17 ((KEY_PORT_IN & bitKeyRingNumAdd) != bitKeyRingNumAdd) ||
- 18 ((KEY_PORT_IN & bitKeyAutoMode) != bitKeyAutoMode) ||
- 19 ((KEY_PORT_IN & bitKeyManualMode) != bitKeyManualMode) )//||
- 000004 D2B32000 BIT.B #0x1, &0x20
- 000008 0928 JNC ??KeyScan_1
- 00000A E2B32000 BIT.B #0x2, &0x20
- 00000E 0628 JNC ??KeyScan_1
- 000010 E2B22000 BIT.B #0x4, &0x20
- 000014 0328 JNC ??KeyScan_1
- 000016 F2B22000 BIT.B #0x8, &0x20
- 00001A 8F2C JC ??KeyScan_2
- 20 //((KEY_PORT_IN & bitKeySendFaxSignal) != bitKeySendFaxSignal))
- 21 {
- 22 //VIEWLEDPORT |= bitViewLED;
- 23 if ((KEY_PORT_IN & bitKeyRingNumDec) != bitKeyRingNumDec) ucKeyValue=0;
- ??KeyScan_1:
- 00001C D2B32000 BIT.B #0x1, &0x20
- 000020 012C JC ??KeyScan_3
- 000022 4A43 MOV.B #0x0, R10
- 24 if ((KEY_PORT_IN & bitKeyRingNumAdd) != bitKeyRingNumAdd) ucKeyValue=1;
- ??KeyScan_3:
- 000024 E2B32000 BIT.B #0x2, &0x20
- 000028 012C JC ??KeyScan_4
- 00002A 5A43 MOV.B #0x1, R10
- 25 if ((KEY_PORT_IN & bitKeyAutoMode) != bitKeyAutoMode) ucKeyValue=2;
- ??KeyScan_4:
- 00002C E2B22000 BIT.B #0x4, &0x20
- 000030 012C JC ??KeyScan_5
- 000032 6A43 MOV.B #0x2, R10
- 26 if ((KEY_PORT_IN & bitKeyManualMode) != bitKeyManualMode) ucKeyValue=3;
- ??KeyScan_5:
- 000034 F2B22000 BIT.B #0x8, &0x20
- 000038 022C JC ??KeyScan_6
- 00003A 7A400300 MOV.B #0x3, R10
- 27 //if ((KEY_PORT_IN & bitKeySendFaxSignal) != bitKeySendFaxSignal) ucKeyValue=4;
- 28
- 29 switch (ucKeyValue)
- ??KeyScan_6:
- 00003E 4A83 SUB.B #0x0, R10
- 000040 0724 JEQ ??KeyScan_7
- 000042 5A83 SUB.B #0x1, R10
- 000044 1224 JEQ ??KeyScan_8
- 000046 5A83 SUB.B #0x1, R10
- 000048 1E24 JEQ ??KeyScan_9
- 00004A 5A83 SUB.B #0x1, R10
- 00004C 2D24 JEQ ??KeyScan_10
- 00004E 3C3C JMP ??KeyScan_11
- 30 {
- 31 //if ((KEY_PORT_IN & bitKeyRingNumDec) != bitKeyRingNumDec)
- 32 case 0:
- 33 {
- 34 delay1us(0x0530);//300000);
- ??KeyScan_7:
- 000050 3C403005 MOV.W #0x530, R12
- 000054 B012.... CALL #delay1us
- 35 if ((KEY_PORT_IN & bitKeyRingNumDec) != bitKeyRingNumDec)
- 000058 D2B32000 BIT.B #0x1, &0x20
- 00005C 352C JC ??KeyScan_11
- 36 {
- 37 if (gucViewRingNum>0)--gucViewRingNum;//RingNumMax--
- 00005E D293.... CMP.B #0x1, &aucViewData + 0x6
- 000062 3228 JNC ??KeyScan_11
- 000064 F253.... ADD.B #0xff, &aucViewData + 0x6
- 000068 2F3C JMP ??KeyScan_11
- 38 //ViewCommunicationTX(0x01);
- 39 //ViewCommunicationRX();
- 40 }
- 41 break;
- 42 }//case 0
- 43
- 44
- 45 //if ((KEY_PORT_IN & bitKeyRingNumAdd) != bitKeyRingNumAdd)
- 46 case 1:
- 47 {
- 48 delay1us(0x0530);
- ??KeyScan_8:
- 00006A 3C403005 MOV.W #0x530, R12
- 00006E B012.... CALL #delay1us
- 49 if ((KEY_PORT_IN & bitKeyRingNumAdd) != bitKeyRingNumAdd)
- 000072 E2B32000 BIT.B #0x2, &0x20
- 000076 282C JC ??KeyScan_11
- 50 {
- 51 if (gucViewRingNum<9)++gucViewRingNum;//RingNumMax++
- 000078 F2900900.... CMP.B #0x9, &aucViewData + 0x6
- 00007E 242C JC ??KeyScan_11
- 000080 D253.... ADD.B #0x1, &aucViewData + 0x6
- 000084 213C JMP ??KeyScan_11
- 52 //ViewCommunicationTX(0x01);
- 53 //ViewCommunicationRX();
- 54 }
- 55 break;
- 56 }//case 1
- 57
- 58 //ModeSel Key scan: auto or manual send fax signal
- 59 //if ((KEY_PORT_IN & bitKeyAutoMode) != bitKeyAutoMode)//bitKeyAutoMode==0
- 60 case 2:
- 61 {
- 62 delay1us(0x0530);
- ??KeyScan_9:
- 000086 3C403005 MOV.W #0x530, R12
- 00008A B012.... CALL #delay1us
- 63 if ((KEY_PORT_IN & bitKeyAutoMode) != bitKeyAutoMode)
- 00008E E2B22000 BIT.B #0x4, &0x20
- 000092 1A2C JC ??KeyScan_11
- 64 {
- 65 gucViewStaticStatus |= bitViewAutoMode;//Auto Mode
- 000094 F2D01000.... BIS.B #0x10, &aucViewData + 0x7
- 66 gucViewStaticStatus &= ~bitViewManualMode;//
- 00009A F2C02000.... BIC.B #0x20, &aucViewData + 0x7
- 67 gucViewStaticStatus |= bitViewRingNum;
- 0000A0 F2D04000.... BIS.B #0x40, &aucViewData + 0x7
- 0000A6 103C JMP ??KeyScan_11
- 68
- 69 //ViewCommunicationTX(0x01);
- 70 //ViewCommunicationRX();
- 71 }
- 72 break;
- 73 }//case 2
- 74 //if ((KEY_PORT_IN & bitKeyManualMode) != bitKeyManualMode)
- 75 case 3:
- 76 {
- 77
- 78 delay1us(0x0530);
- ??KeyScan_10:
- 0000A8 3C403005 MOV.W #0x530, R12
- 0000AC B012.... CALL #delay1us
- 79 if ((KEY_PORT_IN & bitKeyManualMode) != bitKeyManualMode)
- 0000B0 F2B22000 BIT.B #0x8, &0x20
- 0000B4 092C JC ??KeyScan_11
- 80 {
- 81 gucViewStaticStatus |= bitViewManualMode;//Manual Mode
- 0000B6 F2D02000.... BIS.B #0x20, &aucViewData + 0x7
- 82 gucViewStaticStatus &= ~bitViewAutoMode; //off atuo
- 0000BC F2C01000.... BIC.B #0x10, &aucViewData + 0x7
- 83 gucViewStaticStatus &= ~bitViewRingNum;//off ring num
- 0000C2 F2C04000.... BIC.B #0x40, &aucViewData + 0x7
- 84
- 85 //ViewCommunicationTX(0x01);
- 86 //ViewCommunicationRX();
- 87 }
- 88 break;
- 89 }//case 3
- 90
- 91 }//switch
- 92 //Driver LCD screen
- 93 if (((KEY_PORT_IN & bitKeyRingNumDec) != bitKeyRingNumDec) ||
- 94 ((KEY_PORT_IN & bitKeyRingNumAdd) != bitKeyRingNumAdd) ||
- 95 ((KEY_PORT_IN & bitKeyAutoMode) != bitKeyAutoMode) ||
- 96 ((KEY_PORT_IN & bitKeyManualMode) != bitKeyManualMode) )
- ??KeyScan_11:
- 0000C8 D2B32000 BIT.B #0x1, &0x20
- 0000CC 0928 JNC ??KeyScan_12
- 0000CE E2B32000 BIT.B #0x2, &0x20
- 0000D2 0628 JNC ??KeyScan_12
- 0000D4 E2B22000 BIT.B #0x4, &0x20
- 0000D8 0328 JNC ??KeyScan_12
- 0000DA F2B22000 BIT.B #0x8, &0x20
- 0000DE 052C JC ??KeyScan_13
- 97 //|| ((KEY_PORT_IN & bitKeySendFaxSignal) != bitKeySendFaxSignal))
- 98 {
- 99 ViewCommunicationTX(0x01);
- ??KeyScan_12:
- 0000E0 5C43 MOV.B #0x1, R12
- 0000E2 B012.... CALL #ViewCommunicationTX
- 100
- 101 ReadAndWriteViewDataMemory();
- 0000E6 B012.... CALL #ReadAndWriteViewDataMemory
- 102 }
- 103
- 104 if (((KEY_PORT_IN & bitKeyRingNumDec) != bitKeyRingNumDec) ||
- 105 ((KEY_PORT_IN & bitKeyRingNumAdd) != bitKeyRingNumAdd) ||
- 106 ((KEY_PORT_IN & bitKeyAutoMode) != bitKeyAutoMode) ||
- 107 ((KEY_PORT_IN & bitKeyManualMode) != bitKeyManualMode))
- ??KeyScan_13:
- 0000EA D2B32000 BIT.B #0x1, &0x20
- 0000EE 0928 JNC ??KeyScan_0
- 0000F0 E2B32000 BIT.B #0x2, &0x20
- 0000F4 0628 JNC ??KeyScan_0
- 0000F6 E2B22000 BIT.B #0x4, &0x20
- 0000FA 0328 JNC ??KeyScan_0
- 0000FC F2B22000 BIT.B #0x8, &0x20
- 000100 1C2C JC ??KeyScan_2
- 108 //|| ((KEY_PORT_IN & bitKeySendFaxSignal) != bitKeySendFaxSignal))
- 109 {
- 110 while (1)
- 111 {
- 112 if (((KEY_PORT_IN & bitKeyRingNumDec) == bitKeyRingNumDec) &&
- 113 ((KEY_PORT_IN & bitKeyRingNumAdd) == bitKeyRingNumAdd) &&
- 114 ((KEY_PORT_IN & bitKeyAutoMode) == bitKeyAutoMode) &&
- 115 ((KEY_PORT_IN & bitKeyManualMode) == bitKeyManualMode)) //&&
- ??KeyScan_0:
- 000102 D2B32000 BIT.B #0x1, &0x20
- 000106 FD2B JNC ??KeyScan_0
- 000108 E2B32000 BIT.B #0x2, &0x20
- 00010C FA2B JNC ??KeyScan_0
- 00010E E2B22000 BIT.B #0x4, &0x20
- 000112 F72B JNC ??KeyScan_0
- 000114 F2B22000 BIT.B #0x8, &0x20
- 000118 F42B JNC ??KeyScan_0
- 116 //((KEY_PORT_IN & bitKeySendFaxSignal) == bitKeySendFaxSignal))
- 117 {
- 118 delay1us(0x7530);
- 00011A 3C403075 MOV.W #0x7530, R12
- 00011E B012.... CALL #delay1us
- 119 if (((KEY_PORT_IN & bitKeyRingNumDec) == bitKeyRingNumDec) &&
- 120 ((KEY_PORT_IN & bitKeyRingNumAdd) == bitKeyRingNumAdd) &&
- 121 ((KEY_PORT_IN & bitKeyAutoMode) == bitKeyAutoMode) &&
- 122 ((KEY_PORT_IN & bitKeyManualMode) == bitKeyManualMode))// &&
- 000122 D2B32000 BIT.B #0x1, &0x20
- 000126 ED2B JNC ??KeyScan_0
- 000128 E2B32000 BIT.B #0x2, &0x20
- 00012C EA2B JNC ??KeyScan_0
- 00012E E2B22000 BIT.B #0x4, &0x20
- 000132 E72B JNC ??KeyScan_0
- 000134 F2B22000 BIT.B #0x8, &0x20
- 000138 E42B JNC ??KeyScan_0
- 123 //((KEY_PORT_IN & bitKeySendFaxSignal) == bitKeySendFaxSignal))
- 124 break;
- 125 }
- 126 }
- 127 //VIEWLEDPORT &= ~bitViewLED;
- 128 }
- 129
- 130 }
- 131 }
- ??KeyScan_2:
- 00013A 3A41 POP.W R10
- 00013C 3041 RET
- 132
- In segment CODE, align 2, keep-with-next
- 133 void ReadAndWriteViewDataMemory(void)
- ReadAndWriteViewDataMemory:
- 134 {
- 000000 0A12 PUSH.W R10
- 000002 0B12 PUSH.W R11
- 000004 0812 PUSH.W R8
- 135 unsigned char ucBlockCnt=0;
- 000006 4843 MOV.B #0x0, R8
- 136 unsigned char ucRxIndex=0;
- 000008 4A43 MOV.B #0x0, R10
- 137 unsigned int wPageAddress=0;
- 00000A 0B43 MOV.W #0x0, R11
- 138 //ReadLast16BytesFromFlashMemoryArea(cstViewDataAreaStartBlockNum,cstViewDataAreaOverBlockNum);
- 139 ReadLastViewData();
- 00000C 7E402900 MOV.B #0x29, R14
- 000010 7C402800 MOV.B #0x28, R12
- 000014 B012.... CALL #ReadLast16BytesFromFlashMemoryArea
- 140 if ((gwGeneralPageAddress>>6) > cstViewDataAreaOverBlockNum)
- 000018 1C42.... MOV.W &gwGeneralPageAddress, R12
- 00001C B012.... CALL #?ShiftRight16u_6
- 000020 3C902A00 CMP.W #0x2a, R12
- 000024 1C28 JNC ??ReadAndWriteViewDataMemory_2
- 141 {
- 142 for (ucBlockCnt=0;ucBlockCnt<2;ucBlockCnt++)
- 000026 4843 MOV.B #0x0, R8
- ??ReadAndWriteViewDataMemory_0:
- 000028 6893 CMP.B #0x2, R8
- 00002A 142C JC ??ReadAndWriteViewDataMemory_3
- 143 {
- 144 wPageAddress=(cstViewDataAreaStartBlockNum+ucBlockCnt)<<6;
- 00002C 4C48 MOV.B R8, R12
- 00002E 3CF0FF00 AND.W #0xff, R12
- 000032 3C502800 ADD.W #0x28, R12
- 000036 B012.... CALL #?ShiftLeft16_6
- 00003A 0B4C MOV.W R12, R11
- 145 ROW_ADDRESS_LOW=wPageAddress & 0XFF;
- 00003C C24B.... MOV.B R11, &ROW_ADDRESS_LOW
- 146 ROW_ADDRESS_HIGH=(wPageAddress>>8) & 0XFF;
- 000040 0E4B MOV.W R11, R14
- 000042 8E10 SWPB R14
- 000044 3EF0FF00 AND.W #0xff, R14
- 000048 C24E.... MOV.B R14, &ROW_ADDRESS_HIGH
- 147 ERASE_ONE_BLOCK();
- 00004C B012.... CALL #ERASE_ONE_BLOCK
- 148 }
- 000050 5853 ADD.B #0x1, R8
- 000052 EA3F JMP ??ReadAndWriteViewDataMemory_0
- 149 gwGeneralPageAddress=cstViewDataAreaStartPage;
- ??ReadAndWriteViewDataMemory_3:
- 000054 B240000A.... MOV.W #0xa00, &gwGeneralPageAddress
- 150 gwColumnAddress=0;
- 00005A 8243.... MOV.W #0x0, &gwColumnAddress
- 151 }
- 152 ucRxIndex=0; //write view data
- ??ReadAndWriteViewDataMemory_2:
- 00005E 4A43 MOV.B #0x0, R10
- 153 aucUartRxBuf[ucRxIndex++]=gucViewRingNum;
- 000060 4E4A MOV.B R10, R14
- 000062 3EF0FF00 AND.W #0xff, R14
- 000066 DE42........ MOV.B &aucViewData + 0x6, aucUartRxBuf(R14)
- 00006C 5A53 ADD.B #0x1, R10
- 154 aucUartRxBuf[ucRxIndex++]=gucViewStaticStatus;
- 00006E 4E4A MOV.B R10, R14
- 000070 3EF0FF00 AND.W #0xff, R14
- 000074 DE42........ MOV.B &aucViewData + 0x7, aucUartRxBuf(R14)
- 00007A 5A53 ADD.B #0x1, R10
- 155 aucUartRxBuf[ucRxIndex++]=gucViewDynamicStatus;
- 00007C 4E4A MOV.B R10, R14
- 00007E 3EF0FF00 AND.W #0xff, R14
- 000082 DE42........ MOV.B &aucViewData + 0x8, aucUartRxBuf(R14)
- 000088 5A53 ADD.B #0x1, R10
- 156 aucUartRxBuf[ucRxIndex++]=gucViewDceNewFaxNum;//gucIcon2;
- 00008A 4E4A MOV.B R10, R14
- 00008C 3EF0FF00 AND.W #0xff, R14
- 000090 DE42........ MOV.B &aucViewData + 0x9, aucUartRxBuf(R14)
- 000096 5A53 ADD.B #0x1, R10
- 157 for (ucBlockCnt=0; ucBlockCnt<12; ucBlockCnt++)
- 000098 4843 MOV.B #0x0, R8
- ??ReadAndWriteViewDataMemory_1:
- 00009A 78900C00 CMP.B #0xc, R8
- 00009E 092C JC ??ReadAndWriteViewDataMemory_4
- 158 {
- 159 aucUartRxBuf[ucRxIndex++]=0x55;
- 0000A0 4E4A MOV.B R10, R14
- 0000A2 3EF0FF00 AND.W #0xff, R14
- 0000A6 FE405500.... MOV.B #0x55, aucUartRxBuf(R14)
- 0000AC 5A53 ADD.B #0x1, R10
- 160 }
- 0000AE 5853 ADD.B #0x1, R8
- 0000B0 F43F JMP ??ReadAndWriteViewDataMemory_1
- 161 Write16Bytes2FlashMemoryArea();
- ??ReadAndWriteViewDataMemory_4:
- 0000B2 B012.... CALL #Write16Bytes2FlashMemoryArea
- 162 }
- 0000B6 3841 POP.W R8
- 0000B8 3B41 POP.W R11
- 0000BA 3A41 POP.W R10
- 0000BC 3041 RET
- Maximum stack usage in bytes:
- Function CSTACK
- -------- ------
- KeyScan 4
- -> delay1us 4
- -> delay1us 4
- -> delay1us 4
- -> delay1us 4
- -> ViewCommunicationTX 4
- -> ReadAndWriteViewDataMemory
- 4
- -> delay1us 4
- ReadAndWriteViewDataMemory 8
- -> ReadLast16BytesFromFlashMemoryArea
- 8
- -> ERASE_ONE_BLOCK 8
- -> Write16Bytes2FlashMemoryArea
- 8
- Segment part sizes:
- Function/Label Bytes
- -------------- -----
- P1IN 1
- KeyScan 318
- ReadAndWriteViewDataMemory 190
-
- 508 bytes in segment CODE
- 1 byte in segment DATA16_AN
-
- 508 bytes of CODE memory
- 0 bytes of DATA memory (+ 1 byte shared)
- Errors: none
- Warnings: none