VT91:
I need to make a generator that outputs two waveforms with some frequency and relationships to each other.
Elaborate more on the "relationship" these waveforms need to have with each other. Do they need to be in a certain phase relationship with each other? Will they be the same or different frequencies?
holmes4:
You use SPI as that's what this chip supports. See playground.
Mark
Playground is where I began my research. I didn't find anything. Google didn't I mean.
Maybe the same frequency, maybe different.
Lets say I want to obtain a frequency of 9KHz and 3Khz in such way that the crest of one wave is a certaing number of degrees off from another wave's crest. Or moving two sources of the same frequency a number of degrees off each other.
A problem I may face here is that each DDS module has it's own clock source, if I am using a DDS module.
Communication from the Arduino to the DDS chips or something else?.
If it's communication via SPI already provides a means to do this. There are 4 lines, Master Out Slave In (MOSI) Master In Slave Out (MISO) clock these 3 form a bus to each of the SPI slave devices and then there is the Slave Select (SS) aka CS (Chip Select)
I want to add all the controls to my microcontroller-based system using two daisy-chained shift-in registers:
I am using Arduino Nano and it has a DDS connected to:
SS -(physical pin14)-(digital pin10)
MOSI-(physical pin15)-(digital pin11)
SCK -(physical pin13)-(digital pin17)
CD 4021 shift-in registers use something similar to serial communication.
Should I connect them to serial pins, the way my DDS is connected an switch between devices periodically, or should I connect my pins for shift-in registers somewhere else?
I am using shift-in registers to wire 4 rotary encoders to the microcontroller.
They have to be checked periodically to see if there was a change in the position.
There may be a button on my device that will tell the program "go check the knobs as there is going to be user input"
I will write a tutorial when all my hardware and software will work and nothing will burn.
Are these absolute or incremental encoders? Because I would think that trying to handle 4 incrementals via a shift reg would be an issue, and if you only read them when a button is pressed can you determine the direction they were turned?
How are those two modules synched in this circuit?
What keeps clocks from runningat slightly different speeds?
I gather you are referring to the fact that the CLK pins on both chips are note connected? They are driven by the Arduino so it's up to you the keep them the same. That said if you want them to be identical just join them together.
You connect most shift registers to either SPI or use any pins and shiftIn().
SPI works by having the Master select the slave with which it wishes to take. Think about it as a class room. On teacher (the master) lots of slaves (opps I mean kids). Teacher points at one and says "You Smith, what is ..........." and Smith answser ......
For SPI we have the SS pin(s) - this allows us to select (Teacher points at .. Smith) the unit that will reply. No need for any kind of shift reg,.
I am running in shifts independently of DDS. Should I use MOSI and SCK for in shifts and use SS pins to choose between two or should I use any user-determined digital pins to read inputs of in-shifts?
My program will scan encoders for a period of time after change has been detected.
I am just wondering if I need to use SPI for in-shifts. I should pick a designated SS pin and wire it to Latch Pin ?
Should I use MISO since I am dealing with an input from in-shifts VS output to DDS?
Or can I just connect my two in-shift ICs to any 3 digital pins as it is shown in in-shift tutorial?
//define where your pins are
int latchPin = 8;
int dataPin = 9;
int clockPin = 7;
Should I use MOSI and SCK for in shifts and use SS pins to choose between two or should I use any user-determined digital pins to read inputs of in-shifts?
You can use SPI or shiftIn/Out, it's up to you. SPI will be a lot faster.
My program will scan encoders for a period of time after change has been detected.
Sounds a bit suss to me, but if you're happy it will work...
Should I use MOSI and SCK for in shifts and use SS pins to choose between two or should I use any user-determined digital pins to read inputs of in-shifts?
You can use SPI or shiftIn/Out, it's up to you. SPI will be a lot faster.
My program will scan encoders for a period of time after change has been detected.
Sounds a bit suss to me, but if you're happy it will work...
Rob
MISO for input to microcontroller, MOSI for output from microcontroller?
Did I match the tutorial CD4021B pins with the microcontroller SPI pins correctly?
If I want information to go in and out of the microcontroller, I use MOSI and MISO or are they interchangeable in some cases?
This is not related to current project.
I just had a look at the tutorial, it seems very clear but it's not about using SPI, it's about using shiftIn(). So select whatever pins you like for clock/latch/dataPin.
That said, after a quick look at the 4021 data sheet I think MISO would go to pin 3 (Q8), SCK would go to pin 10, and your CS (not SS) would go to pin 9.