Show Posts
Pages: 1 ... 31 32 [33] 34 35 ... 104
481  Using Arduino / Displays / Re: How to use this 128X64 graphic LCD by Arduino UNO? on: January 09, 2014, 03:27:47 pm
PART 1: Let me start to answer the none-display questions.

Quote
1010,0000 = 160 decimal,  is my interpretation right in this way?

In C and C++ (which is the programming language used by Arduinos), all numbers are decimal unless they are prefixed with 0 (zero) or 0x (zero x).
If a number has an initial zero, then the number is interpreted as octal number. This means that "010" has the value 8!
If a number has an initial prefix of "0x" then the number is interpreted as hexadezimal value.
Actually i try to avoid octal numbers, but hexadezimal number are quite useful to send to a display controller.
So, 1010,0000 can be written as 0xa0 (or 0xA0) because four bits equal exactly one hexadecimal digit:
binary 1010 = hex a
binary 0000 = hex 0

Quote
1. Should SPI.transfer ( ) only tranfers decimal number or  how to write it to send other types of data?

SPI.transfer can transfer a value between 0 and 255. The range is important, but not the representation of the number.
It does not matter if you write SPI.transfer(160) or SPI.transfer(0xa0). In both cases a specific sequence of 8 bits is transfered.
You could also transfer a single letter: SPI.transfer('B') which is equal to SPI.transfer(66).

Quote
3. Should  all arduino sketches need a loop () function?  what if I only want the program run for once? for display how to do it?

let me split this into three questions:

> Should  all arduino sketches need a loop () function?
Yes. I leave it as an excercise to you to try to compile without "loop()"

> what if I only want the program run for once?
Put all your code into setup().

Microcontroller do have the ability to go to some shutdown mode in order to reduce power consumtion to a minimum, but i think this is beyond the scope of this thread.

> for display how to do it?
Do what? If you just want to display something static until power is switched of, then put all your init and display code into "setup()". But for my own applications it is more like this:

setup() {
  init display
  output something to the user
}

loop() {
  wait for some input
  display something
  // loop will start at the beginning and wait for some input again
}

If the input is a temperature sensor, then this could look like this:
loop() {
  read temperature from sensor
  display temperature
  delay for 1 second
}

This wil update the display every second.

PART 2: Display specifc answers

First, i think you understood the concept of communication with the display controller. The code looks quite good regarding the setting of the command/data and the chip select line.

Quote
2. How to set the display column address ( -Y ) see ic spec P13 , command as blow , how to pick a specific column of pixels?
Quick answer: Either the display vendor tells you this or you have to figure this out by testing and analysis.

Long answer:
For the display Chip on Glas module on your picture, probably three or four companies are involved:
Company 1: Creates the actual liquid crystal
Company 2: Creates the display controller (UC1705)
Optional Company B: Creates LED backlight
Company 3: Assembles the liquid crystal, the optional backlight and the display controller to something which is called COG Module.

The problem is: We do not know how company 3 has connected the display controller with the liquid crystal. For example:
The controller actually has 132x65 dots, but the liquid crystal only has 128x64. Which line and which colums are invisible? This is a decision that was taken by company 3 during the wiring of the two subcomponents.
Let as consider the binary value 1000,0000 at position 0 in the controller ram.
Upper left pixel of the 128x64 might be swithed on. But it might also be the lower left corner.
Also it might be the 7th pixel of the display on the top row if the byte order is swapped.
It might also be invisible if the liquid crystal if the crystal is connected to rows 1 to 65.
It might also be invisible if the liquid crystal is connected to colums 4 to 132.
But there might be also a pixel visible at position 3  if the lc is connected from 4 to 132 and the byte order is swapped.

This means: If company 3 does not provide you enough information, then you have to set some pixel on the screen do some reverse engineering how the interconnection between controller and crystal.

There are also several registers in the controller which allow you to setup the controller so that some parts of the swapping is done automatically (like SEG and COL direction).

This is my suggested procedure on an unknown LCD:
Step 1: Try to make something visible. This includes
- Activate charge pump
- Activate Display
- Activate "all pixel on" mode or write some random pixels in the middle of the display
- setup display contrast
- activate other LCD parameters
Step 2: Fine tuning
- Figure out bit order
- Analyse how the 128x64 is mapped to the 132x65 RAM area
- Apply correct COM and SEG order

Of course a good datasheet from company 3 will tell you all these details  smiley-wink

So my question: Do you see something on the screen already?

Oliver



482  Using Arduino / Displays / Re: How to use this 128X64 graphic LCD by Arduino UNO? on: January 06, 2014, 06:23:09 pm
For some strange historical reason these LCDs always need an additional signal to accept "command" input. In fact, this has been taken over to all modern OLED and TFT controllers. So the SPI communication needs four signals going from the uC to the LCD controller:
- clock signal
- serial data
- c/d signal
- chip select

This is also called "4-wire" SPI as mentioned on page 7 in the UC1705 data sheet.

There is also no MISO signal, so you can not read back any data from the controller in SPI mode. This also makes the programming somehow difficult.

Oliver
483  Using Arduino / Displays / Re: How to use this 128X64 graphic LCD by Arduino UNO? on: January 06, 2014, 03:25:15 pm
Quote
Based on Figure 4 which you posted (from page 26 of the datasheet) it looks like you could just tie
the "CD" line HIGH

"commands" are required to setup the display correctly and to define the x/y position of the data. Because of this, the controller needs full controll on the CD line. See page 12 of the datasheet, column "c/d" (3rd column). For example to set the contrast, the controller has to send the "set electronic volume" command, which requires the CD line to be zero.

Oliver
484  Using Arduino / Displays / Re: How to use this 128X64 graphic LCD by Arduino UNO? on: January 06, 2014, 11:08:56 am
I had a quick look at the UC1705 datasheet. It seems to be almost identical to the UC1701. So i would say, any library for the ST7565 or UC1701 will work (except for memory layout and contrast which might need to be adjusted).

Oliver
485  Using Arduino / Displays / Re: How to use this 128X64 graphic LCD by Arduino UNO? on: January 06, 2014, 08:29:39 am
According to your latest diagram this is NOT I2C. It seems to be a SPI bus.

Moreover, the controller 1705 is not listed on the ultrachip page http://www.ultrachip.com/habout-100.html .
Maybe it is compatible (at least signal names look so) with the UC1701, which is in turn compatible with the ST7565.

SCK = clock signal of the SPI bus
SDA/SDI = data signal of the SPI bus
CD = Extra signal for the display to send data and command bytes
CS0 = Chip Select
RST = Reset Line

All in all, you might try U8glib for Arduino (http://code.google.com/p/u8glib/) with the ST7565 or UC1701 constructor.

Oliver

486  Using Arduino / Displays / Re: Use of 2.4" TFT LCD. on: January 03, 2014, 08:39:56 am
Nice display and good price. I just ordered same display (but from ebay.com). I would be interessted in any progress on running this type of display with Arduino.

Oliver
487  Using Arduino / Displays / Re: My GLCD code/hookup from arduino examples doesn't display text. on: January 03, 2014, 05:39:04 am
Quote
Can i put a resistor value instead a of variable resistor for the LCD?
One varpot is required for the contrast value. The wiper goes to V0.

Quote
Can someone look at my circuit and tell me if there is miswired pin?
Indeed i am not an expert on parallel monochrome displays  smiley-roll. I personally prefer serial displays (less wires, less possible bugs...)

What i can say is this: After carefilly reading the documentation for GLCDv3 i was able to run my parallel KS0108 display in my lab. The GLCDv3 lib also as a diagnostics example, which might provide additional information.

Oliver

488  Using Arduino / Displays / Re: My GLCD code/hookup from arduino examples doesn't display text. on: January 03, 2014, 04:19:31 am
The backlight will probably require 20mA or more. This will be
(5-4.1)/0.02 = 45 Ohm
This means 10K for the backlight is too much.

The GLCDv3 library contains a good documentation on how to connect the display.

Oliver

489  Using Arduino / Displays / Re: My GLCD code/hookup from arduino examples doesn't display text. on: January 03, 2014, 03:17:18 am
Quick Hardware review:

Do not use a variable resistor for the backlight. Variable resistors (usually) can not handle the current and the risk of accidently destroying the backlight is high. Depending the current (which i did not found in the data sheet) the constant resistor value is:
r = (5V-4.1V) / current_in_A

The contrast variable resistor is connected wrong in the Fritzing picture. See the datasheet of your post on page 9: I think the third pin of the variable resistor must be connected to ground.

From a software perspective, you might consider
http://code.google.com/p/glcd-arduino/
or
https://bitbucket.org/bperrybap/openglcd/wiki/Home

Oliver
490  Using Arduino / Displays / Re: U8glib: Graphics Lib for LCDs and OLEDs on: January 02, 2014, 03:36:14 pm
@Dj_Garfield: Good, but note that there is a size limitation for the glyphs. They can not be larger than about 48/49 pixel.

Oliver
491  Using Arduino / Displays / Re: st7920 lcd12864 glcd on: January 01, 2014, 11:08:43 am
Quote
But i don't understan why i need to do this
This is a FAQ.I tried to explain this here: http://code.google.com/p/u8glib/wiki/tpictureloop

Quote
In my  sketch after some seconds i want check an input and i need to draw another line without clean the screen.
As explained in the link above, this can not be done with U8glib. You need to redraw the first line also.
Usually this is solved by an additional variable:

Code:
int is_second_line = 0;
void draw(void)
{
  // draw first line
 ...
 if ( is_second_line != 0 )
 {
    // draw second line
 }
}
As soon as you set the variable "is_second_line" to an nonezero value, both lines will be drawn.

Oliver
492  Using Arduino / Displays / Re: T6963C (240x128) + U8glib on: January 01, 2014, 10:08:23 am
Great.

Is this the same display as mention here http://forum.arduino.cc/index.php?topic=203519.msg1501707#msg1501707?
Did you solve all problems? What had been the problems? How did you solve the FS1/FS2 issue?

Oliver
493  Using Arduino / Displays / Re: st7920 lcd12864 glcd on: January 01, 2014, 09:58:40 am
Happy New Year!

U8glib is a little bit special. Graphics commands, need to be part of the "picture loop":

Code:
void loop(void) {
  u8g.firstPage(); 
  do {
    u8g.drawHLine(20, 50, 47);
    u8g.drawVLine(58, 50, 12);
  } while( u8g.nextPage() );
 }

See also http://code.google.com/p/u8glib/wiki/thelloworld

Oliver
494  International / Deutsch / Re: U8glib Display on: January 01, 2014, 03:06:10 am

U8glib funktioniert etwas anders: Man muß die Graphik-Befehle immer in eine Schleife (picture loop) einbetten. Das sieht dann so aus:
Code:
#include <U8glib.h>
U8GLIB_KS0108_128 u8g(22,23,24,25,26,27,28,29,37,33,34,36,35); // 8Bit Com: D0..D7: 22,23,24,25,26,27,28,29 en=37, cs1=33, cs2=34, di=36, rw=35
int analogPin = 0;
int val = 0;

void setup() {
  u8g.setFont(u8g_font_unifont);
}

void loop() {
  val = analogRead(analogPin);
  u8g.firstPage(); 
  do {
    u8g.setPrintPos(0,10);
    u8g.println(val);
  } while( u8g.nextPage() );
}
Über diese Methode spart man sich,  bei gleichzeitiger Vermeidung eines kompletten Framebuffers im Ram, den Lesezugriff auf das Display. Das ist für ein KS0108 oder ein T6962 Display wegen des 8-Bit Interfaces nicht relevant, ist aber sehr hilfreich für Display-Controller mit SPI, die nur schreibenden Zugriff erlauben (ST7565, ST7920, SSD1306, UC1608, ...)

Siehe auch hier:
http://code.google.com/p/u8glib/wiki/tpictureloop


Oliver
495  Using Arduino / Displays / Re: st7920 lcd12864 glcd on: December 31, 2013, 08:19:15 pm
Maybe you could post your code and the exact error you get with U8glib.

Oliver
Pages: 1 ... 31 32 [33] 34 35 ... 104