Go Down

Topic: Class (Read 148 times) previous topic - next topic

Cor2

Hello

I have created a sketch to control a AD9851 DDS, together with a AD8307 which is measuring the output of the DDS as an analogue voltage which is read by the Arduino Uno. I am using a lcd to show the measurement result in two rows or lines.

Below is a part of that sketch.





#include <LiquidCrystal.h>

 #define AD9851_FQ_UD_PIN      9
 #define AD9851_RESET_PIN      10
// And MOSI=11, SCK=13

// class MyAD9851 : public AD9851<AD9851_RESET_PIN, AD9851_FQ_UD_PIN> {};
// MyAD9851 dds;
// unsigned long next_update;

void setup() {
  Serial.begin(57600);
//    lcd.begin(16,2);                         /*  Aangeven dat LCD 2 rows van 16 characters bevat */
//    while (!Serial && (millis() <= 1000));
//    next_update = millis();
   lcd.begin(16, 2);
// Print a message to the LCD.
   lcd.setCursor(0,0);
   lcd.print("hello1, world!");
   lcd.setCursor(0,1);
   lcd.print("hello2, world!");
}

In this example I am only showing "Hello1, world!" and "Hello2, world!" etc below each others.


That is working well.
I read on the lcd:
 
hello1, world!
hello2, world!



If I remove the //  from the first  line: ("class etc)
 class MyAD9851 : public AD9851<AD9851_RESET_PIN, AD9851_FQ_UD_PIN> {};
//  MyAD9851 dds;
// unsigned long next_update;

then I still read on the lcd:
 
hello1, world!
hello2, world!


If I remove also the //  from the 2nd line ("MyAD9851 etc)
 class MyAD9851 : public AD9851<AD9851_RESET_PIN, AD9851_FQ_UD_PIN> {};
 MyAD9851 dds;
// unsigned long next_update;

then the lcd shows only on the top row: "32(█ █ █  hello1, w"     which are 16 chars incl. a space
where █ is a black square of 5x8 dots.


After some investigation I can not find why this happens

The AD9851 DDS is always working correctly with the whole sketch (exept now of course in this example
to find out when it is going wrong with the lcd).

How can I manage it? Any idea?

Thank you in advance for your help.


 


shooter

elk ding wat je aan een arduino koppelt heeft een default set, dus ook al zeg je niet alles, dan kan het toch zijn dat er iets leesbaars komt. zoiets als aBRaCaDaBRa.
paul deelen
shooter@home.nl
making controls with codesys PLC and arduino

MAS3

Je geeft niet alle informatie die van belang is.

Ik kan ook delen van mijn antwoord weg laten.
Dan ga je dus wel wat informatie missen.
.
En dat zou je op de volgende wijze kunnen oplossen:
.
Maar of het echt zal helpen ?
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

Go Up