標(biāo)題: RGB Bascom [打印本頁(yè)]

作者: AlirezaGhh    時(shí)間: 2020-7-18 20:15
標(biāo)題: RGB Bascom
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.





歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1