Jump to content
  • 0

Use AD2 Logic Analyser on Arduino LCD 16x2


JohnnyG

Question

I've been trying to learn how to use the AD2 Logic Analyser.  I got it to work with Serial.println("Hello world!").  I've learned that the Base: selection is critical to capturing the data.  If you get it wrong, you get Framing Errors and the wrong characters.

Now I am trying to use the Logic Analyser with an Arduino Uno running a clock/date ino that displays on a 16x2 LCD.  I do not have the LCD connected, but when I wrote the program it was and it worked perfectly.  I have also tried an ino that displays Hello World on the top line of the LCD.

My connection is described below.  I have tried several different setups in the Logic section of Waveforms and I am not able to capture ascii data.  I've tried spi, spi mosi/miso, UART, and a few others.  I have also tried to just add Signal lines to the connections below.  With that, I am able to see the waveforms, but not the data.

Is it possible to read the data with the AD2 and Waveform?

The ino notes say to connect the Arduino to the LCD as follows.  The number after the dash is the AD2 logic connection wire.  I.E. I have a jumper from Arduino Digital pin 12 to AD2 Logic wire 0 and so on.  As the LCD is not physically connected. some of the connections in the ino were not used (as noted).
 * LCD RS pin to digital pin 12 - 0
 * LCD Enable pin to digital pin 11 - 1
 * LCD D4 pin to digital pin 5 - 2
 * LCD D5 pin to digital pin 4 - 3
 * LCD D6 pin to digital pin 3 - 4
 * LCD D7 pin to digital pin 2 - 5
 * LCD R/W pin to ground - (Not Used)
 * LCD VSS pin to ground - (Not Used)
 * LCD VCC pin to 5V - (Not Used)
I have a jumper from the Android ground to the AD2 Ground.

Thanks

JohnnyG

 

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

Thanks, I tried bus... I guess I did not have the setting right.  I'll look at the datasheet and see if I can figure it out.

While the rest of the world is going crazy because they are stuck at home I got the AD2 to keep me sane...   

-G

Link to comment
Share on other sites

@attila I am not sure if I got it setup right or not but it seems to follow along with the manual.  I get a lot of control but never data, am I expecting too much?

The ino is simple.

#include <LiquidCrystal.h>
// RS - on Arduino pin 12 AD2 pin 0
// RW - on Arduino pin 11 AD2 pin 1
// EN - on Arduino pin 10 AD2 pin 2
// DP4 - on Arduino pin 9 AD2 pin 3
// DP5 - on Arduino pin 8 AD2 pin 4
// DP6 - on Arduino pin 7 AD2 pin 5
// DP7 - on Arduino pin 6 AD2 pin 6

LiquidCrystal lcd(12, 11, 10, 9, 8, 7, 6);

void setup() {
lcd.begin(16,2);

}

void loop() {
lcd.print("Analog Discovery 2");
//delay(1);

lcd.setCursor(2,1);
lcd.print("Learn, ");
//delay(1);

lcd.clear();
lcd.print("Experiment, ");
//delay(1);

lcd.setCursor(2,1);
lcd.print("Work!");
//delay(1);

lcd.clear();

}

 

 

Thanks!

JohnnyG

 

 

 

Screen Shot 2020-05-12 at 10.38.07 PM.png

Link to comment
Share on other sites

Hi @JohnnyG,

I guess I am a little confused, are you not seeing data in your screenshot on the Analog Discovery 2 pins 3 through 6?

There is also a lot of control (and delays) associated with the LiquidCrystal library as well. The begin function has over 50 milliseconds of delay built into it.

Otherwise, it seems like you are attempting to use the parallel LCD in 4-bit mode (based on the number of pins which are used in the construction of the LiquidCrystal object) which expects the 4 MSBs to be transferred followed by the 4 LSBs. I do not think there is a way to readily have the WaveForms software analyze two separate bytes (or nibbles as it were) and concatenate them within the Bus line on the Logic Analyzer. I'm also unable to tell if the pins for the data are connected correctly since the built-in Arduino example for the LiquidCrystal library and the .cpp library file itself disagree where the MSBs are located. The datasheet for the parallel LCD present on the PmodCLP says that DP7 (MSB) through DP4 (LSB of the nibble) should be used in 4 bit mode. The order of your pins look correct, but I'm also having trouble readily identifying any commands or characters with the data.

Your Enable pin also appears to be attached to the Analog Discovery 2 pin 1 rather than pin 2; you can tell because of the enable pulse that occurs after every data write in the Arduino LiquidCrystal library is occurring on pin 1.

Thanks,
JColvin

Link to comment
Share on other sites

On 5/11/2020 at 5:01 AM, attila said:

Hi @JohnnyG

Your LCD uses parallel protocol. For such in Logic Analyzer you should use Bus.
See the datasheet of this for the meaning of the registers.

Thanks JColvin,

I was going off of the comment above.

I am confused too...LOL  When I did the same experiment using serial.print, I was able to see the data (the text string) in the data display of WaveForms.  

In this experiment, to the LCD, I have "Analog Discovery 2, Learn, Experiment, Work!" as the data.  I do not see any data... just control.  

The original setup was RS, EN, DP4, etc.  That was not working.  I noticed in the CPP that RW is in the mix too (as it is above).  So I added RW.  I'll change it back and see what changes.

You said. "I do not think there is a way to readily have the WaveForms software analyze two separate bytes (or nibbles as it were)"  So in this mode of operation (4 pin), I will never see the data?  That is really all that I am trying to do.  Should I give up and move on?

JohnnyG

Link to comment
Share on other sites

1 hour ago, JColvin said:

Hi @JohnnyG,

Your Enable pin also appears to be attached to the Analog Discovery 2 pin 1 rather than pin 2; you can tell because of the enable pulse that occurs after every data write in the Arduino LiquidCrystal library is occurring on pin 1.

Thanks,
JColvin

In one of the test, I used Clock and Enable in the bus settings.  That did not work. In the configuration above, 0,1 and 2 are just Signal.  Does it matter which wire they are plugged into?

Link to comment
Share on other sites

54 minutes ago, attila said:

Hi @JohnnyG

I'm not familiar with the LCD.
Please see the datasheet of this about the expected protocol, commands, registers...

LCDs expects the 4 MSBs to be transferred followed by the 4 LSBs.  Can the AD2 support this type of communication?  The AD2 would have to store the 4 MSBs and concatenate them with the 4 LSBs once received to make 8 bits LiquidCrystal object) which expects the 4 MSBs to be transferred followed by the 4 LSBs.which it would then display as ASCII.

Link to comment
Share on other sites

14 minutes ago, attila said:

Hi @JohnnyG

The Bus interpreter does not support such, but you could write a custom interpreter.
Or use two Buses for LSB and MSB with same Clock/Latch signal and different polarity of Enable signal.

That sounds like a fun project, thanks!

Link to comment
Share on other sites

Hi @JohnnyG,

I found some old code on my computer that used 4-bit mode for a parallel LCD that I have also attached. I don't have a parallel LCD with me at home to re-test it (and if I recall correctly it just bit-bangs the communication and uses an external button that you can apply a high logic voltage to) though it should work. I also attached the 8-bit version as well. I will note that it was designed for a different microcontroller (and doesn't use the LiquidCrystal library) though.

Let me know if you have any questions.

Thanks,
JColvin

PmodCLP_4bit.ino PmodCLP.pde

Link to comment
Share on other sites

5 minutes ago, JColvin said:

Hi @JohnnyG,

I found some old code on my computer that used 4-bit mode for a parallel LCD that I have also attached. I don't have a parallel LCD with me at home to re-test it (and if I recall correctly it just bit-bangs the communication and uses an external button that you can apply a high logic voltage to) though it should work. I also attached the 8-bit version as well. I will note that it was designed for a different microcontroller (and doesn't use the LiquidCrystal library) though.

Let me know if you have any questions.

Thanks,
JColvin

PmodCLP_4bit.ino 28.48 kB · 0 downloads PmodCLP.pde 7.17 kB · 0 downloads

THANK YOU!!!  You rock!  I'll let you know how it goes.

-G

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...