Loading ...
Sorry, an error occurred while loading the content.

combine a few HET programs

Expand Messages
  • freddy2_es
    Hi I m working with a TMS470R1B1M There are some examples for creating for example a pair of usarts by using the HET engine, of even for generating periodic
    Message 1 of 3 , Jul 24 11:24 AM
    • 0 Attachment
      Hi

      I'm working with a TMS470R1B1M

      There are some examples for creating for example a pair of usarts by
      using the HET engine, of even for generating periodic interrupts. In
      fact i'm using the one for usarts right now, and of course works fine.

      Anyway my idea is being able to join 2 of those applications into HET
      RAM, and get both working together. My idea was to add the periodic
      interrupt generator to my currently working usart.het file.

      As far as i've seen for each assembler instruction you must indicate
      the next one, so i assume it simply will be repeating the execution
      cycle on HET RAM (at the final part of the usart het example the last
      instruction returns to the first, ciclycaly). So i've tried to place
      the instructions needed for generating those periodic interrupts right
      before this last instruction, and i've linked this new one to the
      last from usart (in order to execute both in the same way, and have
      both applications working together).

      The fact is that it doesn't work. I've configured the HET interrupt
      register for allowing this instruction to generate interrupts (it's
      the same way as it's done for the usarts) but isn't working.

      Has someone done something similar to this? I imagine this can be
      done, but.. how?

      Regards
    • rickatedge
      Without seeing your instructions it is difficult to give much of an in depth response, however there are a few things to look for. When you set up your loop
      Message 2 of 3 , Jul 24 12:05 PM
      • 0 Attachment
        Without seeing your instructions it is difficult to give much of an in
        depth response, however there are a few things to look for. When you
        set up your loop time, make certain that you have allocated enough
        time to go through the entire set of instructions. Also, look at the
        use of registers used in any comparisons (if that is how you are
        generating your interrupt) to make certain it is not used elsewhere,
        and also check to make sure that the het channels/pins don't conflict

        Good luck

        --- In TMS470_ARM@yahoogroups.com, "freddy2_es" <freddy2_es@...> wrote:
        >
        > Hi
        >
        > I'm working with a TMS470R1B1M
        >
        > There are some examples for creating for example a pair of usarts by
        > using the HET engine, of even for generating periodic interrupts. In
        > fact i'm using the one for usarts right now, and of course works fine.
        >
        > Anyway my idea is being able to join 2 of those applications into HET
        > RAM, and get both working together. My idea was to add the periodic
        > interrupt generator to my currently working usart.het file.
        >
        > As far as i've seen for each assembler instruction you must indicate
        > the next one, so i assume it simply will be repeating the execution
        > cycle on HET RAM (at the final part of the usart het example the last
        > instruction returns to the first, ciclycaly). So i've tried to place
        > the instructions needed for generating those periodic interrupts right
        > before this last instruction, and i've linked this new one to the
        > last from usart (in order to execute both in the same way, and have
        > both applications working together).
        >
        > The fact is that it doesn't work. I've configured the HET interrupt
        > register for allowing this instruction to generate interrupts (it's
        > the same way as it's done for the usarts) but isn't working.
        >
        > Has someone done something similar to this? I imagine this can be
        > done, but.. how?
        >
        > Regards
        >
      • freddy2_es
        Here it goes: ;******************************************************************************* ; TMS470R1B1M Demo - 2 x 9,600 Baud UART using HET ; ;
        Message 3 of 3 , Jul 25 5:23 AM
        • 0 Attachment
          Here it goes:

          ;*******************************************************************************
          ; TMS470R1B1M Demo - 2 x 9,600 Baud UART using HET
          ;
          ; Description: This program implements 2 x 9600 Baud UARTs using the HET.
          ; Pins HET0/HET1 are used for UART1 and pins HET2/HET3 are used for
          ; UART2. Note that any HET pins can be used.
          ; SYSCLK = 8x7.5MHz = 60MHz.
          ;
          ; Andreas Dannenberg
          ; Texas Instruments, Inc
          ; June 06th 2006
          ; Built with IAR Embedded Workbench Version: 4.31A
          ; B1M EVM
          ;*******************************************************************************

          TX1_PIN .equ 20 ; HET20 is used for
          UART1 TX
          RX1_PIN .equ 22 ; HET22 is used for
          UART1 RX

          TX2_PIN .equ 1 ; HET1 is used for UART2 TX
          RX2_PIN .equ 2 ; HET2 is used for UART2 RX

          DUMMY_PIN .equ 25 ; Dummy pin for SHFT
          instruction

          BIT_PRD .equ 38 ; 1 bit period
          [LRCLK] less 1
          BIT_PRD_1_5 .equ 57 ; 1.5 bit period
          [LRCLK] less 1
          BITS2RX .equ 8 ; Rec 8+1 bits after
          start bit

          ;-------------------------------------------------------------------------------
          ; UART1 TX Routine
          ;
          ; Code length : 10 Words
          ; Interrupt : TX_Start + 2
          ; Min cycle count: 1
          ; Max cycle count: 9
          ;-------------------------------------------------------------------------------

          ; If data != 0, then execute TX routine
          ; If data == 0, then skip TX routine
          TX1_Start DJZ { next=TX1_PrdCtr, cond_addr=TX1_End, irq=OFF,
          data=0 }

          ; If PeriodCtr != 0, then skip TX routine
          ; If PeriodCtr == 0, then continue TX routine to process next bit
          TX1_PrdCtr DJZ { next=TX1_Cont, cond_addr=TX1_BitCtr, irq=OFF,
          data=0 }

          ; If BitCtr != 0, then continue TX routine to process next bit
          ; If BitCtr == 0, then TX is done. Interrupt is generated.
          ; Note that BitCtr is set by the main ARM7 program prior TX.
          TX1_BitCtr DJZ { next=TX1_Shift, cond_addr=TX1_End, irq=ON, data=0 }

          ; Shift DUMMY_PIN state into MSB / LSB into Z.
          ; Data to transmit is written here by the main ARM7 program.
          TX1_Shift SHFT { next=TX1_LoadA, smode=IRZ, cond_addr=TX1_LoadA,
          cond=UNC, pin=DUMMY_PIN, reg=NONE, irq=OFF, data=0 }

          ; Load 0 to register A (Used as MCMP compare value)
          TX1_LoadA MOV32 { next=TX1_CheckZ, remote=TX1_LoadA, type=IMTOREG,
          reg=A, data=0 }

          ; Test bit that was shifted into Z
          TX1_CheckZ BR { next=TX1_Low, cond_addr=TX1_High, event=ZERO,
          irq=OFF }

          ; Set TX1_PIN
          ; The comparison with register A must always be true.
          TX1_High MCMP { next=TX1_Reload, cond_addr=TX1_Reload, reg=A,
          en_pin_action=ON, pin=TX1_PIN, order=DATA_GE_REG,
          action=SET, data=0x7FFFF}

          ; Clear TX1_PIN
          ; The comparison with register A must always be true.
          TX1_Low MCMP { next=TX1_Reload, cond_addr=TX1_Reload, reg=A,
          en_pin_action=ON, pin=TX1_PIN, order=DATA_GE_REG,
          action=CLEAR, data=0x7FFFF}

          ; Reload the bit period counter
          TX1_Reload MOV32 { next=TX1_Cont, remote=TX1_PrdCtr, type=IMTOREG&REM,
          reg=NONE, data=BIT_PRD }

          ; Run the TX routine on next LR by setting the data field of DJZ to 1
          TX1_Cont MOV32 { next=TX1_End, remote=TX1_Start,
          type=IMTOREG&REM, reg=NONE,
          data=1 }

          TX1_End

          ;-------------------------------------------------------------------------------
          ; UART1 RX Routine
          ;
          ; Code length : 15 Words
          ; Interrupt : RX_Start + 8
          ; Min cycle count: 2
          ; Max cycle count: 11
          ;-------------------------------------------------------------------------------

          ; If data != 0, then execute RX routine
          ; If data == 0, then skip RX routine, detect start bit
          RX1_Start DJZ { next=RX1_PrdCtr, cond_addr=RX1_Detect, irq=OFF,
          data=0 }

          ; If PeriodCtr != 0, then skip RX routine
          ; If PeriodCtr == 0, then receive next bit
          RX1_PrdCtr DJZ { next=RX1_Cont, cond_addr=RX1_Shift, irq=OFF,
          data=0 }

          ; Shift LSB to DUMMY_PIN / 0 into MSB.
          RX1_Shift SHFT { next=RX1_Check, cond_addr=RX1_Check, reg=NONE,
          smode=OR0,
          cond=UNC, pin=DUMMY_PIN, data=0 }

          ; Check state of RX1_PIN
          RX1_Check BR { next=RX1_High, cond_addr=RX1_BitCtr,
          pin=RX1_PIN, event=LOW }

          ; Set MSB of the SHFT data field if RX1_PIN was high
          RX1_High ADCNST { next=RX1_BitCtr, remote=RX1_Shift, min_off=0,
          data=0x80000 }

          ; If BitCtr != 0, then continue RX routine to process next bit
          ; If BitCtr == 0, then RX is done
          RX1_BitCtr DJZ { next=RX1_Reload, cond_addr=RX1_Done, irq=OFF,
          data=0 }

          ; Store received data
          RX1_Done MOV32 { next=RX1_Done2, remote=RX1_Shift, type=REMTOREG,
          reg=A, data=0 }
          RX1_Done2 MOV32 { next=RX1_Done3, remote=RX1_Buffer, type=REGTOREM,
          reg=A, data=0 }

          ; Generate RX interrupt
          RX1_Done3 DJZ { next=RX1_End, cond_addr=RX1_End, irq=ON, data=0 }

          ; Dummy instruction to hold RX value. ARM7 reads out received value here.
          RX1_Buffer MOV32 { next=RX1_Buffer, remote=RX1_Buffer, type=IMTOREG,
          reg=NONE, data=0 }

          ; Reload the bit period counter with BIT_PRD
          RX1_Reload MOV32 { next=RX1_Cont, remote=RX1_PrdCtr, type=IMTOREG&REM,
          reg=NONE, data=BIT_PRD }

          ; Check for low-level on RX1_PIN (start bit)
          RX1_Detect BR { next=RX1_End, cond_addr=RX1_Low, pin=RX1_PIN,
          event=LOW,
          irq=OFF }

          ; Reload the bit period counter with 1.5 x BIT_PRD (middle of 1st data
          bit)
          RX1_Low MOV32 { next=RX1_Low2, remote=RX1_PrdCtr, type=IMTOREG&REM,
          reg=NONE, data=BIT_PRD_1_5 }

          ; Reload BitCtr instruction data field to receive BITS2RX bits
          RX1_Low2 MOV32 { next=RX1_Cont, remote=RX1_BitCtr, type=IMTOREG&REM,
          reg=NONE, data=BITS2RX }

          ; Run the RX routine on next LR by setting the data field of DJZ to 1
          RX1_Cont MOV32 { next=RX1_End, remote=RX1_Start,
          type=IMTOREG&REM, reg=NONE,
          data=1 }

          RX1_End

          ;-------------------------------------------------------------------------------
          ; UART2 TX Routine
          ;
          ; Code length : 10 Words
          ; Interrupt : TX_Start + 2
          ; Min cycle count: 1
          ; Max cycle count: 9
          ;-------------------------------------------------------------------------------

          ; If data != 0, then execute TX routine
          ; If data == 0, then skip TX routine
          TX2_Start DJZ { next=TX2_PrdCtr, cond_addr=TX2_End, irq=OFF,
          data=0 }

          ; If PeriodCtr != 0, then skip TX routine
          ; If PeriodCtr == 0, then continue TX routine to process next bit
          TX2_PrdCtr DJZ { next=TX2_Cont, cond_addr=TX2_BitCtr, irq=OFF,
          data=0 }

          ; If BitCtr != 0, then continue TX routine to process next bit
          ; If BitCtr == 0, then TX is done. Interrupt is generated.
          ; Note that BitCtr is set by the main ARM7 program prior TX.
          TX2_BitCtr DJZ { next=TX2_Shift, cond_addr=TX2_End, irq=ON, data=0 }

          ; Shift DUMMY_PIN state into MSB / LSB into Z.
          ; Data to transmit is written here by the main ARM7 program.
          TX2_Shift SHFT { next=TX2_LoadA, smode=IRZ, cond_addr=TX2_LoadA,
          cond=UNC, pin=DUMMY_PIN, reg=NONE, irq=OFF, data=0 }

          ; Load 0 to register A (Used as MCMP compare value)
          TX2_LoadA MOV32 { next=TX2_CheckZ, remote=TX2_LoadA, type=IMTOREG,
          reg=A, data=0 }

          ; Test bit that was shifted into Z
          TX2_CheckZ BR { next=TX2_Low, cond_addr=TX2_High, event=ZERO,
          irq=OFF }

          ; Set TX2_PIN
          ; The comparison with register A must always be true.
          TX2_High MCMP { next=TX2_Reload, cond_addr=TX2_Reload, reg=A,
          en_pin_action=ON, pin=TX2_PIN, order=DATA_GE_REG,
          action=SET, data=0x7FFFF}

          ; Clear TX2_PIN
          ; The comparison with register A must always be true.
          TX2_Low MCMP { next=TX2_Reload, cond_addr=TX2_Reload, reg=A,
          en_pin_action=ON, pin=TX2_PIN, order=DATA_GE_REG,
          action=CLEAR, data=0x7FFFF}

          ; Reload the bit period counter
          TX2_Reload MOV32 { next=TX2_Cont, remote=TX2_PrdCtr, type=IMTOREG&REM,
          reg=NONE, data=BIT_PRD }

          ; Run the TX routine on next LR by setting the data field of DJZ to 1
          TX2_Cont MOV32 { next=TX2_End, remote=TX2_Start,
          type=IMTOREG&REM, reg=NONE,
          data=1 }

          TX2_End

          ;-------------------------------------------------------------------------------
          ; UART2 RX Routine
          ;
          ; Code length : 15 Words
          ; Interrupt : RX_Start + 8
          ; Min cycle count: 2
          ; Max cycle count: 11
          ;-------------------------------------------------------------------------------

          ; If data != 0, then execute RX routine
          ; If data == 0, then skip RX routine, detect start bit
          RX2_Start DJZ { next=RX2_PrdCtr, cond_addr=RX2_Detect, irq=OFF,
          data=0 }

          ; If PeriodCtr != 0, then skip RX routine
          ; If PeriodCtr == 0, then receive next bit
          RX2_PrdCtr DJZ { next=RX2_Cont, cond_addr=RX2_Shift, irq=OFF,
          data=0 }

          ; Shift LSB to DUMMY_PIN / 0 into MSB.
          RX2_Shift SHFT { next=RX2_Check, cond_addr=RX2_Check, reg=NONE,
          smode=OR0,
          cond=UNC, pin=DUMMY_PIN, data=0 }

          ; Check state of RX2_PIN
          RX2_Check BR { next=RX2_High, cond_addr=RX2_BitCtr,
          pin=RX2_PIN, event=LOW }

          ; Set MSB of the SHFT data field if RX2_PIN was high
          RX2_High ADCNST { next=RX2_BitCtr, remote=RX2_Shift, min_off=0,
          data=0x80000 }

          ; If BitCtr != 0, then continue RX routine to process next bit
          ; If BitCtr == 0, then RX is done
          RX2_BitCtr DJZ { next=RX2_Reload, cond_addr=RX2_Done, irq=OFF,
          data=0 }

          ; Store received data
          RX2_Done MOV32 { next=RX2_Done2, remote=RX2_Shift, type=REMTOREG,
          reg=A, data=0 }
          RX2_Done2 MOV32 { next=RX2_Done3, remote=RX2_Buffer, type=REGTOREM,
          reg=A, data=0 }

          ; Generate RX interrupt
          RX2_Done3 DJZ { next=RX2_End, cond_addr=RX2_End, irq=ON, data=0 }

          ; Dummy instruction to hold RX value. ARM7 reads out received value here.
          RX2_Buffer MOV32 { next=RX2_Buffer, remote=RX2_Buffer, type=IMTOREG,
          reg=NONE, data=0 }

          ; Reload the bit period counter with BIT_PRD
          RX2_Reload MOV32 { next=RX2_Cont, remote=RX2_PrdCtr, type=IMTOREG&REM,
          reg=NONE, data=BIT_PRD }

          ; Check for low-level on RX2_PIN (start bit)
          RX2_Detect BR { next=RX2_End, cond_addr=RX2_Low, pin=RX2_PIN,
          event=LOW,
          irq=OFF }

          ; Reload the bit period counter with 1.5 x BIT_PRD (middle of 1st data
          bit)
          RX2_Low MOV32 { next=RX2_Low2, remote=RX2_PrdCtr, type=IMTOREG&REM,
          reg=NONE, data=BIT_PRD_1_5 }

          ; Reload BitCtr instruction data field to receive BITS2RX bits
          RX2_Low2 MOV32 { next=RX2_Cont, remote=RX2_BitCtr, type=IMTOREG&REM,
          reg=NONE, data=BITS2RX }

          ; Run the RX routine on next LR by setting the data field of DJZ to 1
          RX2_Cont MOV32 { next=RX2_End, remote=RX2_Start,
          type=IMTOREG&REM, reg=NONE,
          data=1 }

          RX2_End BR { next=TimerHet_Check1, cond_addr=TimerHet_Check1,
          event=NOCOND, irq=OFF }

          ; We decrement data field inside this instruction, and when it arrives
          to 0 then
          ; increments regB (data field value must be calculated in order to get
          1 ms)
          TimerHet_Check1 DJZ { next=TimerHet_FinalBack,
          cond_addr=TimerHet_Vence1, irq=OFF, data=0x0FFFF }

          ; Fake instruction for saving the amount of milis (it's never executed)
          TimerHet_Fake MOV32 { next=TimerHet_FinalBack,
          remote=TimerHet_FinalBack, type=IMTOREG, reg=B,
          data=0 }

          ; We restore the initial value to the data field at the previous
          instruction
          TimerHet_Vence1 MOV32 { next=TimerHet_IncB,
          remote=TimerHet_Check1,type=IMTOREG&REM, reg=NONE,
          data=0x0FFFF }

          ; Here is where we really increment regB (it stores current milis)
          TimerHet_IncB ADM32 { next=TimerHet_StoreFake, init=OFF,
          type=IM®TOREG, reg=B, remote=TimerHet_FinalBack,
          data=1 }

          ; Also copy the value of regB to our fake instruction, so we can read
          it from our outside code
          TimerHet_StoreFake MOV32 { next=TimerHet_Check2,
          remote=TimerHet_Fake,type=REGTOREM, reg=B }

          ; If regB=1000 then 1 second detected, so generate interrupt (outside
          a global var will be incremented,
          ; and there we will have the current seconds)
          TimerHet_Check2 ECMP { next=TimerHet_FinalBack,
          cond_addr=TimerHet_ResetB, en_pin_action=OFF,
          reg=B, irq=ON, pin=CC18, data=1000 }

          ; Clear regB after generating interrupt (remote not used)
          TimerHet_ResetB MOV32 { next=TimerHet_StoreFake2,
          remote=TimerHet_FinalBack, type=IMTOREG, reg=B,
          data=0 }

          ; Also copy the value of regB to our fake instruction, so we can read
          it from our outside code
          TimerHet_StoreFake2 MOV32 { next=TimerHet_FinalBack,
          remote=TimerHet_Fake,type=REGTOREM, reg=B }

          ;-------------------------------------------------------------------------------
          TimerHet_FinalBack BR { next=TX1_Start, cond_addr=TX1_Start,
          event=NOCOND, irq=OFF }



          Basicly is the same code for 2x9600 HET USART, but adding at the last
          part a few instructions for the timer control. My idea is to use the
          DJZ instruction for counting up to 1 ms, then when the 0 value is
          reached regB is incremented. In the end regB stores the amount of
          milis since the last second (it's also stored at the data field of a
          fake MOV32 instruction, in order to have a way to access to the value
          from the controller). When regB=1000 one second is detected.
          So an interrupt is generated and outside a global var is incremented
          (this one stores the current amount of seconds). After that regB
          is cleared.

          The file .h generated by het470 is:
          #define HET_TX1_Start_0 (e_HETPROGRAM0_UN.Program0_ST.TX1_Start_0)
          #define HET_TX1_PrdCtr_0 (e_HETPROGRAM0_UN.Program0_ST.TX1_PrdCtr_0)
          #define HET_TX1_BitCtr_0 (e_HETPROGRAM0_UN.Program0_ST.TX1_BitCtr_0)
          #define HET_TX1_Shift_0 (e_HETPROGRAM0_UN.Program0_ST.TX1_Shift_0)
          #define HET_TX1_LoadA_0 (e_HETPROGRAM0_UN.Program0_ST.TX1_LoadA_0)
          #define HET_TX1_CheckZ_0 (e_HETPROGRAM0_UN.Program0_ST.TX1_CheckZ_0)
          #define HET_TX1_High_0 (e_HETPROGRAM0_UN.Program0_ST.TX1_High_0)
          #define HET_TX1_Low_0 (e_HETPROGRAM0_UN.Program0_ST.TX1_Low_0)
          #define HET_TX1_Reload_0 (e_HETPROGRAM0_UN.Program0_ST.TX1_Reload_0)
          #define HET_TX1_Cont_0 (e_HETPROGRAM0_UN.Program0_ST.TX1_Cont_0)
          #define HET_RX1_Start_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Start_0)
          #define HET_RX1_PrdCtr_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_PrdCtr_0)
          #define HET_RX1_Shift_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Shift_0)
          #define HET_RX1_Check_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Check_0)
          #define HET_RX1_High_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_High_0)
          #define HET_RX1_BitCtr_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_BitCtr_0)
          #define HET_RX1_Done_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Done_0)
          #define HET_RX1_Done2_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Done2_0)
          #define HET_RX1_Done3_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Done3_0)
          #define HET_RX1_Buffer_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Buffer_0)
          #define HET_RX1_Reload_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Reload_0)
          #define HET_RX1_Detect_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Detect_0)
          #define HET_RX1_Low_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Low_0)
          #define HET_RX1_Low2_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Low2_0)
          #define HET_RX1_Cont_0 (e_HETPROGRAM0_UN.Program0_ST.RX1_Cont_0)
          #define HET_TX2_Start_0 (e_HETPROGRAM0_UN.Program0_ST.TX2_Start_0)
          #define HET_TX2_PrdCtr_0 (e_HETPROGRAM0_UN.Program0_ST.TX2_PrdCtr_0)
          #define HET_TX2_BitCtr_0 (e_HETPROGRAM0_UN.Program0_ST.TX2_BitCtr_0)
          #define HET_TX2_Shift_0 (e_HETPROGRAM0_UN.Program0_ST.TX2_Shift_0)
          #define HET_TX2_LoadA_0 (e_HETPROGRAM0_UN.Program0_ST.TX2_LoadA_0)
          #define HET_TX2_CheckZ_0 (e_HETPROGRAM0_UN.Program0_ST.TX2_CheckZ_0)
          #define HET_TX2_High_0 (e_HETPROGRAM0_UN.Program0_ST.TX2_High_0)
          #define HET_TX2_Low_0 (e_HETPROGRAM0_UN.Program0_ST.TX2_Low_0)
          #define HET_TX2_Reload_0 (e_HETPROGRAM0_UN.Program0_ST.TX2_Reload_0)
          #define HET_TX2_Cont_0 (e_HETPROGRAM0_UN.Program0_ST.TX2_Cont_0)
          #define HET_RX2_Start_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Start_0)
          #define HET_RX2_PrdCtr_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_PrdCtr_0)
          #define HET_RX2_Shift_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Shift_0)
          #define HET_RX2_Check_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Check_0)
          #define HET_RX2_High_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_High_0)
          #define HET_RX2_BitCtr_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_BitCtr_0)
          #define HET_RX2_Done_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Done_0)
          #define HET_RX2_Done2_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Done2_0)
          #define HET_RX2_Done3_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Done3_0)
          #define HET_RX2_Buffer_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Buffer_0)
          #define HET_RX2_Reload_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Reload_0)
          #define HET_RX2_Detect_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Detect_0)
          #define HET_RX2_Low_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Low_0)
          #define HET_RX2_Low2_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Low2_0)
          #define HET_RX2_Cont_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_Cont_0)
          #define HET_RX2_End_0 (e_HETPROGRAM0_UN.Program0_ST.RX2_End_0)
          #define HET_TimerHet_Check1_0
          (e_HETPROGRAM0_UN.Program0_ST.TimerHet_Check1_0)
          #define HET_TimerHet_Fake_0 (e_HETPROGRAM0_UN.Program0_ST.TimerHet_Fake_0)
          #define HET_TimerHet_Vence1_0
          (e_HETPROGRAM0_UN.Program0_ST.TimerHet_Vence1_0)
          #define HET_TimerHet_IncB_0 (e_HETPROGRAM0_UN.Program0_ST.TimerHet_IncB_0)
          #define HET_TimerHet_StoreFake_0
          (e_HETPROGRAM0_UN.Program0_ST.TimerHet_StoreFake_0)
          #define HET_TimerHet_Check2_0
          (e_HETPROGRAM0_UN.Program0_ST.TimerHet_Check2_0)
          #define HET_TimerHet_ResetB_0
          (e_HETPROGRAM0_UN.Program0_ST.TimerHet_ResetB_0)
          #define HET_TimerHet_StoreFake2_0
          (e_HETPROGRAM0_UN.Program0_ST.TimerHet_StoreFake2_0)
          #define HET_TimerHet_FinalBack_0
          (e_HETPROGRAM0_UN.Program0_ST.TimerHet_FinalBack_0)


          typedef union
          {
          HET_MEMORY Memory0_PST[60];
          struct
          {
          DJNZ_INSTRUCTION TX1_Start_0;
          DJNZ_INSTRUCTION TX1_PrdCtr_0;
          DJNZ_INSTRUCTION TX1_BitCtr_0;
          SHFT_INSTRUCTION TX1_Shift_0;
          MOV32_INSTRUCTION TX1_LoadA_0;
          BR_INSTRUCTION TX1_CheckZ_0;
          MCMP_INSTRUCTION TX1_High_0;
          MCMP_INSTRUCTION TX1_Low_0;
          MOV32_INSTRUCTION TX1_Reload_0;
          MOV32_INSTRUCTION TX1_Cont_0;
          DJNZ_INSTRUCTION RX1_Start_0;
          DJNZ_INSTRUCTION RX1_PrdCtr_0;
          SHFT_INSTRUCTION RX1_Shift_0;
          BR_INSTRUCTION RX1_Check_0;
          ADCNST_INSTRUCTION RX1_High_0;
          DJNZ_INSTRUCTION RX1_BitCtr_0;
          MOV32_INSTRUCTION RX1_Done_0;
          MOV32_INSTRUCTION RX1_Done2_0;
          DJNZ_INSTRUCTION RX1_Done3_0;
          MOV32_INSTRUCTION RX1_Buffer_0;
          MOV32_INSTRUCTION RX1_Reload_0;
          BR_INSTRUCTION RX1_Detect_0;
          MOV32_INSTRUCTION RX1_Low_0;
          MOV32_INSTRUCTION RX1_Low2_0;
          MOV32_INSTRUCTION RX1_Cont_0;
          DJNZ_INSTRUCTION TX2_Start_0;
          DJNZ_INSTRUCTION TX2_PrdCtr_0;
          DJNZ_INSTRUCTION TX2_BitCtr_0;
          SHFT_INSTRUCTION TX2_Shift_0;
          MOV32_INSTRUCTION TX2_LoadA_0;
          BR_INSTRUCTION TX2_CheckZ_0;
          MCMP_INSTRUCTION TX2_High_0;
          MCMP_INSTRUCTION TX2_Low_0;
          MOV32_INSTRUCTION TX2_Reload_0;
          MOV32_INSTRUCTION TX2_Cont_0;
          DJNZ_INSTRUCTION RX2_Start_0;
          DJNZ_INSTRUCTION RX2_PrdCtr_0;
          SHFT_INSTRUCTION RX2_Shift_0;
          BR_INSTRUCTION RX2_Check_0;
          ADCNST_INSTRUCTION RX2_High_0;
          DJNZ_INSTRUCTION RX2_BitCtr_0;
          MOV32_INSTRUCTION RX2_Done_0;
          MOV32_INSTRUCTION RX2_Done2_0;
          DJNZ_INSTRUCTION RX2_Done3_0;
          MOV32_INSTRUCTION RX2_Buffer_0;
          MOV32_INSTRUCTION RX2_Reload_0;
          BR_INSTRUCTION RX2_Detect_0;
          MOV32_INSTRUCTION RX2_Low_0;
          MOV32_INSTRUCTION RX2_Low2_0;
          MOV32_INSTRUCTION RX2_Cont_0;
          BR_INSTRUCTION RX2_End_0;
          DJNZ_INSTRUCTION TimerHet_Check1_0;
          MOV32_INSTRUCTION TimerHet_Fake_0;
          MOV32_INSTRUCTION TimerHet_Vence1_0;
          ADM32_INSTRUCTION TimerHet_IncB_0;
          MOV32_INSTRUCTION TimerHet_StoreFake_0;
          ECMP_INSTRUCTION TimerHet_Check2_0;
          MOV32_INSTRUCTION TimerHet_ResetB_0;
          MOV32_INSTRUCTION TimerHet_StoreFake2_0;
          BR_INSTRUCTION TimerHet_FinalBack_0;
          } Program0_ST;

          } HETPROGRAM0_UN;

          extern volatile HETPROGRAM0_UN e_HETPROGRAM0_UN;

          extern const HET_MEMORY HET_INIT0_PST[60];


          Related to interrupts we have (appart from configuring it):
          void HET1_irq_handler() {
          DWORD dataTemp;

          switch((HETOFF1 & 0xff) - 1) {
          case 18: // RX USART_HET1
          dataTemp = HET_RX1_Buffer_0.memory.data_word >> 16;
          HET_RX1_Buffer_0.memory.data_word = 0; // Clear RX buffer

          Usart_ByteReceived(USART_HET1,(BYTE)dataTemp);

          break;
          case 11: // RX USART_HET2
          dataTemp = HET_RX2_Buffer_0.memory.data_word >> 16;
          HET_RX2_Buffer_0.memory.data_word = 0; // Clear RX buffer

          Usart_ByteReceived(USART_HET2,(BYTE)dataTemp);

          break;
          case 2: // TX USART_HET1
          case 27: // TX USART_HET2
          break;
          case 24: // Timer HET
          GIODOUTA ^= 0x80; // only for testing

          break;
          }
          }


          From outside when you want a timestamp you have:
          UINT32 myGlobalSeconds;

          UINT64 getTimestamp() {
          UINT64 newTimestamp;

          newTimestamp = 1000 * ((UINT64)myGlobalSeconds) +
          (UINT64)HET_TimerHet_Fake_0.mov32.data;

          return newTimestamp;
          }


          That should be this way, according to std_het.h:

          /*---------------------------------------------*/
          /* MOV32 INSTRUCTION */
          /*---------------------------------------------*/
          typedef volatile struct MOV32_format
          {
          unsigned int : 11 ;
          unsigned int brk : 1 ;
          unsigned int next_program_address : 8 ;
          unsigned int op_code : 4 ;
          unsigned int remote_address : 8 ;

          unsigned int : 10 ;
          unsigned int auto_read_clear : 1 ;
          unsigned int : 14 ;
          unsigned int init_flag : 1 ;
          unsigned int move_type : 3 ;
          unsigned int t_register_select : 1 ;
          unsigned int ab_register_select : 1 ;
          unsigned int : 1 ;

          unsigned int : 7 ;
          unsigned int data : 25 ;

          /*TCJ*/
          /*unsigned int hr_data : 5 ;*/

          } MOV32_FIELDS ;


          typedef volatile union
          {
          MOV32_FIELDS mov32 ;
          HET_MEMORY memory ;
          } MOV32_INSTRUCTION;

          Regards
        Your message has been successfully submitted and would be delivered to recipients shortly.