This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Generate a clock to ads1254

Other Parts Discussed in Thread: ADS1254

Hi everybody

I need to generate a clock signal to the ADS1254 but I don't know how to do it.  if I wanna programmable frequency from 10 Hz to 10 kHz how can i do it?

the cut frequency of the digital filter is  in function of the clock frequency. so I need to set it. The ADS1254 is going to be under SPI communication with pic18f4550.

 the clock frequency most be fixed afther to know wath is the highest frequency of the  analog signal

I hope that someone can helpme !!!! best regards

  • Hello Jose,

    For creating an adjustable clock output from you pic, you would have to use the timers and create a PWM. Follow this popular example http://sjriek.nl/wp-content/uploads/18f4550_pwm_example.pdf

    If you are having trouble with it, then you can download the PIC 18F user manual and visit one of the PIC forums with you specific questions.

    Now for the ADS1254, it doesn't specifically say it uses SPI for communication.  It seems to have its own simple protocol.  The details for setting it up can be found on page 11 of the data sheet.

    Does this post look familiare? http://www.ccsinfo.com/forum/viewtopic.php?t=50182

    Thanks,

  • Hi Greenja!!!

    Tanks for you reply

    I'm agree the PWM it's the best choice but I had some doubts like If this PWM affects the data transfer rate of USB or isn't it?.

    it's right JEJE that post it's mine I had doubts about SCLK to receive the data from de ADC but watching the figure 14 page 13 of the data sheet I need wait 13 cycles of CLK (from PWM) before to read it and how to set the SPI software to receive the 24 bits word, but  using the preprocessor directive #SPI  it's ready to receive it and then send it to USB,

    And I'm agree the ADS1254 doesn't  have SPI communication but the data can be received whit the pin (Data input) of the pic. I'm going to use SPI interruption to receive the data  because the ADS1254 does no have the SS( Slave Select) pin to enable the ADC to send the data like a custom SPI communication.

      what do you think Greenja? is it this right ?

  • There are many possible ways to do it.  If you feel comfortable trying to manipulate the SPI, then use it.

    Personally this is what I would do:

    1. Set the timer to perform the PWM clock output with the interrupt.

    2. Set a flag to read the ADC.

    3. Set a counter for counting the number of clock cycles

    4. In your main loop monitor the the DOUT when it goes from high to low you set a flag and the read ADC flag is set, then you start the counter in the PWM interrupt

    5. Inside the interrupt you clear the DOUT flag and advance a counter by one indicating you are in DRDY mode

    6. When the counter reaches 3 then you know that you are in DOUT mode.

    7. Uses the same PWM ISR to toggle the SCLK and read in the the data while counting the number of clocks

    But that's just me, you can choose not to follow the timing routine and the description as laid out in the data sheet and play with the SPI if you like.

    Good Luck!

  • Hi Greenja  I've been thinking about SPI interrupt and then wait the time to read the data, but it's imprecise.

    with the posibility to generate a clock with PWM  Like you say I can count the cycles and then receive the data.  but I have a doubt, if I use the SPI to read the data into the PWM interrupt that could be a way to read the data.... or is there other way to receive the data?,

    Tanks so much for your recommendation definitely it's a good way to achieve my goal.

    best regards!!!!!