欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3263|回復: 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 單片機教程網

快速回復 返回頂部 返回列表