Announcement

Collapse
No announcement yet.

tune switching on boost chip

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    On my desk it didn't crashes but I think it's cause the N75 etc. is deactivated cause of the missing knock sensors...
    I think it's some task for a long winter.

    Thanks so far!

    Comment


    • #17
      Originally posted by prj View Post
      I
      The solution is:
      1. Turn off the TXD interrupt and remove all code from there.
      2. Initiate the first byte in the main loop like now, but for 2nd byte, add in some places that are run often the check for whether the byte was transmitted already - then call the function that transmits the next byte. In the fuel chip I did this by adding the transmits to the map lookup function via a jump. I did it so that it does not require extra pushing of variables, so the cost is very low. Something like that should be done here too.
      This become very interesting I'm in

      1. All code from TXD interrupt is removed. Just one check for magician start byte or Ram from throttle.
      2. Map lookup function via a jump will be used in boost code also. Code for axis and maps is read at least = 8 + 3 + 3 + 16 + 16 times.
      To be done - check for whether the byte was transmitted already - then call for the function that transmits the next byte!!



      First problem : The DPTR and registers in Map lookup function in boost code are used to point positions of axis or maps. Push and Pop functions are not welcome... then new smart approach is needed.
      Last edited by d_anev; 10 December 2019, 11:54.

      Comment


      • #18
        Then for TXD only this code:
        code:00000023 push Acc
        code:000000XX muv A, Ram_73 - check if magic byte is set
        code:000000XX jz Code_End
        code:000000XX jbc SCON.0, Code_Next
        code:000000XX clr SCON.1
        code:000000XX pop Acc
        Code_Next
        code:000000XX reti
        code:000000XX clr IEN0.4
        Code_End
        code:000000XX pop Acc
        code:000000XX reti
        For Axis code should be something like that:
        lcall from read axis procedure:
        code:000000XX Push Acc, DPH, DPL and Ram_0 if needed
        code:00001B06 mov DPTR, #0x1FF0
        code:00001B09 clr A
        code:00001B0A movc A, @A+DPTR
        OR
        code:000000XX muv A, Ram_73 - check if magic byte is set
        code:000000XX jnz Code_continue_read_Axis
        code:000000XX jbc SCON.1, code_next Transmitter interrupt
        code:00000000 clr SCON.0 Receiver interrupt
        code_next
        code:00000000 pop DPL, DPH, Acc and Ram_0 if used
        code:00000000 sjmp to Code_continue_read_Axis
        code_next
        code:00000000 push B ; B-Register
        code:00000000 clr C
        code:00000000 mov A, RAM_7E
        code:00000000 cjne A, 0xXX code_next -max number of transmitted bytes/var
        Code_next
        code:00000000 jc code_Continue
        code:00000000 cjne A, 0xFF, Code_Code_clr_IEN0.4 jump to end of transmit
        Code_Continue
        code:00000000 inc RAM_7E
        code:00000000 mov A, RAM_7E
        code:00000000 mov B, #2 ; B-Register
        code:00000000 mul AB
        code:00000000 pop B
        code:00000000 pop PSW - is not needed
        code:00000000 mov DPTR, #0x1XXX
        code:00000000 jmp @A+DPTR
        code:00000000 sjmp code_byte_2 )) not 1
        end etc….

        Guys,
        we should discuss its axis procedure is enough "lcall-ed" . In motor code this procedure is "called" more than 100 times in main loop during reading of maps. Here will be "called" 46 times in best case in main loop.

        Now is your turn help.


        Last edited by d_anev; 11 December 2019, 07:40.

        Comment


        • #19
          Based on Dmitri’s motor BDL code is that new boost BDL code:
          for TXD only this to keep stock logic:
          code:00001B00 RI_TI_0: ; CODE XREF: RI_TIj
          code:00001B00 push ACC
          code:00001B02 mov A, RAM_73_Start_Stop_BDL
          code:00001B04 jz code_1B10
          code:00001B06 jbc SCON.0, code_1B0E
          code:00001B09 clr SCON.1
          code:00001B0B pop ACC
          code:00001B0D reti
          code:00001B0E code_1B0E:
          code:00001B0E clr IEN0.4
          code:00001B10 code_1B10:
          code:00001B10 pop ACC
          code:00001B12 reti


          New Code - Lcall for Read data and Send code and keeping stock logic (there is no Push and Pop for low cost):
          code:00001D00 code_1D00_ljmp_Axis: ; CODE XREF: j_code_1D00_ljmp_Axisj
          code:00001D00 000 mov A, RAM_73_Start_Stop_BDL
          code:00001D02 000 jnz code_1D1A
          code:00001D04 000 mov A, R0
          code:00001D05 000 mov R3, A
          code:00001D06 000 mov A, R1
          code:00001D07 000 mov R6, A
          code:00001D08 000 mov A, RAM_7E_SendData_Counter
          code:00001D0A 000 cjne A, #0xFF, code_1D10
          code:00001D0D 000 lcall code_1D40_Read_Data
          code:00001D10 code_1D10:
          code:00001D10 000 jnb IEN0.4, code_1D16
          code:00001D13 000 lcall code_1D20_Send_Data
          code:00001D16 code_1D16:
          code:00001D16 000 mov A, R6
          code:00001D17 000 mov R1, A
          code:00001D18 000 mov A, R3
          code:00001D19 000 mov R0, A
          code:00001D1A code_1D1A:
          code:00001D1A 000 mov A, @R1
          code:00001D1B 000 mov R3, A
          code:00001D1C 000 mov A, R7
          code:00001D1D 000 ljmp code_168E
          code:00001D1D ; End of function code_1D00_ljmp_Axis

          Send data code:
          code:00001D20 000 jnb SCON.1, code_1D33
          code:00001D23 000 clr SCON.1
          code:00001D25 000 mov A, RAM_7E_SendData_Counter
          code:00001D27 000 jz code_1D36
          code:00001D29 000 dec A
          code:00001D2A 000 mov RAM_7E_SendData_Counter, A
          code:00001D2C 000 add A, #0xF0
          code:00001D2E 000 mov R0, A
          code:00001D2F 000 movx A, @R0
          code:00001D30 000 mov SBUF, A
          code:00001D32 000 ret
          code:00001D33 code_1D33:
          code:00001D33 000 clr SCON.0
          code:00001D35 000 ret
          code:00001D36 code_1D36:
          code:00001D36 000 clr IEN0.4
          code:00001D38 000 ret
          code:00001D38 ; End of function code_1D20_Send_Data


          Read data code:
          code:00001D40 code_1D40_Read_Data:
          code:00001D40 000 mov R0, #0xFC
          code:00001D42 000 dec R0
          code:00001D43 000 mov A, RAM_71
          code:00001D45 000 movx @R0, A
          code:00001D46 000 dec R0
          code:00001D47 000 mov A, RAM_6D
          code:00001D49 000 movx @R0, A
          code:00001D4A 000 dec R0
          code:00001D4B 000 mov A, RAM_72
          code:00001D4D 000 movx @R0, A
          code:00001D4E 000 dec R0
          code:00001D4F 000 mov R1, #0xD2
          code:00001D51 000 mov A, @R1
          code:00001D52 000 movx @R0, A
          code:00001D53 000 dec R0
          code:00001D54 000 mov R1, #0xD3
          code:00001D56 000 mov A, @R1
          code:00001D57 000 movx @R0, A
          code:00001D58 000 dec R0
          code:00001D59 000 mov R1, #0xD4
          code:00001D5B 000 mov A, @R1
          code:00001D5C 000 movx @R0, A
          code:00001D5D 000 dec R0
          code:00001D5E 000 mov R1, #0xD5
          code:00001D60 000 mov A, @R1
          code:00001D61 000 movx @R0, A
          code:00001D62 000 dec R0
          code:00001D63 000 mov R1, #0xD6
          code:00001D65 000 mov A, @R1
          code:00001D66 000 movx @R0, A
          code:00001D67 000 dec R0
          code:00001D68 000 mov R1, #0x78
          code:00001D6A 000 movx A, @R1
          code:00001D6B 000 movx @R0, A
          code:00001D6C 000 dec R0
          code:00001D6D 000 mov A, RAM_6B
          code:00001D6F 000 movx @R0, A
          code:00001D70 000 dec R0
          code:00001D71 000 mov A, #0xAA
          code:00001D73 000 movx @R0, A
          code:00001D74 000 dec R0
          code:00001D75 000 mov A, #0xBB
          code:00001D77 000 movx @R0, A
          code:00001D78 000 mov A, #0xFC
          code:00001D7A 000 clr C
          code:00001D7B 000 subb A, R0
          code:00001D7C 000 mov RAM_7E_SendData_Counter, A
          code:00001D7E 000 ret
          code:00001D7E ; End of function code_1D40_Read_Data


          Then I added four more places where lcall code_1D20_Send_Data and where R0, R1 and Acc are loaded with new values right after this lcall and the code working. I did only one test on the car, because my test ecu and environment are in storage boxes tucked away somewhere.
          Now someone can tested this code and confirmed that xram_F0 to xram_FB are not used in main code, because I chose this range based on reading of code on mind. The real usage or not of this xram is not tested.

          Now is your turn - Help!!!

          Comment


          • #20
            Somehow I don't see the advantage to copy it inside the memory?

            Comment


            • #21
              Xram is expensive in the means of IO. Mostly you have to do addressing, use movx function, etc. Besides the "easier" way to just use registers and (mostly) internal memory with low cost, cheap functions.

              This at least needs to be tested to 10k rpm'ish.

              My own "testbench" is undergoing some corrosion removals, lack of space, etc. I hope to wake the beast up for its 30y party if not before.

              Comment


              • #22
                This is first solution which was come in my mind, to use available solution from motor code.
                I have another solution in mind , the code where Ram_7E is compared with values.
                Example: - if this Ram not equal to current value jump to next compare.... and this from 0x0 to 0xB
                something like this:
                if equal to 0x0 then code
                mov A, RAM_71
                mov SBUF, A
                inc RAM_7E
                ret

                if equal to 0x1 then code
                mov A, RAM_6D
                mov SBUF, A
                inc RAM_7E
                ret

                ......
                and etc ....
                and etc ....
                .....
                till
                if equal to 0xB then
                clr IEN0.4
                ret.


                I just need a little more free time to refine and test it, but can't find it at now

                Best Regards

                Comment


                • #23
                  Sorry. I don’t see the advantage to put stuff from internal ram into external and then to put it from external to the SBUF...
                  The mov A, R1 could also be mov SBUF etc.

                  The limit of the transfer rate should work different to balance the load...
                  Hmm. I have to think about this more.

                  At the moment I’m not able to test it cause without knock enable a lot of stuff is not running on my desk.

                  Comment


                  • #24
                    Originally posted by Acki View Post
                    Sorry. I don’t see the advantage to put stuff from internal ram into external and then to put it from external to the SBUF...
                    The mov A, R1 could also be mov SBUF etc.
                    Yes, this is cost not effective, but is done only one time per full cycle of transmission and is done to be able to send data with one simple procedure. It is done, almost on the fly copy paste from Dmitri's code
                    Main problem on this code is with interrupts (ignition for example, timer 2) . Using of registers R0 and R1 will cause a problems during this interrupts. The code must be refined to avoid this.

                    Comment

                    Working...
                    X