找回密码
 立即注册

QQ登录

只需一步,快速开始

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

RGB Bascom

[复制链接]
跳转到指定楼层
楼主
ID:805239 发表于 2020-7-18 20:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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