I need to be able to generate Read or Write clocks for locking the data into my DDS buffer to get the data to the DDS. When all my data is completely buffered I need to send an Update clock which transfers the data into the DDS Registers. I can use the update clock of the DDS be setting it external by changing the count down word in the DDS. But I need to generate a 10 micro second read or writ pulse to latch the data into the buffers. The 2560 has a RD option on pin D40 and a Write option on D41.
So operation to store the address and the data into the buffer is as follows
setAddress.
setData.
pulse WR pin D41 PG0.
Data is in Buffer.
Repeat 1) through 4) for all data that has to be transferred to the buffers.
Pulse Update Clock to force all data into their respective registers.
The buffers stay as is so to read back for verification of setting the registers
setAddress
pulse RD pin D40 PG1
getData
as necessary for all addresses to get the Data for all the registers.
What I need is a pin that has the 2560 AVR MCU clock on it that I can use as the /WR and RD signal.
How do I do that in Arduino? or;
for that matter in C++?
You are simply setting some pins on Arduino Mega which are connected to equivalent pins on an IoT DDS board, then need to send a clock signal to tell that IoT DDS board that the data is ready ?
If I have understood it correctly, then what about:
digitalWrite( pinX , HIGH ) ;
delayMicrosconds( 4 ) ; // digitalWrite() takes anyway a few microseconds
digitalWrite( pinX , LOW ) ;
where pinX is a free GPIO pin which you have previously defined as an output pin.
Yep, reading between the lines you seem to be under the mistaken impression that this pin needs to be THE 2560 AVR MCU clock line.
It doesn’t. It’s just a completely separate clock line dedicated to the DDS and under your programs control. As such it can be any digital output capable pin on the board.
Also 10us is probably the specified minimum, almost certain that it doesn’t have to be exactly 10us. But as you have not linked to any documentation on what DDS you are using....