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.
Solved! Go to Solution.
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.
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 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.
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?