It is currently 22 Nov 2017 16:33

All times are UTC + 1 hour




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: STM32F103C8 LCD display.
PostPosted: 11 Sep 2017 08:53 
Offline

Joined: 15 Apr 2015 10:00
Posts: 14
Hello!
I'm new.
This code does not work for me, help me.
R/W to the ground.
There is nothing on the display.
STM32F103C8 default settings.
{*
 * Project name:
     Lcd_Custom_Test (Simple demonstration of the LCD Library functions)
 * Copyright:
     (c) Mikroelektronika, 2009.
 * Revision History:
     20091030:
       - initial release;
 * Description:
     This is a simple demonstration of LCD library functions. LCD is first
     initialized (PORTA, 4-bit data interface, default pin settings), then some
     text is written at the first and the second row.
 * Test configuration:
     MCU:             STM32F107VC
                      http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00220364.pdf
     Dev.Board:       EasyMx PRO v7 for STM32(R) ARM(R)
                      http://www.mikroe.com/easymx-pro/stm32/
     Oscillator:      HSE-PLL, 72.000MHz
     Ext. Modules:    ac:LCD
                      ac:LCD_Adapter_Board on PORTD/L (low byte)
     SW:              mikroPascal PRO for ARM
                      http://www.mikroe.com/mikropascal/arm/
 * NOTES:
     - None.
 *}

program  Lcd_Test;

// LCD module connections
var LCD_RS : sbit  at GPIOB_ODR.B3;
var LCD_EN : sbit  at GPIOB_ODR.B5;
var LCD_D4 : sbit  at GPIOB_ODR.B6;
var LCD_D5 : sbit  at GPIOB_ODR.B7;
var LCD_D6 : sbit  at GPIOB_ODR.B8;
var LCD_D7 : sbit  at GPIOB_ODR.B9;
// End LCD module connections

var txt1 : array[16] of char;
    txt2 : array[11]  of char;
  //  txt3 : array[8]  of char;
  //  txt4 : array[7]  of char;
    i    : byte;                       // Loop variable

procedure Move_Delay();                // Function used for text moving
  begin
    Delay_ms(700);                     // You can change the moving speed here
  end;

begin
 GPIO_Digital_Output(@GPIOB_BASE, _GPIO_PINMASK_3 or _GPIO_PINMASK_4 or _GPIO_PINMASK_5 or _GPIO_PINMASK_6
 or _GPIO_PINMASK_7 or _GPIO_PINMASK_8 or _GPIO_PINMASK_9);

 
  txt1 := 'mikroElektronika';
  txt2 := 'STM32';
  //txt3 := 'Lcd4bit';
 // txt4 := 'example';

  Lcd_Init();                        // Initialize LCD
  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
 { LCD_Out(1,6,txt3);                 // Write text in first row
  LCD_Out(2,6,txt4);                 // Write text in second row
  Delay_ms(2000);}
  Lcd_Cmd(_LCD_CLEAR);               // Clear display

  LCD_Out(1,1,txt1);                 // Write text in first row
  Lcd_Out(2,4,txt2);                 // Write text in second row
  Delay_ms(500);

  // Moving text
  for i:=0 to 3 do                   // Move text to the right 4 times
    begin
      Lcd_Cmd(_LCD_SHIFT_RIGHT);
      Move_Delay();
    end;

  while TRUE do                      // Endless loop
    begin
      for i:=0 to 6 do               // Move text to the left 7 times
        begin
          Lcd_Cmd(_LCD_SHIFT_LEFT);
          Move_Delay();
        end;

      for i:=0 to 6 do               // Move text to the right 7 times
        begin
          Lcd_Cmd(_LCD_SHIFT_RIGHT);
          Move_Delay();
        end;

    end;
end.


Thank you


Attachments:
1602A_LCD_Front.jpeg
1602A_LCD_Front.jpeg [ 512 KiB | Viewed 2548 times ]
STM32F103C8.png
STM32F103C8.png [ 102.53 KiB | Viewed 2548 times ]
Top
 Profile  
 
PostPosted: 11 Sep 2017 16:03 
Offline

Joined: 15 Apr 2015 10:00
Posts: 14
Do not want anyone?
Sorry for my English.


Top
 Profile  
 
PostPosted: 12 Sep 2017 17:57 
Offline
mikroElektronika team
User avatar

Joined: 15 Jan 2016 12:50
Posts: 1546
Hi,

Welcome to the MikroE forum.

How did you connect LCD display? Can you send your schematic?
Is at least backlight turned on?

Did you connect potentiometer and did you try to adjust contrast?

Kind regards,
Lana


Top
 Profile  
 
PostPosted: 12 Sep 2017 18:13 
Offline

Joined: 15 Apr 2015 10:00
Posts: 14
Hi.

It is connected so.

var LCD_RS : sbit  at GPIOB_ODR.B3; = PB3
var LCD_EN : sbit  at GPIOB_ODR.B4; = PB4
var LCD_D4 : sbit  at GPIOB_ODR.B5; = PB5
var LCD_D5 : sbit  at GPIOB_ODR.B6; = PB6
var LCD_D6 : sbit  at GPIOB_ODR.B7; = PB7
var LCD_D7 : sbit  at GPIOB_ODR.B8; = PB8


The backlight works, the contrast is adjustable.
Only text on the display is not present.


Attachments:
lcd1602-connecting.jpg
lcd1602-connecting.jpg [ 76.8 KiB | Viewed 2522 times ]
Top
 Profile  
 
PostPosted: 13 Sep 2017 12:28 
Offline

Joined: 22 Nov 2012 07:58
Posts: 193
Hello

the LCD-Init does not work.
Please test my LCD-Demo:

https://forum.mikroe.com/download/file.php?id=10798&sid=d686014691dac5f2dbf72d959e090f15

with regards
Peter


Top
 Profile  
 
PostPosted: 13 Sep 2017 13:53 
Offline

Joined: 15 Apr 2015 10:00
Posts: 14
Thanks Pilikan!

But here
Identifier "TIM3_DIER_UIE" was not declared myLCD.
If you enable the LCD library, the error goes away.

Appears
Identifier "LCD_Init" has been already declared in "__Lib_Lcd.mpas" myLCD.mpas


Top
 Profile  
 
PostPosted: 13 Sep 2017 14:40 
Offline

Joined: 22 Nov 2012 07:58
Posts: 193
Hi,

since there is no source, I use no Libs of Me!
Disable the Me-LCD LIB.
Which bit TIM3_DIER_UIE is in the data sheet, Me changes the Defs from time to time.
Enclosed myLCD for 5.1.


Attachments:
myLCD.zip [3.38 KiB]
Downloaded 90 times
Top
 Profile  
 
PostPosted: 13 Sep 2017 15:43 
Offline

Joined: 15 Apr 2015 10:00
Posts: 14
Everything is perfectly compiled but does not work, there is no text on the display.
I just registered in myLCD, my display, pins.


Top
 Profile  
 
PostPosted: 14 Sep 2017 10:16 
Offline

Joined: 15 Apr 2015 10:00
Posts: 14
Hello Pelican!
Can you have any more suggestions?


Top
 Profile  
 
PostPosted: 14 Sep 2017 12:06 
Offline

Joined: 22 Nov 2012 07:58
Posts: 193
which controller has the display?


Top
 Profile  
 
PostPosted: 14 Sep 2017 14:12 
Offline

Joined: 15 Apr 2015 10:00
Posts: 14
Should be HD44780, I bought for a long time on ebay. With this display on
mikroPascal PRO for AVR with library LCD no problems.

On the red, do not pay attention.


Attachments:
1602A.jpg
1602A.jpg [ 1.82 MiB | Viewed 2486 times ]
Top
 Profile  
 
PostPosted: 15 Sep 2017 07:20 
Offline

Joined: 22 Nov 2012 07:58
Posts: 193
Hello,
did you use pull-up resistors (4K7)?
the outputs at the STM32 work with 3.3V, the AVR probably with 5V.

Peter


Top
 Profile  
 
PostPosted: 15 Sep 2017 07:54 
Offline

Joined: 15 Apr 2015 10:00
Posts: 14
Pelikan wrote:
did you use pull-up resistors (4K7)?

Sorry
Show how?


Top
 Profile  
 
PostPosted: 15 Sep 2017 10:15 
Offline

Joined: 22 Nov 2012 07:58
Posts: 193
https://en.wikipedia.org/wiki/Pull-up_resistor

e.g.
PinX - 4K7- 5V(!) from LCD.


Top
 Profile  
 
PostPosted: 15 Sep 2017 14:52 
Offline

Joined: 15 Apr 2015 10:00
Posts: 14
Thank you
STM32 converted in to arduino, displays
text on I2C.


Attachments:
File comment: Sorry for the quality
IMG_20170915_150824.jpg
IMG_20170915_150824.jpg [ 750.04 KiB | Viewed 2401 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: