AD9850 DDS with Hitachi compatable LCD (16x2) and a rotary encoder

Hi Geoff,
Once again thanks for the prompt response. I think by LCD you mean the LCD display I am trying to use with Arduino. As I have mentioned in my original post above I was not able to load the program to the Arduino IDE so there is no question of reading the LCD . What ever error messages I got during the loading process I have included in the above post . I think what you were mentioning in the last sentence is this . You may kindly let me know.

With regards,
(nivar)

Hi nivar

I don't understand by what you mean by "it is not turning brown". Can you explain this?

I can load your code with the change to the library name on an Arduino here without any errors. What error are you seeing now?

Geoff

Hi Geoff,
Thanks for the reply. I am glad to know you can load the code without any errors. By "turning brown " what I meant was that if the library is active in the sketch it turns brown otherwise it remains black. In my case it remains as it is without any color change and the sketch is not able to load . I again tried to load it and again get the same 3 error messages (reproduced below again ). I request you to kindly reproduce the code you successfully loaded.

Step 11.error - 'Encoder' does not name a type

Step 40 in function 'void_vector_5()';
error - 'r' was not declared in this scope

Step 42 error - 'DIR_CW' was not declared in this scope
code"

Once again thanks for your time .

with regards,
(nivar)

Just change the one line I quoted in my first post and it loads without error.

Cheers ! Geoff

Hi Geoff,
Nice to see your reply so fast. I think you want me to change the "rotary" to "Rotary" as the only change in my program? I have done it many times without luck. I think I have to load it on another computer and see ? Thanks for your time.

With regards,
(nivar)

Hi,

If that change doesn't solve it, do both the examples for the Rotary library work? If not, it's likely you've not got your Rotary library installed correctly.

I just copied your code from the first post, changed rotary.h to Rotary.h and compiled. Screen cap attached.

Geoff

Hi Geoff,
Further to your last posting , I tried to edit the "Rotary" files but I am not fully successful in it. I edited the "Rotary.h" and "Rotary.cpp" files and everything appears to be fine with it. But when I go back to my program and try to run it, still same old error messages flashes and I am not able to load it. So what I request you is if possible please tell me how to do the editing of files in the Arduino IDE ? Thanks in advance for your time.

With regards,
(nivar)

Hi nivar

There is no need to edit the library files at all. If you edit your own program and change the include line to have a capitalised R in Rotary.h and it is not working, your Arduino IDE is not seeing the Rotary libary to use when compiling.

To test this, load one of the rotary library examples (from the menu, take File / Examples / Rotary / Polling) and compile that. If it fails to compile you know your Rotary library is not correctly installed*. To check, take the menu option Sketch / Import Library and you should see Rotary in the list. Unfortunately if, like me, you have a stack of libraries installed, there is no scrollbar on this menu and you may not see the full list. With a new installation of the Arduino IDE you should see it though. If it's not there, you need to copy the Rotary library directory under your Arduino libraries folder. If you're using Windows this will most likely be C:\Users<your user name>\Documents\Arduino\libraries. After you copy the library folder in there, under windows you'll have a new folder C:\Users<your user name>\Documents\Arduino\libraries\Rotary containing an examples subfolder, keywords.txt, README.md, Rotary.cpp & Rotary.h

Exit all Arduino IDE windows and restart the IDE (it indexes libaries on startup).

Repeat the tests above and it should now work.

All the best,
Geoff

  • in fact if the library isn't installed, these examples won't exist in the menu !!

Hi Geoff,
Since seeing your last post I was trying to install the "Rotary" code in the "sketch" folder of the IDE without much success!. As per your post I opened C/users/my name/documents/arduino/libraries/Rotary . I can see all the files mentioned by you in the "Rotary". But when I opened the IDE / "sketch/import library " I can see the name "Rotary" in it but when I click it open ,it is totally empty (only the name is there). All my efforts to install it properly is yet to succeed. I am wondering whether you can post your "Rotary" code as seen in your IDE sketch library. Hope I am not bothering you too much.
With regards,
(nivar)

Hi,

No problems at all. Did you download the Rotary library files from this github repository? That's where all the files I listed above came from.

Cheers !
Geoff

Yes same file I tried . But still the problem persists.

(nivar)

nivar:
As per your post I opened C/users/my name/documents/arduino/libraries/Rotary . I can see all the files mentioned by you in the "Rotary".

Good.

nivar:
But when I opened the IDE / "sketch/import library " I can see the name "Rotary" in it but when I click it open ,it is totally empty (only the name is there).

That's as it should be. You don't get to see the code, but at the time of compile, the IDE will load that code for you so the functionality is available to your code (not copied into it, but referred/linked to at compile time).

nivar:
All my efforts to install it properly is yet to succeed. I am wondering whether you can post your "Rotary" code as seen in your IDE sketch library.

I'm sorry but I don't understand your question here. I have no rotary code. Here is the process I followed: I simply downloaded and copied the library files to the correct directory, started the IDE, pasted your code from the first post, changed the lower case r in rotary.h to a capital R in Rotary.h then pressed compile...and it does.

I can't see what it is that's broken on your side, but hopefully from above you'll see something :slight_smile:

Cheers !
Geoff

Hi Geoff,
At last I managed to compile the code. Thanks to your cool commonsense advice. I installed the Rotary code from Github in the libraries folder and again reopened the IDE and replaced "rotary" by Rotary. Now it works well in the AD9851 sketch and the ATMega328 chip with the code is controlling the AD9850 to perform as a the HF VFO is working as per the design. Thanks again for all your efforts and time. Hope we can keep in touch in future.
By any chance are you a Ham? I am a US Ham with call sign AB9XC and my name is Pravinkumar Anandan . You can reach me at ab9xc@yahoo.com any time.

With best regards,
(Dr Pravinkumar)

That's just the best news! Glad to have you up and running finally. And apologies it feels I should have got you to this point days ago :astonished:

nivar:
Thanks again for all your efforts and time. Hope we can keep in touch in future.

Any time. And sorry, but it's a no on the ham question. I'm far too busy with this Arduino shenanigans to have a 2nd hobby :slight_smile:

All the best, Geoff

Hi Geoff,
It is not your fault at all and I have to salute you for your time and patience ,I am sorry I am so bad in computer coding such that I failed to understand what other people's instructions. Anyway I am happy the problem is solved. The more important thing is that you made me understand how to add a library to the sketch from scratch. This is great as far I am concerned.For me learning is more important than just the immediate problem solving .
I understand you are an expert in coding etc. If that is the case I would like to get some guidance from you regarding how to learn the coding from scratch. I know there are any number of online articles ,books and other literature available. That is the problem . I am not sure where to start what is the most optimum way to learn the coding without spending huge time on it . Whenever time permits I request your inputs towards this.
Once again thanks for you time and efforts and hope to keep in touch with you.

With regards,
(nivar)
nivar_p@yahoo.co.in

Hi

If it's just coding for Arduino you're after, I suggest just run with Arduino specific tutorials and you'll cut out all the (important, but not directly relevant) other aspects of coding that make up the rest of the 6 year degree course :slight_smile:

If you're up for some video tutorials, these by Jeremy Blum are very good, and you can keep coming back to them for reference. In the process some useful electronics interfacing information is also gained. Also the tutorial series at the Adafruit learning system are very good, and expand into some decent projects.

Cheers !
Geoff

Hi Geoff,
Thanks for the info on Arduino learning materials. I find the Jeremy Blum blog very informative and useful . Ultimately what I want is the ability to write independent C/Cpp programs at least into various Atmega and PIC processors as per different project requirements. I don't want to spend too much of time for that . What I require is a good starting point from which I can build up my code writing skills. Once again thanks for your time.

With regards,
(nivar)

I've only just found out about these little DDS units, acquired one, came here, found the OP's code near the beginning of the thread and thought it would be ideal just to get the unit up and running for a first test. Despite doing all the obvious things (such as changing 'rotary' to 'Rotary') I had exactly the same problems down to the same error messages as the OP originally did when trying to import the 'Rotary' library, despite having been to Github on the link earlier in the thread to download it.

After running around in circles like the OP I finally realised what I had done wrong: On Github, I just right-clicked on each of the individual files listed and did a 'save as' to the Arduino/libraries/Rotary folder that I had already created for the purpose. A long time later it finally occurred to me to look at the files I had saved and they turned out to be web pages :slight_smile:

So, back to the Github page, looked more carefully, found the download button for the single .zip file of the 'Rotary' library, downloaded it, extracted it into Arduino/libraries/Rotary (allowing it to overwrite all the earlier bad files), exited from the Arduino IDE and went back in, and was at last able to compile the OP's original code.

Incidentally, my thanks to the OP ('Nivar') for that code, which sped things up a lot for me - I didn't have an encoder so I modified it to use some extra switches: Increase frequency by step size / Decrease frequency by step size, Increment step size (as before) and I also added a Decrement step size button as well, for convenience.

I have to say these little DDS units are incredibly powerful for the price. Although originally for RF use, I took mine all the way down to the low audio frequency range and it could just as easily be used to make a precision audio sine wave generator.

Only one drawback with them, and that is that the current consumption is quite high - in fact, the crystal oscillator and chip both run quite warm, with the module taking around 100mA from a 5V supply, which means they wouldn't really be viable in handheld battery powered equipment.

hi i dont know if this helps and please forgive if im saying same thing as some one else has but im new to the ardunio scene and i tired to compile and run the code here and couldnt then i checked i had all the files needed in libaries and made sure and once i did it compiled

hope it helps