|
st7735的Proteus仿真測試
單片機(jī)源程序如下:
- '----------------------------------------------------------------------------'
- ' ST7735R display library '
- ' resolution 128x160 '
- ' '
- ' BASCOM-AVR 2.0.8.0. '
- ' Shilov Sergey ?017 '
- ' St-Peterburg '
- ' RUSSIA '
- ' '
- '----------------------------------------------------------------------------'
- $regfile = "m8adef.dat"
- $crystal = 8000000
- $hwstack = 64
- $swstack = 64
- $framesize = 64
- '------------------------------- Setup -----------------------------------------
- $lib "glcd-ST7735R_april.lib"
- '$lib "glcd-ST7735R_march.lib"
- Config Graphlcd = Color , A0 = Portd.3 , Si = Portd.2 , Sclk = Portd.1 , Cs1 = Portd.4 , Rst = Portd.0 ' CS1 & Rst are optional
- Const Portrait = 0 '1=Portrait, 0=Landscape
- Const Rotate_180 = 0 '1=Rotated, 0=Not Rotated
- '------------------- Variables & Constants -------------------------------------
- Const Blue = &B00000011 ''predefined contants are making programming easier
- Const Yellow = &B11111100
- Const Red = &B11100000
- Const Green = &B00011100
- Const Black = &B00000000
- Const White = &B11111111
- Const Brightgreen = &B00111110
- Const Darkgreen = &B00010100
- Const Darkred = &B10100000
- Const Darkblue = &B00000010
- Const Brightblue = &B00011111
- Const Orange = &B11111000
- Const Violet = &B11100011
- Dim I As Byte , N As Byte , M As Byte , P As Byte
- '============================ Main prog ========================================
- Initlcd
- Cls
- Do
- #if Portrait = 0
- Boxfill(0 , 0) -(159 , 127) , Green
- Boxfill(0 , 0) -(159 , 127) , Red
- Boxfill(0 , 0) -(159 , 127) , Violet
- Boxfill(0 , 0) -(159 , 127) , Yellow
- Boxfill(0 , 0) -(159 , 127) , Blue
- Line(0 , 0) -(159 , 0) , Yellow
- Line(0 , 0) -(0 , 127) , Yellow
- Line(0 , 127) -(159 , 127) , Yellow
- Line(159 , 0) -(159 , 127) , Yellow
- Pset 1 , 1 , Yellow
- Pset 158 , 1 , Yellow
- Pset 1 , 126 , Yellow
- Pset 158 , 126 , Yellow
- Box(2 , 2) -(157 , 125) , Yellow
- For I = 1 To 63 Step 4
- Circle(80 , 64) , I , Green
- Next I
- Setfont Color8x8
- Lcdat 60 , 20 , "Display ST7735R" , Orange , Blue
- Wait 1
- Boxfill(0 , 0) -(159 , 127) , White
- Showpic 40 , 24 , Clock
- #else
- Boxfill(0 , 0) -(127 , 159) , Green
- Boxfill(0 , 0) -(127 , 159) , Red
- Boxfill(0 , 0) -(127 , 159) , Violet
- Boxfill(0 , 0) -(127 , 159) , Yellow
- Boxfill(0 , 0) -(127 , 159) , Blue
- Line(0 , 0) -(127 , 0) , Yellow
- Line(0 , 0) -(0 , 159) , Yellow
- Line(0 , 159) -(127 , 159) , Yellow
- Line(127 , 0) -(127 , 159) , Yellow
- Pset 1 , 1 , Yellow
- Pset 126 , 1 , Yellow
- Pset 1 , 158 , Yellow
- Pset 126 , 158 , Yellow
- Box(2 , 2) -(125 , 157) , Yellow
- For I = 1 To 63 Step 4
- Circle(64 , 80) , I , Green
- Next I
- Setfont Color8x8
- Lcdat 76 , 20 , " ST7735R " , Orange , Blue
- Wait 1
- Boxfill(0 , 0) -(127 , 159) , White
- Showpic 24 , 40 , Clock
- #endif
- Wait 2
- Loop
- End
- '-------------------------------------------------------------------------------
- $include "color8x8.font"
- Clock:
- $bgf "Clock.bgc"
復(fù)制代碼
資料
st7735.zip
(51.33 KB, 下載次數(shù): 93)
2019-5-27 13:30 上傳
點(diǎn)擊文件名下載附件
|
|