1 Reply Latest reply on Dec 28, 2017 1:28 AM by hima

    stepper motor

    jaseelaka945_2746661

      Hi Sir/Madam,

       

             As a part of my project, I am dealing with the speed control of stepper motor using  TMC260_pa& PSoC 3 controller
      While using TMC driver, need to write a function ReadWriteSPI(),can you please help me.

       

       

      I got ReadWriteSPI() function of AVR

       

       

      unsigned char ReadWriteSPI(unsigned char Data)
      {
      SPDR=Data;
      while(!(SPSR & 0x80));
      return SPDR;
      }

      It first writes the data that is to be send to the SPI Data Register (one byte). Then it waits until sending and receiving the data is done. Finally it returns the data that has been received by the microcontroller (which in the AVR can be found in the same register).

      Thank you!

        • 1. Re: stepper motor
          hima

          Please have a look at the SPI code examples available with PSoC Creator. The API's for writing data and waiting for the data to be sent will be explained in the example project. Also have a look at the SPI component datasheet.

           

          Thanks,

          Hima