RGB Matrix 20x40 Unilumin

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • RGB Matrix 20x40 Unilumin

      Hello colleagues!
      Previously, you connected matrices from GKGD and Qiangli manufacturers with your help.
      Now they have stopped selling matrices. And a new plant appeared - Unilumin.
      They say the best in China. But I couldn't make this matrix work.
      The board has SM16227 drivers and transistor assemblies. Scan frequency is 1/5.
      Perhaps someone has already tried to work with these matrices?
      Working test code for similar Qiangli matrices:

      Source Code

      1. $regfile = "m328def.dat"
      2. $crystal = 16000000
      3. $hwstack = 64 : $swstack = 64 : $framesize = 80
      4. Const Dy_num_h = 1
      5. Const Dy_num_v = 1
      6. Const Bytes_in_row = 5 * Dy_num_v
      7. Const Row_num = 20 * Dy_num_h
      8. Const Mem_size = Row_num * Bytes_in_row
      9. Const Mem_size_1 = Mem_size - 1
      10. Const Dy_offset = Dy_num_v * 100
      11. Const Channel_offset = 10 * Bytes_in_row
      12. Dim Last_x As Word , Max_y As Word
      13. Last_x = Dy_num_h * 20 : Last_x = Last_x -1
      14. Max_y = Dy_num_v * 40 : Max_y = Max_y -1
      15. '*** Pin for board 7 revision
      16. P_r1 Alias Portc.0 : Config P_r1 = Output
      17. P_g1 Alias Portc.1 : Config P_g1 = Output
      18. P_b1 Alias Portc.2 : Config P_b1 = Output
      19. P_r2 Alias Portc.3 : Config P_r2 = Output
      20. P_g2 Alias Portc.4 : Config P_g2 = Output
      21. P_b2 Alias Portc.5 : Config P_b2 = Output
      22. Dout_port Alias Portc
      23. Const Dout_pin_r1 = Pc0
      24. Const Dout_pin_g1 = Pc1
      25. Const Dout_pin_b1 = Pc2
      26. Const Dout_pin_r2 = Pc3
      27. Const Dout_pin_g2 = Pc4
      28. Const Dout_pin_b2 = Pc5
      29. P_a Alias Portd.3 : Config P_a = Output
      30. P_b Alias Portd.4 : Config P_b = Output
      31. P_c Alias Portd.5 : Config P_c = Output
      32. P_d Alias Portd.6 : Config P_d = Output
      33. P_ckl Alias Portb.5 : Config P_ckl = Output : Shift_clock_port Alias Portb : Const Shift_clock_pin = Pb5
      34. P_lat Alias Portb.3 : Config P_lat = Output
      35. P_oe Alias Portb.2 : Config P_oe = Output
      36. '***
      37. Config Base = 0
      38. Const Timer0reload = 150
      39. Config Timer0 = Timer , Prescale = 256
      40. Load Timer0 , Timer0reload
      41. On Ovf0 Display_refresh
      42. Enable Ovf0
      43. Start Timer0
      44. 'PWM ************************************************** *************************
      45. Config Timer1 = Pwm , Pwm = 8 , Compare_b_pwm = Clear_down , Prescale = 1
      46. '************************************************* ******************************
      47. Declare Sub Shift6out_4h(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      48. Declare Sub Shift6out_4l(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      49. Dim Memory_red(mem_size) As Byte , Memory_green(mem_size) As Byte , Memory_blue(mem_size) As Byte
      50. Dim Brightness As Byte , N_1 As Word
      51. Dim Red As Byte , Green As Byte , Blue As Byte , Yellow As Byte , Magenta As Byte , Cyan As Byte , White As Byte
      52. Red = 1 : Green = 2 : Yellow = 3 : Blue = 4 : Magenta = 5 : Cyan = 6 : White = 7
      53. Dim Page As Byte , Mem_offset_1 As Word , Mem_offset_3 As Word
      54. Dim R_0 As Byte , B_1 As Byte
      55. Dim St_byte_1 As Word , St_byte_2 As Word , St_byte_3 As Word , St_byte_4 As Word
      56. Dim Trigger As Bit
      57. Dim One_bit As Byte
      58. Page = 0
      59. One_bit = 1
      60. Enable Interrupts
      61. Brightness = 250
      62. Gosub Clear_memory
      63. 'Memory_red(0) = 255
      64. Do
      65. ' (
      66. Gosub Cl_green
      67. Wait 1
      68. Gosub Clear_memory
      69. Gosub Cl_red
      70. Wait 1
      71. Gosub Clear_memory
      72. Gosub Cl_blue
      73. Wait 1
      74. Gosub Clear_memory
      75. ' )
      76. Loop
      77. End
      78. Cl_red:
      79. For N_1 = 0 To Mem_size_1
      80. Memory_red(n_1) = 255
      81. Next N_1
      82. Return
      83. Cl_blue:
      84. For N_1 = 0 To Mem_size_1
      85. Memory_blue(n_1) = 255
      86. Next N_1
      87. Return
      88. Cl_green:
      89. For N_1 = 0 To Mem_size_1
      90. Memory_green(n_1) = 255
      91. Next N_1
      92. Return
      93. Clear_memory:
      94. For N_1 = 0 To Mem_size_1
      95. Memory_red(n_1) = 0
      96. Memory_green(n_1) = 0
      97. Memory_blue(n_1) = 0
      98. Next N_1
      99. Return
      100. Load_test:
      101. For N_1 = 0 To Mem_size_1
      102. Memory_red(n_1) = Lookup(n_1 , Rr1)
      103. Next N_1
      104. Return
      105. Display_refresh:
      106. Load Timer0 , Timer0reload
      107. $asm
      108. Lds r17, {page}
      109. Inc r17
      110. CPI r17,5
      111. brlo pageok
      112. clr r17
      113. Pageok:
      114. sts {page},r17
      115. $end Asm
      116. Mem_offset_1 = Page * Bytes_in_row
      117. Mem_offset_3 = 5 + Page
      118. Mem_offset_3 = Mem_offset_3 * Bytes_in_row
      119. For R_0 = 1 To Dy_num_h
      120. St_byte_1 = Mem_offset_3 : St_byte_2 = St_byte_1 + Channel_offset
      121. St_byte_3 = Mem_offset_1 : St_byte_4 = St_byte_3 + Channel_offset
      122. For B_1 = 1 To Bytes_in_row
      123. Shift6out_4h Memory_red(st_byte_1) , Memory_green(st_byte_1) , Memory_blue(st_byte_1) , Memory_red(st_byte_2) , Memory_green(st_byte_2) , Memory_blue(st_byte_2)
      124. Shift6out_4h Memory_red(st_byte_3) , Memory_green(st_byte_3) , Memory_blue(st_byte_3) , Memory_red(st_byte_4) , Memory_green(st_byte_4) , Memory_blue(st_byte_4)
      125. Shift6out_4l Memory_red(st_byte_1) , Memory_green(st_byte_1) , Memory_blue(st_byte_1) , Memory_red(st_byte_2) , Memory_green(st_byte_2) , Memory_blue(st_byte_2)
      126. Shift6out_4l Memory_red(st_byte_3) , Memory_green(st_byte_3) , Memory_blue(st_byte_3) , Memory_red(st_byte_4) , Memory_green(st_byte_4) , Memory_blue(st_byte_4)
      127. St_byte_1 = St_byte_1 + 1
      128. St_byte_2 = St_byte_2 + 1
      129. St_byte_3 = St_byte_3 + 1
      130. St_byte_4 = St_byte_4 + 1
      131. Next B_1
      132. Mem_offset_1 = Mem_offset_1 + Dy_offset
      133. Mem_offset_3 = Mem_offset_3 + Dy_offset
      134. Next R_0
      135. Pwm1b = 0
      136. Waitus 60
      137. P_lat = 1 : P_lat = 0
      138. P_a = Page.0
      139. P_b = Page.1
      140. P_c = Page.2
      141. Pwm1b = Brightness
      142. Trigger = 1
      143. Return
      144. ' R1 G1 B1 R2 G2 B2
      145. Sub Shift6out_4h(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      146. 'bit7 first to bit4
      147. $asm
      148. LDI r17,4
      149. Loop_shift2out_h:
      150. in R16, dout_port
      151. BST r18,7
      152. BLD r16,Dout_pin_r1
      153. BST r19,7
      154. bld r16,Dout_pin_g1
      155. BST r20,7
      156. bld r16,Dout_pin_b1
      157. BST r21,7
      158. BLD r16,Dout_pin_r2
      159. BST r22,7
      160. bld r16,Dout_pin_g2
      161. BST r23,7
      162. bld r16,Dout_pin_b2
      163. LSl r18
      164. LSl r19
      165. lsl r20
      166. lsl r21
      167. lsl r22
      168. lsl r23
      169. Out Dout_port , R16
      170. SBI shift_clock_Port, shift_clock_Pin
      171. dec r17
      172. CBI shift_clock_Port, shift_clock_Pin
      173. BRnE loop_shift2out_h ; if = 0 exit
      174. $end Asm
      175. End Sub
      176. Sub Shift6out_4l(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      177. 'bit3 first to bit0
      178. $asm
      179. LDI r17,4
      180. Loop_shift2out_l:
      181. in R16, dout_port
      182. BST r18,3
      183. BLD r16,Dout_pin_r1
      184. BST r19,3
      185. bld r16,Dout_pin_g1
      186. BST r20,3
      187. bld r16,Dout_pin_b1
      188. BST r21,3
      189. BLD r16,Dout_pin_r2
      190. BST r22,3
      191. bld r16,Dout_pin_g2
      192. BST r23,3
      193. bld r16,Dout_pin_b2
      194. LSl r18
      195. LSl r19
      196. lsl r20
      197. lsl r21
      198. lsl r22
      199. lsl r23
      200. Out Dout_port , R16
      201. SBI shift_clock_Port, shift_clock_Pin
      202. dec r17
      203. CBI shift_clock_Port, shift_clock_Pin
      204. BRnE loop_shift2out_l ; if = 0 exit
      205. $end Asm
      206. End Sub
      207. Rr1:
      208. Data 255 , 0 , 0 , 0 , 0
      209. Data 0 , 0 , 0 , 0 , 0
      210. Data 0 , 0 , 0 , 0 , 0
      211. Data 0 , 0 , 0 , 0 , 0
      212. Data 0 , 0 , 0 , 0 , 0
      213. Data 0 , 0 , 0 , 0 , 0
      214. Data 0 , 0 , 0 , 0 , 0
      215. Data 0 , 0 , 0 , 0 , 0
      216. Data 0 , 0 , 0 , 0 , 0
      217. Data 0 , 0 , 0 , 0 , 0
      218. Data 0 , 0 , 0 , 0 , 0
      219. Data 0 , 0 , 0 , 0 , 0
      220. Data 0 , 0 , 0 , 0 , 0
      221. Data 0 , 0 , 0 , 0 , 0
      222. Data 0 , 0 , 0 , 0 , 0
      223. Data 0 , 0 , 0 , 0 , 0
      224. Data 0 , 0 , 0 , 0 , 0
      225. Data 0 , 0 , 0 , 0 , 0
      226. Data 0 , 0 , 0 , 0 , 0
      227. Data 0 , 0 , 0 , 0 , 0
      Display All
      A red color from this code sometimes appears on the new matrix.
      Help me deal with the code.
      Files
      • SM16227.pdf

        (900.87 kB, downloaded 27 times, last: )
    • Can't anyone tell you?

      Here for this chip code display refresh:


      Source Code

      1. Display_refresh:
      2. Load Timer0 , Timer0reload
      3. $asm
      4. Lds r17, {Page_counter}
      5. Inc r17
      6. CPI r17,5
      7. brlo pageok
      8. clr r17
      9. Pageok:
      10. sts {Page_counter},r17
      11. $end Asm
      12. For R_0 = 1 To Dy_num_horiz
      13. Atemp = R_0 - 1
      14. Atemp = Atemp * 100
      15. Index_1 = Page_counter * 5
      16. Index_1 = Index_1 + Atemp
      17. Atemp = 0
      18. For D_1 = 1 To 10
      19. Index_2 = Index_1 + 50
      20. If D_1.0 = 1 Then
      21. Shift6out Memory_red(index_1) , Memory_green(index_1) , Memory_blue(index_1) , Memory_red(index_2) , Memory_green(index_2) , Memory_blue(index_2)
      22. Else
      23. Shift6lout Memory_red(index_1) , Memory_green(index_1) , Memory_blue(index_1) , Memory_red(index_2) , Memory_green(index_2) , Memory_blue(index_2)
      24. End If
      25. If Atemp = 0 Then
      26. Index_1 = Index_1 + 25
      27. Incr Atemp
      28. Else
      29. Index_1 = Index_1 - 24
      30. Atemp = 0
      31. End If
      32. Next D_1
      33. Next R_0
      34. Pwm1b = 0
      35. Waitus 40
      36. P_lat = 1 : P_lat = 0
      37. P_a = Page_counter.0
      38. P_b = Page_counter.1
      39. P_c = Page_counter.2
      40. Pwm1b = Brightness
      41. Trigger = 1
      42. Return
      Display All
      The new chip has a different data input format. I tried everything I could. It doesn't work out in any way.

      Files
      • SM16206.jpg

        (138.96 kB, downloaded 2 times, last: )
      • SM16206.jpg

        (138.96 kB, downloaded 119 times, last: )
      • SM16227.jpg

        (133.6 kB, downloaded 114 times, last: )
    • Hi!
      Oe and LE are used. Part of the data is not displayed. In a chaotic manner. The brightness is not working properly. I realized that I need to add latches in the code and change the brightness. But it doesn't work.

      Source Code

      1. $regfile = "m328def.dat"
      2. $crystal = 16000000
      3. $hwstack = 64
      4. $swstack = 64
      5. $framesize = 80
      6. '$sim
      7. Const Dy_num_vertik = 1
      8. Const Dy_num_horiz = 1
      9. Const Bytes_in_row = 5 * Dy_num_horiz
      10. Const Row_num = 20 * Dy_num_vertik
      11. Const Mem_size = Row_num * Bytes_in_row
      12. Const Mem_size_1 = Mem_size - 1
      13. '*** Pin for board 7 revision
      14. P_r1 Alias Portc.0 : Config P_r1 = Output
      15. P_g1 Alias Portc.1 : Config P_g1 = Output
      16. P_b1 Alias Portc.2 : Config P_b1 = Output
      17. P_r2 Alias Portc.3 : Config P_r2 = Output
      18. P_g2 Alias Portc.4 : Config P_g2 = Output
      19. P_b2 Alias Portc.5 : Config P_b2 = Output
      20. Const Dout_pin_r1 = Pc0
      21. Const Dout_pin_g1 = Pc1
      22. Const Dout_pin_b1 = Pc2
      23. Const Dout_pin_r2 = Pc3
      24. Const Dout_pin_g2 = Pc4
      25. Const Dout_pin_b2 = Pc5
      26. P_a Alias Portd.3 : Config P_a = Output
      27. P_b Alias Portd.4 : Config P_b = Output
      28. P_c Alias Portd.5 : Config P_c = Output
      29. P_d Alias Portd.6 : Config P_d = Output
      30. P_ckl Alias Portb.5 : Config P_ckl = Output : Shift_clock_port Alias Portb : Const Shift_clock_pin = Pb5
      31. P_lat Alias Portb.3 : Config P_lat = Output
      32. P_oe Alias Portb.2 : Config P_oe = Output
      33. Dout_port Alias Portc
      34. Config Base = 0
      35. Dim Timer0reload As Word
      36. Timer0reload = 160
      37. Config Timer0 = Timer , Prescale = 256
      38. Load Timer0 , Timer0reload
      39. On Ovf0 Display_refresh
      40. Enable Ovf0
      41. Start Timer0
      42. 'PWM ************************************************** *************************
      43. Config Timer1 = Pwm , Pwm = 8 , Compare B Pwm = Clear Down , Prescale = 1
      44. '************************************************* ******************************
      45. Dim Memory_red(mem_size) As Byte , Memory_green(mem_size) As Byte , Memory_blue(mem_size) As Byte 'memory red/green
      46. Dim Page_counter As Byte
      47. Dim D_1 As Word , R_0 As Byte
      48. Dim Index_1 As Word , Index_2 As Word
      49. Dim N_1 As Word
      50. Dim Inverting As Bit
      51. Dim Speed As Word
      52. Dim Trigger As Bit
      53. Dim Red As Byte , Green As Byte , Blue As Byte , Yellow As Byte , Magenta As Byte , Cyan As Byte , White As Byte
      54. Dim Brightness As Byte
      55. Declare Sub Shift6out(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      56. Declare Sub Shift6lout(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      57. Dim Atemp As Byte , Wtemp As Word 'word for more then 3 panels
      58. Red = 1 : Green = 2 : Yellow = 3 : Blue = 4 : Magenta = 5 : Cyan = 6 : White = 7
      59. '**************************************************
      60. 'user settings
      61. Inverting = 0
      62. '**************************************************
      63. P_ckl = 0
      64. P_a = 0
      65. P_b = 0
      66. P_c = 0
      67. Brightness = 250
      68. Enable Interrupts
      69. Pwm1b = Brightness
      70. Gosub Clear_memory
      71. Gosub Load_pix_red
      72. 'Wait 1
      73. 'gosub Clear_memory
      74. 'Text = "0"
      75. 'Call Set_text_12_16(0 , 0 , Green)
      76. Do
      77. Gosub Load_pix_test_red
      78. Wait 1
      79. Gosub Clear_memory
      80. Brightness = 150
      81. Gosub Load_pix_test_green
      82. Wait 1
      83. Gosub Clear_memory
      84. Brightness = 250
      85. Gosub Load_pix_test_blue
      86. Wait 1
      87. Gosub Clear_memory
      88. Brightness = 150
      89. Loop
      90. End
      91. Load_pix_test_red:
      92. For N_1 = 0 To Mem_size_1
      93. Memory_red(n_1) = 255
      94. Waitms 10
      95. Next N_1
      96. Return
      97. Load_pix_test_green:
      98. For N_1 = 0 To Mem_size_1
      99. Memory_green(n_1) = 255
      100. Waitms 10
      101. Next N_1
      102. Return
      103. Load_pix_test_blue:
      104. For N_1 = 0 To Mem_size_1
      105. Memory_blue(n_1) = 255
      106. Waitms 10
      107. Next N_1
      108. Return
      109. Clear_memory:
      110. N_1 = 0
      111. D_1 = Memcopy(n_1 , Memory_red(0) , Mem_size , 2)
      112. D_1 = Memcopy(n_1 , Memory_green(0) , Mem_size , 2)
      113. D_1 = Memcopy(n_1 , Memory_blue(0) , Mem_size , 2)
      114. Return
      115. Load_pix_red:
      116. For N_1 = 0 To Mem_size_1
      117. Memory_red(n_1) = Lookup(n_1 , Reds_2)
      118. Next N_1
      119. Return
      120. Display_refresh:
      121. Load Timer0 , Timer0reload
      122. $asm
      123. Lds r17, {Page_counter}
      124. Inc r17
      125. CPI r17,5
      126. brlo pageok
      127. clr r17
      128. Pageok:
      129. sts {Page_counter},r17
      130. $end Asm
      131. For R_0 = 1 To Dy_num_horiz
      132. Atemp = R_0 - 1
      133. Atemp = Atemp * 100
      134. Index_1 = Page_counter * 5
      135. Index_1 = Index_1 + Atemp
      136. Atemp = 0
      137. For D_1 = 1 To 10
      138. Index_2 = Index_1 + 50
      139. If D_1.0 = 1 Then
      140. Shift6out Memory_red(index_1) , Memory_green(index_1) , Memory_blue(index_1) , Memory_red(index_2) , Memory_green(index_2) , Memory_blue(index_2)
      141. Else
      142. Shift6lout Memory_red(index_1) , Memory_green(index_1) , Memory_blue(index_1) , Memory_red(index_2) , Memory_green(index_2) , Memory_blue(index_2)
      143. End If
      144. If Atemp = 0 Then
      145. Index_1 = Index_1 + 25
      146. Incr Atemp
      147. Else
      148. Index_1 = Index_1 - 24
      149. Atemp = 0
      150. End If
      151. Next D_1
      152. Next R_0
      153. Pwm1b = 0
      154. Waitus 40
      155. P_lat = 1 : P_lat = 0
      156. P_a = Page_counter.0
      157. P_b = Page_counter.1
      158. P_c = Page_counter.2
      159. Pwm1b = Brightness
      160. Trigger = 1
      161. Return '#15973/1ms '#15688/0,98ms
      162. ' 3/1 14725+110 1/3 14441+ 1/3 14061+
      163. ' R1 G1 B1 R2 G2 B2
      164. Sub Shift6out(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      165. $asm
      166. LDI r17,8
      167. Loop_shift2out:
      168. in R16, dout_port
      169. BST r18,0
      170. BLD r16,Dout_pin_r1
      171. BST r19,0
      172. bld r16,Dout_pin_g1
      173. BST r20,0
      174. bld r16,Dout_pin_b1
      175. BST r21,0
      176. BLD r16,Dout_pin_r2
      177. BST r22,0
      178. bld r16,Dout_pin_g2
      179. BST r23,0
      180. bld r16,Dout_pin_b2
      181. LSR r18
      182. LSR r19
      183. lsr r20
      184. lsr r21
      185. lsr r22
      186. lsr r23
      187. Out Dout_port , R16
      188. SBI shift_clock_Port, shift_clock_Pin
      189. dec r17
      190. CBI shift_clock_Port, shift_clock_Pin
      191. BRnE loop_shift2out
      192. $end Asm
      193. End Sub
      194. ' R1 G1 B1 R2 G2 B2
      195. Sub Shift6lout(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      196. $asm
      197. LDI r17,8
      198. Loop_shift2lout:
      199. in R16, dout_port
      200. BST r18,7
      201. BLD r16,Dout_pin_r1
      202. BST r19,7
      203. bld r16,Dout_pin_g1
      204. BST r20,7
      205. bld r16,Dout_pin_b1
      206. BST r21,7
      207. BLD r16,Dout_pin_r2
      208. BST r22,7
      209. bld r16,Dout_pin_g2
      210. BST r23,7
      211. bld r16,Dout_pin_b2
      212. LSl r18
      213. LSl r19
      214. lsl r20
      215. lsl r21
      216. lsl r22
      217. lsl r23
      218. Out Dout_port , R16
      219. SBI shift_clock_Port, shift_clock_Pin
      220. dec r17
      221. CBI shift_clock_Port, shift_clock_Pin
      222. BRnE loop_shift2lout
      223. $end Asm
      224. End Sub
      225. Reds_2:
      226. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      227. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      228. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      229. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      230. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      231. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      232. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      233. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      234. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      235. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      236. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      237. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      238. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      239. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      240. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      241. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      242. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      243. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      244. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      245. Data &B10000000 , &B00000000 , &B00000000 , &B00000000 , &B00000001
      Display All
    • Pluto25 wrote:

      In your Code /Oe and LE not used? Or only i ditn't see it.
      The 16227 should work with Code from 16206. Not korrect, half Dots ?
      PS You've a bad timing. This Time my Head is like :S a_27_b277ca12 a_28_2c02f089 ?( (Crazy Days)
      If you connect a new matrix to the board with this code, the matrix will not work. If you remove the power from the matrix for a few minutes, then after the power is applied, the matrix will work normally, but with very low brightness.
    • I tried it. It doesn't work. There is a special feature in the datasheet of the new chip. With double latch. The first one after the first 16 bits of data. Then after the second 16 bits. The old code does not work properly, as there is not enough data in the chip. I tried two latches, but it still didn't work.

      OE as a latch:

      Pwm1b = 0
      Waitus 50
      P_lat = 1 : Nop : Nop : P_lat = 0
      P_a = Page.0
      P_b = Page.1
      P_c = Page.2
      Pwm1b = Brightness
    • No Led on - so it could be max brightness? wrote:


      No. LED on = maximum brightness

      A floating Pin? Some not conneted? Power Supply-Voltage ok? - Yes! Everything is fully functional! When you turn on the new matrix with the old firmware, the matrix works normally with a brightness of 80-90% less.

      Try C0,38,1C,07,88 . May be it latches not as we want.
      How do I do this?
    • Test code. When flashing the controller, it is displayed correctly-as in the video. After resetting the power, the light is very dim.

      Source Code

      1. $regfile = "m328pdef.dat"
      2. $crystal = 16000000
      3. $hwstack = 64 : $swstack = 64 : $framesize = 80
      4. P_r1 Alias Portc.0 : Config P_r1 = Output
      5. P_g1 Alias Portc.1 : Config P_g1 = Output
      6. P_b1 Alias Portc.2 : Config P_b1 = Output
      7. P_r2 Alias Portc.3 : Config P_r2 = Output
      8. P_g2 Alias Portc.4 : Config P_g2 = Output
      9. P_b2 Alias Portc.5 : Config P_b2 = Output
      10. P_a Alias Portd.3 : Config P_a = Output
      11. P_b Alias Portd.4 : Config P_b = Output
      12. P_c Alias Portd.5 : Config P_c = Output
      13. P_ckl Alias Portb.5 : Config P_ckl = Output
      14. P_lat Alias Portb.3 : Config P_lat = Output
      15. P_oe Alias Portb.2 : Config P_oe = Output
      16. '***
      17. Config Base = 0
      18. Enable Interrupts
      19. Dim Page As Byte
      20. Dim N_1 As Word
      21. Dim N As Byte
      22. P_ckl = 0
      23. P_r2 = 0
      24. P_g1 = 0 : P_g2 = 0
      25. P_b1 = 0 : P_b2 = 0
      26. N = 0
      27. For N_1 = 0 To 19
      28. Shiftout P_g1 , P_ckl , N , 1
      29. Next N_1
      30. P_lat = 1 : P_lat = 0
      31. N = 1
      32. Shiftout P_g1 , P_ckl , N , 1
      33. P_lat = 1 : P_lat = 0
      34. P_oe = 1
      35. P_oe = 0
      36. Do
      37. '1 line
      38. Page = &B0000
      39. Gosub Next_step
      40. Wait 1
      41. '2 line
      42. Page = &B0001
      43. Gosub Next_step
      44. Wait 1
      45. '3 line
      46. Page = &B0010
      47. Gosub Next_step
      48. Wait 1
      49. '4 line
      50. Page = &B0011
      51. Gosub Next_step
      52. Wait 1
      53. '5 line
      54. Page = &B0100
      55. Gosub Next_step
      56. Wait 1
      57. Loop
      58. End
      59. Next_step:
      60. P_a = Page.0
      61. P_b = Page.1
      62. P_c = Page.2
      63. Return
      Display All
      Test Matrix
    • Pluto25 wrote:

      Try (21) Wait 1
      Does not work.

      Pluto25 wrote:

      There is a logic to set brightnis. The G0-G4. (Datashied 13) How to set them ? A third Byte before LE? A byte with LE High?
      As I understand the logic of the work.
      We send the first data packet (16 bytes).
      Snap the data P_late = 1 : P_lat = 0.
      Setting the brightness to 0.
      Invert outputs A and C. (I'm not really sure here)
      We take the next 16 bytes.
      Snap the data P_late = 1 : P_lat = 0.
      We raise the brightness. Invert outputs A and C
      Setting the brightness to 0
      Invert output B
      We raise the brightness.
      Or I'm very wrong. In this chip, the logic of working with two latches is very bad. All other similar chips have only one latch.
    • Here is the test code. On the left is the matrix that you have always worked with (GKGD). On the right is a new matrix.
      The program is set to work on 2 matrices.
      Each time a new matrix is flashed, it behaves strangely.

      Source Code

      1. $regfile = "m328def.dat"
      2. $crystal = 16000000
      3. $hwstack = 64
      4. $swstack = 64
      5. $framesize = 80
      6. Const Dy_num_h = 2
      7. Const Dy_num_v = 1
      8. Const Bytes_in_row = 5 * Dy_num_h
      9. Const Row_num = 20 * Dy_num_v
      10. Const Row_num1 = Row_num - 1
      11. Const Mem_size = Row_num * Bytes_in_row
      12. Const Mem_size_1 = Mem_size - 1
      13. Const Dy_offset = Dy_num_h * 100
      14. Const Channel_offset = 10 * Bytes_in_row
      15. Const Num_matr = 10 * Dy_num_h
      16. Const Index_add = 25 * Dy_num_h
      17. Const Index_sub = Index_add - 1
      18. '*** Pin for board 7 revision
      19. P_r1 Alias Portc.0 : Config P_r1 = Output
      20. P_g1 Alias Portc.1 : Config P_g1 = Output
      21. P_b1 Alias Portc.2 : Config P_b1 = Output
      22. P_r2 Alias Portc.3 : Config P_r2 = Output
      23. P_g2 Alias Portc.4 : Config P_g2 = Output
      24. P_b2 Alias Portc.5 : Config P_b2 = Output
      25. Const Dout_pin_r1 = Pc0
      26. Const Dout_pin_g1 = Pc1
      27. Const Dout_pin_b1 = Pc2
      28. Const Dout_pin_r2 = Pc3
      29. Const Dout_pin_g2 = Pc4
      30. Const Dout_pin_b2 = Pc5
      31. P_a Alias Portd.3 : Config P_a = Output
      32. P_b Alias Portd.4 : Config P_b = Output
      33. P_c Alias Portd.5 : Config P_c = Output
      34. P_ckl Alias Portb.5 : Config P_ckl = Output : Shift_clock_port Alias Portb : Const Shift_clock_pin = Pb5
      35. P_lat Alias Portb.3 : Config P_lat = Output
      36. P_oe Alias Portb.2 : Config P_oe = Output
      37. Dout_port Alias Portc
      38. Config Base = 0
      39. Const Timer0reload = 160
      40. Config Timer0 = Timer , Prescale = 256
      41. Load Timer0 , Timer0reload
      42. On Ovf0 Display_refresh
      43. Enable Ovf0
      44. Start Timer0
      45. 'PWM ************************************************** *************************
      46. Config Timer1 = Pwm , Pwm = 8 , Compare_b_pwm = Clear_down , Prescale = 1
      47. '************************************************* ******************************
      48. Declare Sub Set_text_12_16(byval X As Word , Byval Y As Word , Byval Color As Byte)
      49. Declare Sub Shift6out_4h(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      50. Declare Sub Shift6out_4l(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      51. Declare Sub Shift_left(byval Y As Word , Byval H As Word)
      52. Declare Sub Scroll_text_12_16(byval Y As Word , Byval Color As Byte)
      53. Dim Memory_red(mem_size) As Byte
      54. Dim Memory_green(mem_size) As Byte
      55. Dim Memory_blue(mem_size) As Byte
      56. Dim Text As String * 10
      57. Dim Trigger As Bit , Index_1 As Word , Index_2 As Word
      58. Dim Brightness As Byte
      59. Dim N_1 As Word , R_0 As Byte , D_1 As Word , Atemp As Byte , Page As Byte , Speed As Byte , N As Word
      60. Dim Tab_start As Word
      61. Dim Red As Byte , Green As Byte , Blue As Byte , Yellow As Byte , Magenta As Byte , Cyan As Byte , White As Byte
      62. Red = 1 : Green = 2 : Yellow = 3 : Blue = 4 : Magenta = 5 : Cyan = 6 : White = 7
      63. Dim Mem_s As Byte
      64. Brightness = 255
      65. Enable Interrupts
      66. Gosub Clear_memory
      67. Speed = 30
      68. Text = "890"
      69. Call Set_text_12_16(0 , 0 , White)
      70. Wait 1
      71. Gosub Clear_memory
      72. Do
      73. Text = "255 " : Call Scroll_text_12_16(0 , White)
      74. Text = "30 " : Call Scroll_text_12_16(0 , Green)
      75. Text = "150 " : Call Scroll_text_12_16(0 , Blue)
      76. Loop
      77. End
      78. Clear_memory:
      79. N_1 = 0
      80. D_1 = Memcopy(n_1 , Memory_red(0) , Mem_size , 2)
      81. D_1 = Memcopy(n_1 , Memory_green(0) , Mem_size , 2)
      82. D_1 = Memcopy(n_1 , Memory_blue(0) , Mem_size , 2)
      83. Brightness = 255
      84. Return
      85. Display_refresh:
      86. Incr Mem_s
      87. Load Timer0 , Timer0reload
      88. $asm
      89. Lds r17, {Page}
      90. Inc r17
      91. CPI r17,5
      92. brlo pageok
      93. clr r17
      94. Pageok:
      95. sts {Page},r17
      96. $end Asm
      97. For R_0 = 1 To Dy_num_v
      98. Atemp = R_0 - 1
      99. Atemp = Atemp * Dy_offset
      100. Index_1 = Page * Bytes_in_row
      101. Index_1 = Index_1 + Atemp
      102. Atemp = 0
      103. For D_1 = 1 To Num_matr
      104. Index_2 = Index_1 + Channel_offset
      105. If D_1.0 = 1 Then
      106. Shift6out_4h Memory_red(index_1) , Memory_green(index_1) , Memory_blue(index_1) , Memory_red(index_2) , Memory_green(index_2) , Memory_blue(index_2)
      107. Else
      108. Shift6out_4l Memory_red(index_1) , Memory_green(index_1) , Memory_blue(index_1) , Memory_red(index_2) , Memory_green(index_2) , Memory_blue(index_2)
      109. End If
      110. If Atemp = 0 Then
      111. Index_1 = Index_1 + Index_add
      112. $asm
      113. ! Lds r17, {atemp}
      114. ! Inc r17
      115. ! STS {atemp}, r17
      116. $end Asm
      117. Else
      118. Index_1 = Index_1 - Index_sub
      119. Atemp = 0
      120. End If
      121. Next D_1
      122. 'P_lat = 1 : P_lat = 0
      123. 'Pwm1b = 0
      124. Next R_0
      125. Pwm1b = 0
      126. Waitus 40
      127. P_lat = 1 : P_lat = 0
      128. P_a = Page.0
      129. P_b = Page.1
      130. P_c = Page.2
      131. Pwm1b = Brightness
      132. Trigger = 1
      133. Return
      134. Sub Shift6out_4h(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      135. $asm
      136. LDI r17,8
      137. Loop_shift2out:
      138. in R16, dout_port
      139. BST r18,0
      140. BLD r16,Dout_pin_r1
      141. BST r19,0
      142. bld r16,Dout_pin_g1
      143. BST r20,0
      144. bld r16,Dout_pin_b1
      145. BST r21,0
      146. BLD r16,Dout_pin_r2
      147. BST r22,0
      148. bld r16,Dout_pin_g2
      149. BST r23,0
      150. bld r16,Dout_pin_b2
      151. LSR r18
      152. LSR r19
      153. lsr r20
      154. lsr r21
      155. lsr r22
      156. lsr r23
      157. Out Dout_port , R16
      158. SBI shift_clock_Port, shift_clock_Pin
      159. dec r17
      160. CBI shift_clock_Port, shift_clock_Pin
      161. BRnE loop_shift2out
      162. $end Asm
      163. End Sub
      164. Sub Shift6out_4l(byreg R18 As Byte , Byreg R19 As Byte , Byreg R20 As Byte , Byreg R21 As Byte , Byreg R22 As Byte , Byreg R23 As Byte )
      165. $asm
      166. LDI r17,8
      167. Loop_shift2lout:
      168. in R16, dout_port
      169. BST r18,7
      170. BLD r16,Dout_pin_r1
      171. BST r19,7
      172. bld r16,Dout_pin_g1
      173. BST r20,7
      174. bld r16,Dout_pin_b1
      175. BST r21,7
      176. BLD r16,Dout_pin_r2
      177. BST r22,7
      178. bld r16,Dout_pin_g2
      179. BST r23,7
      180. bld r16,Dout_pin_b2
      181. LSl r18
      182. LSl r19
      183. lsl r20
      184. lsl r21
      185. lsl r22
      186. lsl r23
      187. Out Dout_port , R16
      188. SBI shift_clock_Port, shift_clock_Pin
      189. dec r17
      190. CBI shift_clock_Port, shift_clock_Pin
      191. BRnE loop_shift2lout
      192. $end Asm
      193. End Sub
      Display All
      test
    • SAMEGO wrote:

      Or I'm very wrong. In this chip, the logic of working with two latches
      I think so. This Chip drives 32 Leds? swiched by OE?
      Brigness by Software (g0-4)
      Please test in Testcode (#15) at 72
      toggle P_oe
      and a second test at 72
      P_lat = 1
      Shiftout P_g1 , P_ckl , N ,1
      P_lat = 0
      n=n+8
      if n>56 then n=0

      You know no Chinese Person who could read the Datashied ?