找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2594|回复: 0
打印 上一主题 下一主题
收起左侧

BASCOM版 HDG12864F-1液晶屏演示

[复制链接]
跳转到指定楼层
楼主


演示程序:
rem Main.bas file generated by New Project wizard
rem
rem Created:   周五 11月 27 2020
rem Processor: ATmega8
rem Compiler:  BASCOM-AVR

rem Write your code here

'-----------------------------------------------------------
'                     EADOGM128.BAS
'               (c) 1995-2020 MCS Electronics
' micro : mega168
' demo  : SPI graphical display EADOGM128
' IMPORTANT : SPI only allows the WRITE mode. THis mean that setting pixels is not possible.
'             for this reason commands as PSET, LINE and CIRCLE are not supported.
'             best option would be to display pictures
' fonts and images are compatible to KS108
'-----------------------------------------------------------
$regfile = "m8def.dat"                                    ' ATmega8
$crystal = 8000000
$baud = 19200
$lib "glcdeadogm128x6.lbx"                                  ' specify the used lib
$hwstack = 40
$swstack = 40
$framesize = 40



'the display was connected with these pins
Config Graphlcd = 128x64eadogm , Cs1 = Portd.4 , A0 = Portd.7 , Si = Portb.3 , Sclk = Portb.5 , Rst = Portd.5
'the best option is to control the reset line of the LCD with the micro so you can reset it controlled at startup

Config Adc = Single , Prescaler = Auto , Reference = Avcc

Dim B As Byte , J As Byte
Dim K As Byte , X As Word , Y As Word

Print "cls"
Cls

'specify the font we want to use
Setfont Font8x8tt


'You can use locate but the columns have a range from 1-128
'When you want to show somthing on the LCD, use the LDAT command
'LCDAT Y , COL, value
Lcdat 1 , 1 , "111ABCDE"
Lcdat 2 , 1 , "88888888"
Lcdat 3 , 1 , "MCS Electronics" , 1
Waitms 3000

Dim I As Word
For I = 110 To 113
  Lcdat 1 , 1 , I
  Waitms 500
  Cls 1 , 1 , 24 , 255                                      'clear inverse
  Waitms 500
Next

Waitms 3000


Setfont Font12x16
Cls
Lcdat 4 , 1 , "HDG12864F-1"                                   'a bigger font
Wait 2
CLS
Lcdat 1, 32 ,chr(146); chr(147); chr(148); chr(149); chr(150),1
Wait 2
Lcdat 3, 32, chr(151); chr(152); chr(153); chr(154); chr(155),1
Wait 2
Lcdat 5 , 32, chr(156); chr(157); chr(158);chr(159); chr(160),1
Wait 2
Lcdat 7 , 32, chr(161); chr(162); chr(163); chr(164); chr(165),1
Wait 5

cls
'Setfont Font8x8tt

Showpic 0 , 0 , Plaatje
Waitms 3000
Do
' Gosub Touch                                               'optional touch screen
Loop

End

'portc.0-portc.3 pin 1-4
Touch:                    '帮帮忙这一段不知如何仿真
   Start Adc
   Waitms 200
   Config Portc.0 = Output                                  'Bottom
   Config Portc.2 = Output                                  'Top
   Set Portc.0                                              'High
   Reset Portc.2                                            'Low
   Config Pinc.1 = Input                                    'left as input
   Config Pinc.3 = Input                                    'right as input
   Waitms 80
   Y = Getadc(3)
  Y = Y - 365
print y
   If Y > 640 Then Y = 0
   Config Portc.1 = Output                                  'Left
   Config Portc.3 = Output                                  'Right
   Set Portc.3
   Reset Portc.1
   Config Pinc.0 = Input
   Config Pinc.2 = Input
   Waitms 80
   X = Getadc(0)

   X = X - 196
print x
   If X > 800 Then X = 0
   Lcdat 1 , 1 , "X : " ; X
   Lcdat 1 , 74 , "Y : " ; Y
Return
Plaatje:
'include the picture data
$bgf "../mty1.BGF"

'include used fonts
$include "../font8x8TT.font"
$include "../Font12x16.font"

评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表