Skip to content

Use Library with multiple AD9833 circuits #5

Open

Description

@virtq

Hi,
I'm trying to get this library working with multiple AD9833 circuits connected on the same SPI-bus.
So I've added the following;
AD9833.cpp

void AD9833 :: SetFNCPin ( uint8_t FNCpin ) {
	this->FNCpin = FNCpin;
}

AD9833.h

// Change FNCPin
void SetFNCPin ( uint8_t FNCpin );

However it doesn't really seem to work properly. One of them sometimes get the command that was supposed for the other one, but could perhaps be related to an electrical issue. I just wonder if there's anything more I should do to the library?

Activity

  1. Billwilliams1952 commented on Feb 9, 2018

    @Billwilliams1952
    Owner
  2. Billwilliams1952 commented on Feb 9, 2018

    @Billwilliams1952
    Owner
  3. virtq commented on Feb 12, 2018

    @virtq
    Author

    Thank you for your answer. I actually started out creating an additional instance but since the SPI.begin() is executed within the AD9833.begin() function, I thought it would not be correct to run that function for every instance, since the bus was already started. But perhaps that would be the only problem and I can try to only run that function for the first instance instead.

  4. Billwilliams1952 commented on Feb 13, 2018

    @Billwilliams1952
    Owner
  5. virtq commented on Feb 13, 2018

    @virtq
    Author

    I was finally able to sort it out. It turned out that it was some kind of electrical issue with the IC, so I had to replace it. Now it works as expected with both code solutions, but I will stick to yours, with creating different instances, because it would probably make the code easier to read.

    However, regarding the code library, should perhaps SPI.begin() be moved out from the library completely? Then it would be logically to call Begin() for every instance as you also call the Reset function in there. Alternatively you could have some other function for that in the library, but I don't know what would be the best solution.

  6. Billwilliams1952 commented on Feb 13, 2018

    @Billwilliams1952
    Owner
  7. Billwilliams1952 commented on Feb 21, 2018

    @Billwilliams1952
    Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions