5 Replies Latest reply on Nov 23, 2016 4:55 AM by JoMe_264151

    fast access to control_reg




      I am using a control_reg to control two stepper motors. The motors are controlled by two different functions.


      Currently I do


      Control_Reg_Motors_Write(Control_Reg_Motors_Read() | step_bit);




      Control_Reg_Motors_Write(Control_Reg_Motors_Read() & ~step_bit);


      to set and clear bits.


      Isn´t this slow? Would it be better to use a copy of the control register content that is updated in both functions so that it is not needed to read the control_reg?


      control_reg_copy |= step_bit;