Recent Posts

Pages: [1] 2 3 ... 10
1
TFTs / NHD-1.8-128160EF-CSXN
« Last post by mibeme on Today at 05:10:56 AM »
Hi all,

I recently purchased the above display, but I can not make the display work for Arduino Uno. Modify the code as shown below. can you help me?

Code: [Select]
//---------------------------------------------------------
/*
NHD_1_8_128160EF_CTXI_mega.ino
Program for writing to Newhaven Display 1.8 TFT with ILI9163 controller

(c)2013 Mike LaVine - Newhaven Display International, LLC.

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
*/
//---------------------------------------------------------

// The 8 bit data bus is connected to PORTD of the Arduino Mega2560
// 5V voltage regulator on Arduino Mega has been replaced with a 3.3V regulator to provide 3.3V logic

int DC = 11;      // D/C signal connected to Arduino digital pin 30
int WR = 10;      // /WR signal connected to Arduino digital pin 31
int RD = 9;      // /RD signal connected to Arduino digital pin 32
int RST = 12;     // /RST signal connected to Arduino digital pin 33

// /CS signal tied to ground

void comm_out(unsigned char c)
{
  digitalWrite(DC, LOW);
  PORTD = c;
  digitalWrite(WR, LOW);
  digitalWrite(WR, HIGH);
}

void data_out(unsigned char d){
  digitalWrite(DC, HIGH);
  PORTD = d;
  digitalWrite(WR, LOW);
  digitalWrite(WR, HIGH);
}

void disp(){
  unsigned int i;
  comm_out(0x2C);              //command to begin writing to frame memory
  for(i=0;i<20480;i++)         //fill screen with red pixels
  {
      data_out(0xFF);
            data_out(0x00);
            data_out(0x00);
  }
        for(i=0;i<20480;i++)         //fill screen with green pixels
  {
      data_out(0x00);
            data_out(0xFF);
            data_out(0x00);
        }
        for(i=0;i<20480;i++)         //fill screen with blue pixels
  {
      data_out(0x00);
            data_out(0x00);
            data_out(0xFF);
        }
}

void setup(){

  DDRC = 0xFF;   
  PORTC = 0x00;
  DDRD = 0xFF;
  PORTD = 0x00;
  digitalWrite(RD, HIGH);
  digitalWrite(WR, LOW);
  digitalWrite(RST, LOW);
  delay(150);
  digitalWrite(RST, HIGH);
  delay(150);
 
  comm_out(0x11);              //exit SLEEP mode
 
  delay(100);
 
  comm_out(0x28);              //display off
 
  comm_out(0x26);              //select gamma curve
  data_out(0x04);
 
  comm_out(0xB1);              //frame rate control
  data_out(0x0A);
  data_out(0x14);
 
  comm_out(0xC0);              //power control 1
  data_out(0x0A);
  data_out(0x00);
 
  comm_out(0xC1);              //power control 2
  data_out(0x02);
 
  comm_out(0xC5);              //VCOM control 1
  data_out(0x2F);
  data_out(0x3E);
 
  comm_out(0xC7);              //VCOM control 2
  data_out(0x40);
 
  comm_out(0x2A);              //column address set
  data_out(0x00);                 
  data_out(0x00);                  //start 0x0000
  data_out(0x00);
  data_out(0x7F);                  //end 0x007F
 
  comm_out(0x2B);              //page address set
  data_out(0x00);                 
  data_out(0x00);                  //start 0x0000
  data_out(0x00);
  data_out(0x9F);                  //end 0x009F
 
  comm_out(0x36);              //memory access control
  data_out(0xC8);
 
  comm_out(0x3A);              //pixel format = 18 bit per pixel
  data_out(0x06);                 
 
  comm_out(0x29);              //display ON

  delay(10);
}

void loop(){
  disp();
  delay(1000);
}

Thanks
mibeme
2
Graphic LCDs / NHD-C12864LZ-FSW-FBW-3V3 slow writing
« Last post by AdvAdrian on September 20, 2018, 03:37:59 PM »
I am programming this graphic LCD but when sending to clear the pixels the process is too slow. In the datasheet there is not any command to clear the pixels, Do you have any suggestion to speed up the process ?
3
OLEDs / Connecting the NHD-0420-CW Display to the Evalboard
« Last post by LuikardP on September 20, 2018, 08:46:28 AM »
Hallo Everybody,
i'm trying to connect a NHD-0420-CW Display via I2C to the evalboard NHDev. I connect the the Pins according to the datasheets. See the table below.
Display            Evalboard
1        VSS            1
2        VDD           2
3       REGVdd       37   tied to GND
4       SA0             5
5-6    tied to GND
7       SCL             30
8 and 9 SDA         38
10-15 tied to GND
16     /RES           11
17     BS0  tied to GND
18     BS1  tied to VDD
19     BS2 tied to GND
20    VSS             38
The evalboard starts. I'm able to select the correct Display type but the Display stays black. Is it possilbe to opperate the Display with the Evalboard over I2C? And when where is the error in this assambly?
Thank you for your help
Philipp
4
I am using NHD-320240WG-BoTFH-VZ# graphics display with RA8835A controller. I have developed code for characters of 8x8 pixel size and it's working fine. But I couldn't able to do the same for more than 8x8 size. Is there any sample code available for the same? Or any code to generate customize characters?
5
Graphic LCDs / Re: NHD-C12864A1Z-FSW-FBW-HTT pixel problem
« Last post by Ted_M on September 19, 2018, 09:32:00 AM »
This topic was supported through email and was resolved by clearing buffer memory.
6
Take a look at these shield stacking headers to see if they will help give you more spacing:

https://www.amazon.com/Shield-Stacking-Header-Arduino-MEGA/dp/B0756KLNLX
7
Hello!  I have an application where I want to display readings from an RF power amplifier I'm building. Voltage inputs will range from 0-50 millivolts to 0-3 volts.  I purchased a Arduino Mega 2560,an LCD 4.3" captive touch screen, and a 24-bit DAC shield.  I assumed I could stack the DAC between the screen and the Arduino Mega, but that turned out to be physically impossible.  I need the 24 bits to deal with the wide range of input voltages, and differential inputs to handle common mode noise.  How can I make this work?  Once I sort that out my next questions will be to ask if anyone can show me how to display the various amplifier parameters on my screen.
Juan@WA6HTP.com
8
Character LCDs / Re: NHD-C0216CZ-NSW-BBW-3V3 Boost Circuit
« Last post by AmericanMeter on September 14, 2018, 08:34:41 AM »
I am using 1uF caps for both.

1uF 10V Ceramics X5R capacitor.

Regards,
Craig
9
Character LCDs / Re: NHD-C0216CZ-NSW-BBW-3V3 Boost Circuit
« Last post by Ted_M on September 13, 2018, 04:25:28 PM »
What value are the capacitors connected to pins 8,9, and 10?

Regards,

Ted
10
Graphic LCDs / NHD-C12864A1Z-FSW-FBW-HTT pixel problem
« Last post by Christophe_ on September 13, 2018, 05:39:12 AM »
Hello,

I am working with NHD-C12864A1Z-FSW-FBW-HTT (ST7565r) and pic 18F46k20 (I tried at 1 MHz, 8 and 64 MHz) and I have a problem with pixels which are on instead to be off. They appear just after initilization and when I send command - text to the screen.

Please find the code (it's just a test...)
I think is due to noise and I don't know how I can remove it.

I thank you in advance for your help.


Code: [Select]


#include <pic18f46k20.h>
#include "Configuration_Header_File.h"
#include "SPI_Header_File.h"
#include "ST7565_Font.h"
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <xc.h>
#define _XTAL_FREQ 1000000


#define ST7565R_CMD_DISPLAY_ON                     0xAF
#define ST7565R_CMD_DISPLAY_OFF                    0xAE
#define ST7565R_CMD_START_LINE_SET(line)           (0x40 | (line))
#define ST7565R_CMD_PAGE_ADDRESS_SET(page)         (0xB0 | (page))
#define ST7565R_CMD_COLUMN_ADDRESS_SET_MSB(column) (0x10 | (column))
#define ST7565R_CMD_COLUMN_ADDRESS_SET_LSB(column) (0x00 | (column))
#define ST7565R_CMD_ADC_NORMAL                     0xA0
#define ST7565R_CMD_ADC_REVERSE                    0xA1
#define ST7565R_CMD_DISPLAY_NORMAL                 0xA6
#define ST7565R_CMD_DISPLAY_REVERSE                0xA7
#define ST7565R_CMD_DISPLAY_ALL_POINTS_OFF         0xA4
#define ST7565R_CMD_DISPLAY_ALL_POINTS_ON          0xA5
#define ST7565R_CMD_LCD_BIAS_1_DIV_5_DUTY33        0xA1
#define ST7565R_CMD_LCD_BIAS_1_DIV_6_DUTY33        0xA2
#define ST7565R_CMD_NORMAL_SCAN_DIRECTION          0xC0
#define ST7565R_CMD_REVERSE_SCAN_DIRECTION         0xC8
#define ST7565R_CMD_VOLTAGE_RESISTOR_RATIO_0       0x20
#define ST7565R_CMD_VOLTAGE_RESISTOR_RATIO_1       0x21
#define ST7565R_CMD_VOLTAGE_RESISTOR_RATIO_2       0x22
#define ST7565R_CMD_VOLTAGE_RESISTOR_RATIO_3       0x23
#define ST7565R_CMD_VOLTAGE_RESISTOR_RATIO_4       0x24
#define ST7565R_CMD_VOLTAGE_RESISTOR_RATIO_5       0x25
#define ST7565R_CMD_VOLTAGE_RESISTOR_RATIO_6       0x26
#define ST7565R_CMD_VOLTAGE_RESISTOR_RATIO_7       0x27
#define ST7565R_CMD_POWER_CTRL_ALL_ON              0x2F
#define ST7565R_CMD_SLEEP_MODE                     0xAC
#define ST7565R_CMD_NORMAL_MODE                    0xAD
#define ST7565R_CMD_RESET                          0xE2
#define ST7565R_CMD_NOP                            0xE3
#define ST7565R_CMD_ELECTRONIC_VOLUME_MODE_SET     0x81
#define ST7565R_CMD_ELECTRONIC_VOLUME(volume)      (0x3F & (~volume))
#define ST7565R_CMD_BOOSTER_RATIO_SET              0xF8
#define ST7565R_CMD_BOOSTER_RATIO_2X_3X_4X         0x00
#define ST7565R_CMD_BOOSTER_RATIO_5X               0x01
#define ST7565R_CMD_BOOSTER_RATIO_6X               0x03
#define ST7565R_CMD_STATUS_READ                    0x00
#define ST7565R_CMD_END                            0xEE
#define ST7565R_CMD_READ_MODIFY_WRITE              0xE0

void Init();
void SendCommand(char);
void SendData(char);
void SendString(char *);
void MSdelay(unsigned int);
void st7565_Clear();
void PositionXY(char);
void glcd_set_contrast(uint8_t val);
void st7565r_set_page_address(unsigned char address);
void st7565r_set_column_address(unsigned char address);



#define RES     LATBbits.LATB1  // RS : Commande.  A2
#define DC      LATBbits.LATB2  // R/W : Write. LATB0



void main()
{
    //OSCCON = 0X72;              /* set internal oscillator frequency, 8 MHz*/
   
    //used when 8MHz
    //    OSCCON = 0b01100000;
    //    PLLEN = 0;                     // turn off the PLL
   
    // 1MHz
    OSCCON = 0b00110000;
    PLLEN = 0; 
    TRISD = 0;                  /* set PORT as output port*/
    SPI_Init_Master();          /* initialize SPI master*/
   
    __delay_ms(100);
    Init();               /* initialize ST7565R display */
    st7565_Clear();              /* clear ST7565R display */
 

    PositionXY(0);      /* set X and Y position for printing */
    SendCommand(0xAE);
    SendString("M");
    SendCommand(0xAF);
    //SendCommand(0x80);
    while(1);
}
void SendCommand(char cmd)
{
    DC = 0;         /* Data/Command pin, D/C=1 - Data, D/C = 0 - Command*/
    CS = 0;         /* enable chip */
    SPI_Write(cmd); /* write command to the ST7565R   */
    //__delay_ms(2);
    CS = 1;         /* disable chip */
}
void SendData(char dat)
{   
    char i;
    DC = 1;         /* Data/Command pin, D/C=1 - Data, D/C = 0 - Command*/
    CS = 0;         /* enable chip */
    for(i=0;i<5;i++)
    {
        SPI_Write(font[(dat) - (0x20)][i]); /* write data to the ST7565R   */
    }
    __delay_ms(2);
    CS = 1;         /* disable chip */
}

void SendString(char *data)
{
    char i;
    while((*data)!=0)
    {   
        SendData(*data);
        data++;
    }
   
}

void glcd_set_contrast(uint8_t val)
{
/* Can set a 6-bit value (0 to 63)  */

/* Must send this command byte before setting the contrast */
SendCommand(0x81);

/* Set the contrat value ("electronic volumne register") */
if (val > 63) {
SendCommand(63);
} else {
SendCommand(val);
}
return;
}

void PositionXY(char Y)
{
    //SendCommand(0x80 | X);    /* set X position */
    SendCommand(0x40 | Y);    /* set Y position */ 
}

void Init()
{
    /*apply 100 ms reset(low to high) pulse */
    RES = 1;
    __delay_ms(50);   
    RES = 0;                    /* enable reset */
    //MSdelay(100);
    __delay_ms(600);
    RES = 1;                    /* disable reset */
    __delay_ms(20);

    SendCommand(ST7565R_CMD_LCD_BIAS_1_DIV_6_DUTY33); //1/9 bias
    SendCommand(ST7565R_CMD_ADC_NORMAL); //RAM->SEG output = normal (A0)
    SendCommand(ST7565R_CMD_REVERSE_SCAN_DIRECTION); //COM scan direction = normal: C8
    SendCommand(0x40);
    SendCommand(0x2C);
    __delay_ms(300);
    SendCommand(0x2E);
    __delay_ms(300);
    SendCommand(ST7565R_CMD_VOLTAGE_RESISTOR_RATIO_6);
    SendCommand(ST7565R_CMD_POWER_CTRL_ALL_ON); //power control set

    SendCommand(ST7565R_CMD_BOOSTER_RATIO_SET);
    SendCommand(ST7565R_CMD_BOOSTER_RATIO_2X_3X_4X);
   
    SendCommand(0xAF);
    glcd_set_contrast(20);



    SendCommand(0xB0);

   
}

void st7565_Clear()

    int byteAddress = 0;
    char page = 0b10110000;
    st7565r_set_page_address(page);          // call st7565r_set_page_address(unsigned char address) here !!
    st7565r_set_column_address(0);
    int donebitmapSize = 0;
    //=================================================
    while(donebitmapSize < 494)
    {
        for(int column = 0; column < 122; column++)
        {
            SendCommand(0x00) ;
            donebitmapSize++;
        }
    //=================================================
    page = page + 0b00000001;
    SendCommand(page);
    st7565r_set_column_address(0);
   
    }
   
}

  void st7565r_set_page_address(unsigned char address)
  {
      SendCommand(ST7565R_CMD_PAGE_ADDRESS_SET(address));
  }
 
  void st7565r_set_column_address(unsigned char address)
  { 
     address &= 0x7F;   // anded with (01111111)
     SendCommand(ST7565R_CMD_COLUMN_ADDRESS_SET_MSB(address >> 4));
     SendCommand(ST7565R_CMD_COLUMN_ADDRESS_SET_LSB(address & 0x0F));
  }

/*********************************Delay Function********************************/
void MSdelay(unsigned int val)
{
     unsigned int i,j;
        for(i=0;i<=val;i++)
            for(j=0;j<81;j++);      /*This count Provide delay of 1 ms for 8MHz Frequency */
 }







Christophe
Pages: [1] 2 3 ... 10