找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 1184|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

RGB Bascom

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:805239 發(fā)表于 2020-7-18 20:15 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
Hello friends
there is a project addvance for lcd rgb with bascom avr
you can use many affact

[free]$regfile = "m8adef.dat"
$crystal = 8000000
$hwstack = 40
$swstack = 16
$framesize = 32

Dim I As Word, X As Word
Dim R_p As Bit, R_n As Bit
Dim G_p As Bit, G_n As Bit
Dim B_p of As Bit, B_n of As Bit
Dim R_TEMP of As Byte
Dim G_temp of As Byte
Dim B_temp of As Byte
Dim Countryld of As Byte

the Declare Sub Rgb (ByVal Rr of As Byte, ByVal Gg of As Byte, ByVal Bb of As Byte, ByVal Tt of the of As Byte)

Config Timer1 = Pwm, Pwm = 8, Compare_a_pwm = Clear_up, Compare_b_pwm = Clear_up, Prescale = 8
Config Timer2 = Pwm, Pwm = On, Compare_pwm = Clear_up, Prescale = 8

B Alias ​​Pwm2
G Alias ​​Pwm1b
R Alias ​​Pwm1a 16

Config Lc
Config Lcdpin = Pin, Rs = Portc.0, E = Portd.6, Db4 = _
Portd.7, Db5 = Portb.0, Db6 = Portc.2, Db7 = Portc.3
Cursor Off
Cls

Waitms 200

Do
   Rgb 1, 1, 0, 1
   Rgb 0, 1, 0, 1
   Rgb 0, 1, 1, 1
   Rgb 0, 0, 1, 1
   Rgb 1, 0, 1, 1
   Rgb 1, 0, 0, 1
   Rgb 1, 1, 0, 1
Loop
End

Sub Rgb(byval Rr As Byte, Byval Gg As Byte, Byval Bb As Byte, Byval Tt As Byte)
   I = Tt * 1000
   X = I / 255

   If Rr <> R_temp Then
      If Rr = 1 Then
         R_p = 1
      Else
         R_n = 1
      End If
   End If
   If Gg <> G_temp Then
      If Gg = 1 Then
         G_p = 1
      Else
         G_n = 1
      End If
   End If
   If Bb <> B_temp Then
      If Bb = 1 Then
         B_p = 1
      Else
         B_n = 1
      End If
   End If

   For Coun = 0 To 255
      If R_p = 1 Then R =
      Coun If R_n = 1 Then R = 255 -coun
      If G_p = 1 Then G =
      Coun If G_n = 1 Then G = 255 -coun
      If B_p = 1 Then B = Coun
      If B_n = 1 Then B = 255 -coun'Locate
      1, 1: Lcd R; ";"; G; ";"; B; Spc(10)
      Waitms X
   Next

   Coun R_p = 0
   = 0 r_n
   G_P = 0
   G_n = 0
   B_p = 0
   B_n = 0

   R_TEMP = Rr
   G_temp = Gg
   B_temp Bb =
End Sub [/ Free]


enjoy it.
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表