when i say worded things differently like in some BIN files i found that the analog inputs are accessed with
Code:
mov DPTR, #BE06
Code:
mov ADCON1, #6
For making a high speed logging output that should not be too difficult. the max baud rate of the siemens based 8051 processor is 187500baud. All you have to do is find the original factory data output in the code and where it starts. than from that point jump out to some custom code that will essentially grab whatever variables from RAM and push them out through the processors serial port over the K-line. In the case of M2.3.2 high speed logging it was told to send 0xAA and 0xBB before the RAM variables, sending these 2 bits is a good way to tell software like tuner pro RT that the ECU is sending data and to watch for these 2 bits to start the live reading.
Here is an example of test logging code i made for M2.3.2 motor chip for audi 200 20v turbo. fyi the audi motronic has 2 ECU's in one, one to control the timing/fueling and the other is boost control/knock control. the code from the boost processor/chip would be useless in the BMW application.
Code:
code:00005B30 code:00005B30 ; =============== S U B R O U T I N E ======================================= code:00005B30 code:00005B30 code:00005B30 code_5B30: ; CODE XREF: code_3C4E↑p code:00005B30 20 24 15 jb RAM_24.4, code_5B48 ; Jump if Bit is set code:00005B33 E5 3A mov A, RAM_3A ; Move (Op1 <- Op2) code:00005B35 70 0B jnz code_5B42 ; Jump if Acc is not zero code:00005B37 90 BE 00 mov DPTR, #0xBE00 ; Move (Op1 <- Op2) code:00005B3A 12 13 5D lcall code_135D ; Long Subroutine Call code:00005B3D F4 cpl A ; Complement Operand code:00005B3E 60 02 jz code_5B42 ; Jump if Acc is zero code:00005B40 D2 24 setb RAM_24.4 ; Set Direct Bit code:00005B42 code:00005B42 code_5B42: ; CODE XREF: code_5B30+5↑j code:00005B42 ; code_5B30+E↑j ... code:00005B42 12 34 08 lcall code_3408 ; Long Subroutine Call code:00005B45 02 3C 51 ljmp code_3C51 ; Long Jump code:00005B48 ; --------------------------------------------------------------------------- code:00005B48 code:00005B48 code_5B48: ; CODE XREF: code_5B30↑j code:00005B48 E5 3A mov A, RAM_3A ; Move (Op1 <- Op2) code:00005B4A B4 0A 00 cjne A, #0xA, code_5B4D ; Compare Operands and JNE code:00005B4D code:00005B4D code_5B4D: ; CODE XREF: code_5B30+1A↑j code:00005B4D 40 F3 jc code_5B42 ; Jump if Carry is set code:00005B4F 75 87 80 mov PCON, #0x80 ; Power Control Register code:00005B52 75 98 E8 mov SCON, #0xE8 ; Serial Channel Control Reg. code:00005B55 75 A0 00 mov P2, #0 ; Port 2 code:00005B58 30 AC 01 jnb IEN0.4, code_5B5C ; Interrupt Enable Register 0 code:00005B5B 22 ret ; Return from subroutine code:00005B5C ; --------------------------------------------------------------------------- code:00005B5C code:00005B5C code_5B5C: ; CODE XREF: code_5B30+28↑j code:00005B5C 78 AF mov R0, #0xAF ; Move (Op1 <- Op2) code:00005B5E 08 inc R0 ; Increment Operand code:00005B5F 74 FD mov A, #0xFD ; Move (Op1 <- Op2) code:00005B61 F2 movx @R0, A ; Move from/to external RAM code:00005B62 08 inc R0 ; Increment Operand code:00005B63 E5 3A mov A, RAM_3A ; Move (Op1 <- Op2) code:00005B65 F2 movx @R0, A ; Move from/to external RAM code:00005B66 08 inc R0 ; Increment Operand code:00005B67 E5 3F mov A, RAM_3F ; Move (Op1 <- Op2) code:00005B69 F2 movx @R0, A ; Move from/to external RAM code:00005B6A 08 inc R0 ; Increment Operand code:00005B6B E5 36 mov A, RAM_36 ; Move (Op1 <- Op2) code:00005B6D F2 movx @R0, A ; Move from/to external RAM code:00005B6E 08 inc R0 ; Increment Operand code:00005B6F E5 37 mov A, RAM_37 ; Move (Op1 <- Op2) code:00005B71 F2 movx @R0, A ; Move from/to external RAM code:00005B72 08 inc R0 ; Increment Operand code:00005B73 E5 38 mov A, RAM_38 ; Move (Op1 <- Op2) code:00005B75 F2 movx @R0, A ; Move from/to external RAM code:00005B76 08 inc R0 ; Increment Operand code:00005B77 90 BE 00 mov DPTR, #0xBE00 ; Move (Op1 <- Op2) code:00005B7A 12 13 5D lcall code_135D ; Long Subroutine Call code:00005B7D F2 movx @R0, A ; Move from/to external RAM code:00005B7E 08 inc R0 ; Increment Operand code:00005B7F 79 5F mov R1, #0x5F ; '_' ; Move (Op1 <- Op2) code:00005B81 E3 movx A, @R1 ; Move from/to external RAM code:00005B82 F2 movx @R0, A ; Move from/to external RAM code:00005B83 08 inc R0 ; Increment Operand code:00005B84 E5 54 mov A, RAM_54 ; Move (Op1 <- Op2) code:00005B86 F2 movx @R0, A ; Move from/to external RAM code:00005B87 08 inc R0 ; Increment Operand code:00005B88 E5 5E mov A, RAM_5E ; Move (Op1 <- Op2) code:00005B8A F2 movx @R0, A ; Move from/to external RAM code:00005B8B 08 inc R0 ; Increment Operand code:00005B8C E5 5F mov A, RAM_5F ; Move (Op1 <- Op2) code:00005B8E F2 movx @R0, A ; Move from/to external RAM code:00005B8F 08 inc R0 ; Increment Operand code:00005B90 E5 6F mov A, RAM_6F ; Move (Op1 <- Op2) code:00005B92 F2 movx @R0, A ; Move from/to external RAM code:00005B93 08 inc R0 ; Increment Operand code:00005B94 75 A0 01 mov P2, #1 ; Port 2 code:00005B97 79 70 mov R1, #0x70 ; 'p' ; Move (Op1 <- Op2) code:00005B99 E3 movx A, @R1 ; Move from/to external RAM code:00005B9A 75 A0 00 mov P2, #0 ; Port 2 code:00005B9D F2 movx @R0, A ; Move from/to external RAM code:00005B9E 08 inc R0 ; Increment Operand code:00005B9F 12 5B C5 lcall code_5BC5 ; Long Subroutine Call code:00005BA2 F2 movx @R0, A ; Move from/to external RAM code:00005BA3 08 inc R0 ; Increment Operand code:00005BA4 79 20 mov R1, #0x20 ; ' ' ; Move (Op1 <- Op2) code:00005BA6 E7 mov A, @R1 ; Move (Op1 <- Op2) code:00005BA7 F2 movx @R0, A ; Move from/to external RAM code:00005BA8 08 inc R0 ; Increment Operand code:00005BA9 90 63 60 mov DPTR, #0x6360 ; Move (Op1 <- Op2) code:00005BAC E4 clr A ; Clear Operand (0) code:00005BAD 93 movc A, @A+DPTR ; Move code byte relative to second op to Acc code:00005BAE F2 movx @R0, A ; Move from/to external RAM code:00005BAF 08 inc R0 ; Increment Operand code:00005BB0 E5 5A mov A, RAM_5A ; Move (Op1 <- Op2) code:00005BB2 F2 movx @R0, A ; Move from/to external RAM code:00005BB3 08 inc R0 ; Increment Operand code:00005BB4 E5 5B mov A, RAM_5B ; Move (Op1 <- Op2) code:00005BB6 F2 movx @R0, A ; Move from/to external RAM code:00005BB7 E8 mov A, R0 ; Move (Op1 <- Op2) code:00005BB8 C3 clr C ; Clear Operand (0) code:00005BB9 94 AF subb A, #0xAF ; Subtract Second Operand from Acc with Borrow code:00005BBB 78 AF mov R0, #0xAF ; Move (Op1 <- Op2) code:00005BBD F2 movx @R0, A ; Move from/to external RAM code:00005BBE D2 AC setb IEN0.4 ; Interrupt Enable Register 0 code:00005BC0 75 99 FE mov SBUF, #0xFE ; Serial Channel Buffer Reg. code:00005BC3 22 ret ; Return from subroutine code:00005BC3 ; End of function code_5B30 code:00005BC3 code:00005BC3 ; --------------------------------------------------------------------------- code:00005BC4 FF .byte 0xFF code:00005BC5 code:00005BC5 ; =============== S U B R O U T I N E ======================================= code:00005BC5 code:00005BC5 code:00005BC5 code_5BC5: ; CODE XREF: code_5B30+6F↑p code:00005BC5 90 BE 06 mov DPTR, #0xBE06 ; Move (Op1 <- Op2) code:00005BC8 E0 movx A, @DPTR ; Move from/to external RAM code:00005BC9 22 ret ; Return from subroutine code:00005BC9 ; End of function code_5BC5 code:00005BC9 code:00005BC9 ; --------------------------------------------------------------------------- code:00005BCA FF .byte 0xFF code:00005BCB FF .byte 0xFF code:00005BCC FF .byte 0xFF code:00005BCD FF .byte 0xFF code:00005BCE FF .byte 0xFF code:00005BCF FF .byte 0xFF code:00005BD0 code:00005BD0 ; =============== S U B R O U T I N E ======================================= code:00005BD0 code:00005BD0 code:00005BD0 RI_TI_0_0: ; CODE XREF: RI_TI_0↑j code:00005BD0 code:00005BD0 ; FUNCTION CHUNK AT code:00004185 SIZE 0000000C BYTES code:00005BD0 code:00005BD0 20 24 07 jb RAM_24.4, code_5BDA ; Jump if Bit is set code:00005BD3 02 41 85 ljmp code_4185 ; Long Jump code:00005BD6 ; --------------------------------------------------------------------------- code:00005BD6 20 99 01 jb SCON.1, code_5BDA ; Serial Channel Control Reg. code:00005BD9 32 reti ; Return from Interrupt code:00005BDA ; --------------------------------------------------------------------------- code:00005BDA code:00005BDA code_5BDA: ; CODE XREF: RI_TI_0_0↑j code:00005BDA ; RI_TI_0_0+6↑j code:00005BDA C0 83 push DPH ; Data Pointer, High Byte code:00005BDC C0 82 push DPL ; Data Pointer, Low Byte code:00005BDE C0 E0 push ACC ; Accumulator code:00005BE0 C2 99 clr SCON.1 ; Serial Channel Control Reg. code:00005BE2 90 00 AF mov DPTR, #0xAF ; Move (Op1 <- Op2) code:00005BE5 E0 movx A, @DPTR ; Move from/to external RAM code:00005BE6 70 09 jnz code_5BF1 ; Jump if Acc is not zero code:00005BE8 C2 AC clr IEN0.4 ; Interrupt Enable Register 0 code:00005BEA D0 E0 pop ACC ; Accumulator code:00005BEC D0 82 pop DPL ; Data Pointer, Low Byte code:00005BEE D0 83 pop DPH ; Data Pointer, High Byte code:00005BF0 32 reti ; Return from Interrupt code:00005BF1 ; --------------------------------------------------------------------------- code:00005BF1 code:00005BF1 code_5BF1: ; CODE XREF: RI_TI_0_0+16↑j code:00005BF1 C0 D0 push PSW ; Program Status Word Register code:00005BF3 14 dec A ; Decrement Operand code:00005BF4 F0 movx @DPTR, A ; Move from/to external RAM code:00005BF5 24 B0 add A, #0xB0 ; Add Second Operand to Acc code:00005BF7 F5 82 mov DPL, A ; Data Pointer, Low Byte code:00005BF9 E0 movx A, @DPTR ; Move from/to external RAM code:00005BFA F5 99 mov SBUF, A ; Serial Channel Buffer Reg. code:00005BFC D0 D0 pop PSW ; Program Status Word Register code:00005BFE D0 E0 pop ACC ; Accumulator code:00005C00 D0 82 pop DPL ; Data Pointer, Low Byte code:00005C02 D0 83 pop DPH ; Data Pointer, High Byte code:00005C04 32 reti ; Return from Interrupt code:00005C04 ; End of function RI_TI_0_0 code:00005C04 code:00005C04 ; ---------------------------------------------------------------------------
Leave a comment: