11-14-2012 06:30 AM
Hello everybody,
I started to work in an application that uses labview to communicate with arduino. The arduino board will be connected to several AD5204 digital potentiometers. This potentiometers are connected in serie and I want to use "Daisy Chaining" to program them.
My first idea was using SPI communication blocks of Arduino to send the information but, the problem is that I want to use "Daisy Chaining" and every potentiomenter needs 11 bits (address+data) to be programmed. As I saw using SPI communication I can send only messages of 8 bits and not of 11 bits. That will provoke a wrong receival of the information by the potentiometers, because of the "Daisy Chaining".
That's why I tried another thing. I tried to generate the clock, the data and the chip select signals directly without using SPI blocks, using some loops and common blocks to write a digital pin in Arduino. In that way I am able to send the information I need, but, the problem now is that the clock signal is only 18Hz. Is there a way to generate a clock signal that goes out through a determined pin of the Arduino of at least 100KHz?
If somebody knows that I would be very happy to receive and answer. Then I will be able to finish my application.
Thanks!
Solved! Go to Solution.
11-14-2012 06:20 PM
Attached is sketch from the Arduino Cookbook by Mchael Margolis. The sketch CH18r5.imo is a pulse generator. I tested it and it worked at 1 megaHz. I don't know what the maximum frequemcy is.
To use it copy TimerOne.h, TimerOne.cpp and keywords.txt to a folder named TimerOne. Then moved the folder to the Arduino libraries folder. Next move ch18r5.imo to a folder named ch18r5 and movee the folder to your collection of Arduino sketches. Next compile and dowmload the sketch to you Arduino board.
The sketch is designed to be controlled by Arduiino's serial monitor. Use the command valuef to set the frequency. For example 100000f generates a 100kHz square wave and 1000000f generates a 1 megaHz square wave.
hrh1818
11-15-2012 02:00 AM
Thanks hrh1818 for your answer.
I was trying the software and it works great. The problem is that this is a program to generate a clock directly from Arduino and controlling the frequency with the serial monitor of it.
What I would like is to be able to generate a clock around 100KHz on an Arduino digital pin, and send some information of 11 bits "packets" through another pin of Arduino, controlling/generating all this from Labview.
With the program that you sent me I can not send or control any information from Labview.
I hope somebody has a solution for this.
Thanks!
11-15-2012 04:18 AM
11-21-2012 01:59 AM
Hello,
Thanks Albert.Geven, that is a good idea.
The last days I was thinking on this problem and I am almost sure that I found a "easier" solution. The idea is to adapt the 11 bit "packets" into 8 bit messages.
For example, if I have 16 chips, we need to send 16 "packets" of 11 bits, that's 704bits. If I divide this 704bits into messages of 8 bits I will have to send 22 messages. If the number of 8bits messages is not a integer, we will have to fill the last message with as much 0 as necessary.
I still have to test this on the real chips, but I hope this will work.
Thanks,
09-02-2013 03:55 AM
Hi dp18
Im working on a problem very similar to yours. I want to use labview to change PID parameters by changing the resistors sizes. Im planning to use three ISL22414 with SPI and therefore also need daisy chaining. Can I get you to send me the code you used for it?
Best regards
Jens
09-03-2013 07:36 AM
Hello kuhr,
If you write me your email I'll send you the code.
Best regards,
09-03-2013 09:18 AM
Thanks!
02-24-2014 06:44 AM
hi dp18,
please send me the procedure to generate frequency in khz with sample code using arduino mega 2560
my email id: regs1613@gmail.com
thank you.
07-27-2017 01:16 AM
i require 10 khz square output at pwm pin