void Timer2_viIsr(void) interrupt ET2INT{ // set the data to pin 3 and keep the status of pin 2 & pin 6 P1_DATA = (((TXFifo0[TXiterations] << BitsPerByte)& 0x80) >> 4) | (P1_DATA & 0x44); BitCount++; // increment the counter which represent the shifted bits if((BitsPerByte++) == 7){ // after 1 byte is shifted out, TXiterations++; // increment TXiterations which is an index of an array and BitsPerByte = 0; // reset the bit-counter which is necessary for the shift operation above } if(BitCount > (BufferLevelBits)){ // break condition: if all bits are shifted out do either if(TDKTXContinous == 0){ Set_CS_TDA5150(NOT_ACTIVE); // CS-line to NOT_ACTIVE TXFinish = 1; // and set the Finish-flag } else{ // or prepare the array-index for sending the whole content again TXiterations = 0; // Reset TXIterations for beginnig sending at index 0 at next interrupt (new cycle) } BitCount = 0; //reset the BitCount if all bits are shifted out } T2_T2CON &= ~0x80; //clear T2 Overflow flag } //--------------------------- // Hier noch das Disassembly: //--------------------------- /* C:0x138A 22 RET C:0x138B C0E0 PUSH ACC(0xE0) C:0x138D C0F0 PUSH B(0xF0) C:0x138F C083 PUSH DPH(0x83) C:0x1391 C082 PUSH DPL(0x82) C:0x1393 C0D0 PUSH PSW(0xD0) C:0x1395 75D000 MOV PSW(0xD0),#0x00 C:0x1398 C000 PUSH 0x00 C:0x139A C001 PUSH 0x01 C:0x139C C002 PUSH 0x02 C:0x139E C003 PUSH 0x03 C:0x13A0 C004 PUSH 0x04 C:0x13A2 C005 PUSH 0x05 C:0x13A4 C006 PUSH 0x06 C:0x13A6 C007 PUSH 0x07 130: void Timer2_viIsr(void) interrupt ET2INT{ 131: 132: // set the data to pin 3 and keep the status of pin 2 & pin 6 133: P1_DATA = (((TXFifo0[TXiterations] << BitsPerByte)& 0x80) >> 4) | (P1_DATA & 0x44); C:0x13A8 7427 MOV A,#TXFifo0(0x27) C:0x13AA 257C ADD A,0x7C C:0x13AC F8 MOV R0,A C:0x13AD E6 MOV A,@R0 C:0x13AE FF MOV R7,A C:0x13AF AE24 MOV R6,BitsPerByte(0x24) C:0x13B1 A806 MOV R0,0x06 C:0x13B3 08 INC R0 C:0x13B4 8002 SJMP C:13B8 C:0x13B6 C3 CLR C C:0x13B7 33 RLC A C:0x13B8 D8FC DJNZ R0,C:13B6 C:0x13BA 5480 ANL A,#P0_DATA(0x80) C:0x13BC C4 SWAP A C:0x13BD 540F ANL A,#0x0F C:0x13BF FF MOV R7,A C:0x13C0 E590 MOV A,P1_DATA(0x90) C:0x13C2 5444 ANL A,#0x44 C:0x13C4 4F ORL A,R7 C:0x13C5 F590 MOV P1_DATA(0x90),A 134: BitCount++; // increment the counter which represent the shifted bits 135: C:0x13C7 0523 INC 0x23 C:0x13C9 E523 MOV A,0x23 C:0x13CB 7002 JNZ C:13CF C:0x13CD 0522 INC BitCount(0x22) 136: if((BitsPerByte++) == 7){ // after 1 byte is shifted out, C:0x13CF AF24 MOV R7,BitsPerByte(0x24) C:0x13D1 0524 INC BitsPerByte(0x24) C:0x13D3 EF MOV A,R7 C:0x13D4 B4070B CJNE A,#0x07,C:13E2 137: TXiterations++; // increment TXiterations which is an index of an array and C:0x13D7 057C INC 0x7C C:0x13D9 E57C MOV A,0x7C C:0x13DB 7002 JNZ C:13DF C:0x13DD 057B INC TXiterations(0x7B) 138: BitsPerByte = 0; // reset the bit-counter which is necessary for the shift operation above C:0x13DF 752400 MOV BitsPerByte(0x24),#0x00 139: } 140: if(BitCount > (BufferLevelBits)){ // break condition: if all bits are shifted out do either C:0x13E2 D3 SETB C C:0x13E3 E523 MOV A,0x23 C:0x13E5 957A SUBB A,0x7A C:0x13E7 E522 MOV A,BitCount(0x22) C:0x13E9 9579 SUBB A,BufferLevelBits(0x79) C:0x13EB 4017 JC C:1404 141: if(TDKTXContinous == 0){ C:0x13ED E526 MOV A,TDKTXContinous(0x26) C:0x13EF 7007 JNZ C:13F8 142: Set_CS_TDA5150(NOT_ACTIVE); // CS-line to NOT_ACTIVE C:0x13F1 FF MOV R7,A C:0x13F2 31C9 ACALL Set_CS_TDA5150(C:11C9) 143: TXFinish = 1; // and set the Finish-flag C:0x13F4 D200 SETB TXFinish(0x20.0) 144: } C:0x13F6 8006 SJMP C:13FE 145: else{ // or prepare the array-index for sending the whole content again 146: TXiterations = 0; // Reset TXIterations for beginnig sending at index 0 at next interrupt (new cycle) 147: C:0x13F8 757B00 MOV TXiterations(0x7B),#0x00 C:0x13FB 757C00 MOV 0x7C,#0x00 148: } 149: BitCount = 0; //reset the BitCount if all bits are shifted out C:0x13FE 752200 MOV BitCount(0x22),#0x00 C:0x1401 752300 MOV 0x23,#0x00 150: } 151: T2_T2CON &= ~0x80; //clear T2 Overflow flag C:0x1404 53C07F ANL T2_T2CON(0xC0),#0x7F 152: } C:0x1407 D007 POP 0x07 C:0x1409 D006 POP 0x06 C:0x140B D005 POP 0x05 C:0x140D D004 POP 0x04 C:0x140F D003 POP 0x03 C:0x1411 D002 POP 0x02 C:0x1413 D001 POP 0x01 C:0x1415 D000 POP 0x00 C:0x1417 D0D0 POP PSW(0xD0) C:0x1419 D082 POP DPL(0x82) C:0x141B D083 POP DPH(0x83) C:0x141D D0F0 POP B(0xF0) C:0x141F D0E0 POP ACC(0xE0) C:0x1421 32 RETI */