找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 1132|回復: 0
收起左側

RGB Bascom

[復制鏈接]
ID:805239 發(fā)表于 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.
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

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