GLCD

Başlatan Ankaralı, 04 Mart 2010, 21:35:47

Ankaralı

Merhaba;

GLCD nin çalışma mantığı nasıldır.Ekranda nasıl yazı veya şekil oluşturulabilir?

GLCD (proton veya basic farketmez) kodları olan sakıncası yoksa paylaşabilirmi?

Teşekkürler,
@ NEXYS2

MC_Skywalker

Mikroelektronika'nın mikrobasic pro for PIC derleyicisi içindeki örnek kod.

Alıntı Yap
' *
' * Project name:
'     Glcd_Test (Demonstration of the Glcd library routines)
' * Copyright:
'     (c) Mikroelektronika, 2009.
' * Revision History:
'     20080930:
'       - initial release
'       - 20090720 - modified by Slavisa Zlatanovic;
' * Description:
'     This is a simple demonstration of the Glcd library routines:
'     - Init and Clear (pattern fill)
'     - Image display
'     - Basic geometry - lines, circles, boxes and rectangles
'     - Text display and handling
' * Test configuration:
'     MCU:             PIC16F887
'                      http://ww1.microchip.com/downloads/en/DeviceDoc/41291F.pdf
'     Dev.Board:       EasyPIC6
'                      http://www.mikroe.com/en/tools/easypic6/
'     Oscillator:      HS, 08.0000 MHz
'     Ext. Modules:    GLCD 128x64, KS108/107 controller
'                      http://www.mikroe.com/en/tools/components/#other
'     SW:              mikroBasic PRO for PIC
'                      http://www.mikroe.com/en/compilers/mikrobasic/pro/pic/
' * Notes:
'     - Turn on GLCD backlight switch SW8.8.
' *

program Glcd_Test

' Glcd module connections
dim GLCD_DataPort as byte at PORTD

dim GLCD_CS1 as sbit at RB0_bit
    GLCD_CS2 as sbit at RB1_bit
    GLCD_RS  as sbit at RB2_bit
    GLCD_RW  as sbit at RB3_bit
    GLCD_EN  as sbit at RB4_bit
    GLCD_RST as sbit at RB5_bit

dim GLCD_CS1_Direction as sbit at TRISB0_bit
    GLCD_CS2_Direction as sbit at TRISB1_bit
    GLCD_RS_Direction  as sbit at TRISB2_bit
    GLCD_RW_Direction  as sbit at TRISB3_bit
    GLCD_EN_Direction  as sbit at TRISB4_bit
    GLCD_RST_Direction as sbit at TRISB5_bit
' End Glcd module connections

dim counter as byte
    someText as char[18]

sub procedure Delay2S()                          ' 2 seconds delay sub function
  Delay_ms(2000)
end sub

main:
  ANSEL  = 0                                     ' Configure AN pins as digital I/O
  ANSELH = 0

  Glcd_Init()                                    ' Initialize Glcd
  Glcd_Fill(0x00)                                ' Clear Glcd

  while TRUE
    Glcd_Image(@truck_bmp)                       ' Draw image
    Delay2S() delay2S()

    Glcd_Fill(0x00)                              ' Clear Glcd

    Glcd_Box(62,40,124,63,1)                     ' Draw box
    Glcd_Rectangle(5,5,84,35,1)                  ' Draw rectangle
    Glcd_Line(0, 0, 127, 63, 1)                  ' Draw line
    Delay2S()
    counter = 5

    while (counter <= 59)                        ' Draw horizontal and vertical lines
      Delay_ms(250)
      Glcd_V_Line(2, 54, counter, 1)
      Glcd_H_Line(2, 120, counter, 1)
      Counter = counter + 5
    wend

    Delay2S()

    Glcd_Fill(0x00)                              ' Clear Glcd

    Glcd_Set_Font(@Character8x7, 8, 7, 32)       ' Choose font "Character8x7"
    Glcd_Write_Text("mikroE", 1, 7, 2)           ' Write string

    for counter = 1 to 10                        ' Draw circles
      Glcd_Circle(63,32, 3*counter, 1)
    next counter
    Delay2S()

    Glcd_Box(10,20, 70,63, 2)                    ' Draw box
    Delay2S()

    Glcd_Fill(0xFF)                              ' Fill Glcd
    Glcd_Set_Font(@Character8x7, 8, 7, 32)       ' Change font
    someText = "8x7 Font"
    Glcd_Write_Text(someText, 5, 0, 2)           ' Write string
    delay2S()

    Glcd_Set_Font(@System3x5, 3, 5, 32)          ' Change font
    someText = "3X5 CAPITALS ONLY"
    Glcd_Write_Text(someText, 60, 2, 2)          ' Write string
    delay2S()

    Glcd_Set_Font(@font5x7, 5, 7, 32)            ' Change font
    someText = "5x7 Font"
    Glcd_Write_Text(someText, 5, 4, 2)           ' Write string
    delay2S()

    Glcd_Set_Font(@FontSystem5x7_v2, 5, 7, 32)   ' Change font
    someText = "5x7 Font (v2)"
    Glcd_Write_Text(someText, 5, 6, 2)           ' Write string
    delay2S()
  wend
end.

Ankaralı

Hocam teşekkürler ama biraz daha basit bir uygulama var mı?
@ NEXYS2

aykut54

Alıntı yapılan: "QarizmaCocuq"Hocam teşekkürler ama biraz daha basit bir uygulama var mı?

Hocam proton kısmına baktınızmı 5 adet uygulama yapmıştım kaynak kodları çalışma resim ve videoları vardı.

Ankaralı

Eyvallah aykut hocam.
@ NEXYS2