RGB Matrix module 20x40 1/5 scan GKGD - error of display of the image

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

    • Pluto25 wrote:

      tschoeatsch wrote:

      Darf ich mir keine Auszeit nehmen?
      Natürlich nicht :D , Wer rastet der rostet. :saint: Da lag ich ja mit der ersten Vermutung richtig.
      Hast Du eine fertige/schnellere Lösung oder Zeit und Lust dazu? Ich wäre vermutlich erst Sonntag abend mit der ersten Versuchsversion so weit.(keine Hardware, wenig Zeit)

      tschoeatsch wrote:

      Die Ausgabe so zurück bauen,
      Dann müsste Ausgabe und Erstellung geändert werden. In idealfall nur die Ausgabe. Matrix2 zeigt die jetzige Ausgabestelle des Speichers. (suboptimal ab der 5.Zeile) Vielleicht das schnellste die jetzige Erstellung auch mal so darzustellen wie die Ausgabe sein sollte um dann diese zu ändern. Erscheint mir Aufwändiger erspart aber die Änderung jeder Font Sub.
      Mike, hi! I myself already broke all brain.
    • New code of the test

      Source Code

      1. Const Dy_num_h = 1
      2. Const Dy_num_v = 1
      3. Const Bytes_in_row = 5 * Dy_num_h
      4. Const Row_num = 20 * Dy_num_v
      5. 'Const Row_num1 = Row_num - 1
      6. Const Mem_size = Row_num * Bytes_in_row
      7. Const Mem_size_1 = Mem_size - 1
      8. 'Const Bytes_to_send = Dy_num_h * Dy_num_v * 20
      9. Const Dy_offset = Dy_num_h * 100
      10. Const Channel_offset = 10 * Bytes_in_row
      11. 'Const Mem_offset_2 = 5 * Bytes_in_row
      12. $regfile = "m328pdef.dat"
      13. $crystal = 16000000
      14. $hwstack = 64 : $swstack = 64 : $framesize = 64
      15. P_r1 Alias Portd.5 : Config P_r1 = Output : Dout_port_r1 Alias Portd : Const Dout_pin_r1 = Pd5
      16. P_g1 Alias Portd.7 : Config P_g1 = Output : Dout_port_g1 Alias Portd : Const Dout_pin_g1 = Pd7
      17. P_b1 Alias Portd.6 : Config P_b1 = Output : Dout_port_b1 Alias Portd : Const Dout_pin_b1 = Pd6
      18. P_r2 Alias Portc.4 : Config P_r2 = Output : Dout_port_r2 Alias Portc : Const Dout_pin_r2 = Pc4
      19. P_g2 Alias Portc.3 : Config P_g2 = Output : Dout_port_g2 Alias Portc : Const Dout_pin_g2 = Pc3
      20. P_b2 Alias Portc.2 : Config P_b2 = Output : Dout_port_b2 Alias Portc : Const Dout_pin_b2 = Pc2
      21. P_a Alias Portc.0 : Config P_a = Output
      22. P_b Alias Portc.1 : Config P_b = Output
      23. P_c Alias Portb.0 : Config P_c = Output
      24. P_ckl Alias Portb.5 : Config P_ckl = Output : Shift_clock_port Alias Portb : Const Shift_clock_pin = Pb5
      25. P_lat Alias Portb.3 : Config P_lat = Output
      26. P_oe Alias Portb.2 : Config P_oe = Output
      27. Config Base = 0
      28. Const Timer2reload = 35
      29. Config Timer2 = Timer , Prescale = 1024
      30. Load Timer2 , Timer2reload
      31. On Ovf2 Display_refresh
      32. Enable Ovf2
      33. Start Timer2
      34. 'PWM ************************************************** *************************
      35. Config Timer1 = Pwm , Pwm = 8 , Compare_b_pwm = Clear_down , Prescale = 1
      36. '************************************************* ******************************
      37. Enable Interrupts
      38. 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 )
      39. Dim Memory_red(mem_size) As Byte
      40. Dim Memory_green(mem_size) As Byte
      41. Dim Memory_blue(mem_size) As Byte
      42. Dim Trigger As Bit
      43. Dim Brightness As Byte
      44. Dim N_1 As Word 'counter
      45. Dim Red As Byte , Green As Byte , Blue As Byte , Yellow As Byte , Magenta As Byte , Cyan As Byte , White As Byte
      46. Red = 1 : Green = 2 : Yellow = 3 : Blue = 4 : Magenta = 5 : Cyan = 6 : White = 7
      47. Dim Page As Byte
      48. Dim Mem_offset_1 As Word
      49. Dim R_0 As Byte , B_1 As Byte
      50. Dim St_byte_1 As Word , St_byte_2 As Word , St_byte_3 As Word , St_byte_4 As Word
      51. Brightness = 250
      52. Gosub Clear_memory
      53. Gosub Load_pic
      54. Do
      55. Loop
      56. End
      57. Clear_memory:
      58. For N_1 = 0 To Mem_size_1
      59. Memory_red(n_1) = 0
      60. Memory_green(n_1) = 0
      61. Memory_blue(n_1) = 0
      62. Next N_1
      63. Return
      64. Load_pic:
      65. For N_1 = 0 To Mem_size_1
      66. Memory_red(n_1) = Lookup(n_1 , Pic_data_red)
      67. ' Memory_green(n_1) = Lookup(n_1 , Pic_data_green)
      68. 'Memory_blue(n_1) = Lookup(n_1 , Pic_data_blue)
      69. Next N_1
      70. Return
      71. Display_refresh:
      72. Load Timer2 , Timer2reload
      73. If Page < 4 Then
      74. Incr Page
      75. Else
      76. Page = 0
      77. End If
      78. Mem_offset_1 = Page
      79. For R_0 = 1 To Dy_num_v
      80. St_byte_1 = Mem_offset_1 : St_byte_2 = St_byte_1 + 5
      81. St_byte_3 = St_byte_1 + Channel_offset : St_byte_4 = St_byte_3 + 5
      82. For B_1 = 1 To 5
      83. Shift6out Memory_red(st_byte_1) , Memory_green(st_byte_1) , Memory_blue(st_byte_1) , Memory_red(st_byte_3) , Memory_green(st_byte_3) , Memory_blue(st_byte_3)
      84. Shift6out Memory_red(st_byte_2) , Memory_green(st_byte_2) , Memory_blue(st_byte_2) , Memory_red(st_byte_4) , Memory_green(st_byte_4) , Memory_blue(st_byte_4)
      85. St_byte_1 = St_byte_1 + 10
      86. St_byte_2 = St_byte_2 + 10
      87. St_byte_3 = St_byte_3 + 10
      88. St_byte_4 = St_byte_4 + 10
      89. Next B_1
      90. Mem_offset_1 = Mem_offset_1 + Dy_offset
      91. Next R_0
      92. Pwm1b = 0
      93. Waitus 100
      94. P_lat = 1 : P_lat = 0
      95. P_a = Page.0
      96. P_b = Page.1
      97. P_c = Page.2
      98. Pwm1b = Brightness
      99. Trigger = 1
      100. Return
      101. ' R1 G1 B1 R2 G2 B2
      102. 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 )
      103. $asm
      104. LDI r17,8
      105. Loop_shift2out:
      106. in R16, dout_port_r1
      107. BST r18,7
      108. BLD r16,Dout_pin_r1
      109. Out Dout_port_r1 , R16
      110. in R16, dout_port_g1
      111. BST r19,7
      112. bld r16,Dout_pin_g1
      113. Out Dout_port_g1 , R16
      114. in R16, dout_port_b1
      115. BST r20,7
      116. bld r16,Dout_pin_b1
      117. Out Dout_port_b1 , R16
      118. in R16, dout_port_r2
      119. BST r21,7
      120. BLD r16,Dout_pin_r2
      121. Out Dout_port_r2 , R16
      122. in R16, dout_port_g2
      123. BST r22,7
      124. bld r16,Dout_pin_g2
      125. Out Dout_port_g2 , R16
      126. in R16, dout_port_b2
      127. BST r23,7
      128. bld r16,Dout_pin_b2
      129. Out Dout_port_b2 , R16
      130. SBI shift_clock_Port, shift_clock_Pin
      131. LSl r18
      132. LSl r19
      133. lsl r20
      134. lsl r21
      135. lsl r22
      136. lsl r23
      137. dec r17
      138. CBI shift_clock_Port, shift_clock_Pin
      139. BRnE loop_shift2out
      140. $end Asm
      141. End Sub
      142. Pic_data_red:
      143. Data &B11000001 , &B11100001 , &B11110001 , &B11111001 , &B11111101
      144. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      145. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      146. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      147. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      148. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      149. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      150. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      151. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      152. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      153. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      154. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      155. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      156. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      157. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      158. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      159. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
      160. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00111111
      161. Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00011111
      162. Data &B00000000 , &B00000000 , &B00000000 , &B00001111 , &B00000111
      163. Pic_data_green:
      164. Pic_data_blue:
      Display All
      image_8.jpg
    • It works bedder then the nibbels Now jumped the hole Byte

      "Red(94) was B00011111 - Yes!" Not only jump; MSB changed too
      Back too roots?
      Maybe you try this


      Source Code

      1. Display_refresh:
      2. Load Timer2 , Timer2reload
      3. Page=0
      4. For R_0=0 to 49 ' (99?)
      5. B_1=R_0 +128
      6. Shift6out(R_0,0,0,B_1,0,0)
      7. Next R_0
      8. Pwm1b = 0
      9. Waitus 100
      10. P_lat = 1 : P_lat = 0
      11. P_a = Page.0
      12. P_b = Page.1
      13. P_c = Page.2
      14. Pwm1b = Brightness
      15. Trigger = 1
      16. Return
      Display All

    • Pluto25 wrote:

      It works bedder then the nibbels Now jumped the hole Byte

      "Red(94) was B00011111 - Yes!" Not only jump; MSB changed too
      Back too roots?
      Maybe you try this


      Source Code

      1. Display_refresh:
      2. Load Timer2 , Timer2reload
      3. Page=0
      4. For R_0=0 to 49 ' (99?)
      5. B_1=R_0 +128
      6. Shift6out(R_0,0,0,B_1,0,0)
      7. Next R_0
      8. Pwm1b = 0
      9. Waitus 100
      10. P_lat = 1 : P_lat = 0
      11. P_a = Page.0
      12. P_b = Page.1
      13. P_c = Page.2
      14. Pwm1b = Brightness
      15. Trigger = 1
      16. Return
      Display All

      Once, the screen blinking with different pixels. Also it was switched off.
    • Only Once? MAybe it needs the Pages. change Page=0 with :
      If Page < 4 Then
      Incr Page
      Else
      Page = 0
      End If
      different pixels are ok, If it works it looks not fine but the Positions can be find.
      Wait there isn't Time to send all.
      This shoud work:

      Source Code

      1. Display_refresh:
      2. Load Timer2 , Timer2reload
      3. If Page < 4 Then
      4. Incr Page
      5. Else
      6. Page = 0
      7. End If
      8. For R_0=0 to 49 ' (99?)
      9. blue=r_0+page
      10. B_1=R_0 +128
      11. Shift6out(blue,0,0,B_1,0,0)
      12. Next R_0
      13. Pwm1b = 0
      14. Waitus 100
      15. P_lat = 1 : P_lat = 0
      16. P_a = Page.0
      17. P_b = Page.1
      18. P_c = Page.2
      19. Pwm1b = Brightness
      20. Trigger = 1
      21. Return
      Display All

      The post was edited 2 times, last by Pluto25 ().

    • sorry B_1 . This shoud make usefull resuld

      Source Code

      1. Display_refresh:
      2. Load Timer2 , Timer2reload
      3. If Page < 4 Then
      4. Incr Page
      5. Else
      6. Page = 0
      7. End If
      8. For R_0=0 to 49 ' (99?)
      9. blue=r_0+page
      10. B_1=blue +128
      11. Shift6out(blue,0,0,B_1,0,0)
      12. Next R_0
      13. Pwm1b = 0
      14. Waitus 100
      15. P_lat = 1 : P_lat = 0
      16. P_a = Page.0
      17. P_b = Page.1
      18. P_c = Page.2
      19. Pwm1b = Brightness
      20. Trigger = 1
      21. Return
      Display All
    • New test code

      Source Code

      1. Const Dy_num_h = 1 'displays in a horizontal direction
      2. Const Dy_num_v = 1 'displays in the vertical direction
      3. Const Row_num = 20
      4. Const Col_num = 5
      5. Const Bytes_in_row = Col_num * Dy_num_h
      6. Const Row_num1 = Row_num - 1
      7. Const Col_num_1 = Col_num - 1
      8. Const Mem_size = Row_num * Bytes_in_row
      9. Const Mem_size_1 = Mem_size - 1
      10. Const Dy_offset = Dy_num_h * 100
      11. Const Channel_offset = 10 * Bytes_in_row
      12. Const Last_col_byte = Mem_size - Row_num
      13. $regfile = "m328pdef.dat"
      14. $crystal = 16000000
      15. $hwstack = 64 : $swstack = 64 : $framesize = 120
      16. P_r1 Alias Portd.5 : Config P_r1 = Output : Dout_port_r1 Alias Portd : Const Dout_pin_r1 = Pd5
      17. P_g1 Alias Portd.7 : Config P_g1 = Output : Dout_port_g1 Alias Portd : Const Dout_pin_g1 = Pd7
      18. P_b1 Alias Portd.6 : Config P_b1 = Output : Dout_port_b1 Alias Portd : Const Dout_pin_b1 = Pd6
      19. P_r2 Alias Portc.4 : Config P_r2 = Output : Dout_port_r2 Alias Portc : Const Dout_pin_r2 = Pc4
      20. P_g2 Alias Portc.3 : Config P_g2 = Output : Dout_port_g2 Alias Portc : Const Dout_pin_g2 = Pc3
      21. P_b2 Alias Portc.2 : Config P_b2 = Output : Dout_port_b2 Alias Portc : Const Dout_pin_b2 = Pc2
      22. P_a Alias Portc.0 : Config P_a = Output
      23. P_b Alias Portc.1 : Config P_b = Output
      24. P_c Alias Portb.0 : Config P_c = Output
      25. P_ckl Alias Portb.5 : Config P_ckl = Output
      26. P_lat Alias Portb.3 : Config P_lat = Output
      27. P_oe Alias Portb.2 : Config P_oe = Output
      28. Shift_clock_port Alias Portb : Const Shift_clock_pin = Pb5
      29. Const Timer2reload = 15
      30. Config Timer2 = Timer , Prescale = 1024
      31. Load Timer2 , Timer2reload
      32. On Ovf2 Display_refresh
      33. Enable Ovf2
      34. Start Timer2
      35. 'PWM ************************************************** *************************
      36. Config Timer1 = Pwm , Pwm = 8 , Compare B Pwm = Clear Down , Prescale = 1
      37. '************************************************* ******************************
      38. Dim Memory_red(mem_size) As Byte , Memory_green(mem_size) As Byte , Memory_blue(mem_size) As Byte 'memory red/green
      39. Dim Page_counter As Byte
      40. Dim D_1 As Word , D_2 As Byte 'counter in isr
      41. Dim Index_1 As Word , Index_2 As Word
      42. Dim Character_column As Byte
      43. Dim Font_byte_low As Byte , Font_byte_high As Byte
      44. Dim N_1 As Word , N_11 As Word , N_12 As Word , N_13 As Word 'counter
      45. 'Dim N_2 As Word , N_21 As Word , N_22 As Word , N_23 As Word 'counter
      46. 'Dim N_3 As Word , N_31 As Word
      47. Dim M_1 As Word , M_2 As Word , M_21 As Word , M_22 As Word , M_23 As Word , M_24 As Word , M_25 As Word
      48. Dim Sign As String * 1
      49. Dim Tab_start As Word 'Startwert der Fonttabelle
      50. Dim X1 As Word
      51. Dim Inverting As Bit
      52. Dim Speed As Word
      53. Dim Text As String * 15
      54. Dim Text_baseline As Word , Max_baseline As Word
      55. Dim Startbyte_low As Word , Startbyte_high As Word , Text_top_line As Word , Bit_num As Byte
      56. Dim Trigger As Bit
      57. Dim N As Word 'counter in main
      58. Dim Inv1 As Bit , Inv As Bit
      59. Dim Color As Byte , Red As Byte , Green As Byte , Blue As Byte , Yellow As Byte , Magenta As Byte , Cyan As Byte , White As Byte
      60. Dim Brightness As Byte , Ascii_sign As Byte
      61. Dim Hh As Byte
      62. 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 )
      63. Declare Sub Set_text_6_8(byval X As Word , Byval Y As Word , Byval Color As Byte)
      64. Red = 1 : Green = 2 : Yellow = 3 : Blue = 4 : Magenta = 5 : Cyan = 6 : White = 7
      65. '**************************************************
      66. 'user settings
      67. Inverting = 0
      68. '**************************************************
      69. Brightness = 25
      70. Gosub Clear_memory
      71. Enable Interrupts
      72. Inv = 0
      73. Text = "374 2"
      74. Call Set_text_6_8(0 , 0 , Green)
      75. Do
      76. Loop
      77. End
      78. Display_refresh:
      79. Load Timer2 , Timer2reload
      80. If Page_counter < 4 Then
      81. Incr Page_counter
      82. Else
      83. Page_counter = 0
      84. End If
      85. Index_1 = 5 - Page_counter
      86. For D_1 = 1 To 8
      87. Index_2 = Index_1 + 5
      88. Shift6out Memory_red(index_2) , Memory_green(index_2) , Memory_blue(index_2) , Memory_red(index_1) , Memory_green(index_1) , Memory_blue(index_1)
      89. Index_1 = Index_1 + 10
      90. Next D_1
      91. 'Index_2 = Index_1
      92. Shift6out Memory_red(index_2) , Memory_green(index_2) , Memory_blue(index_2) , Memory_red(index_1) , Memory_green(index_1) , Memory_blue(index_1)
      93. Pwm1b = 0
      94. Waitus 100
      95. P_lat = 1 : P_lat = 0
      96. P_a = Page_counter.0
      97. P_b = Page_counter.1
      98. P_c = Page_counter.2
      99. Pwm1b = Brightness
      100. Trigger = 1
      101. Return
      102. ' R1 G1 B1 R2 G2 B2
      103. 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 )
      104. $asm
      105. LDI r17,8
      106. Loop_shift2out:
      107. in R16, dout_port_r1
      108. BST r18,0
      109. BLD r16,Dout_pin_r1
      110. Out Dout_port_r1 , R16
      111. in R16, dout_port_g1
      112. BST r19,0
      113. bld r16,Dout_pin_g1
      114. Out Dout_port_g1 , R16
      115. in R16, dout_port_b1
      116. BST r20,0
      117. bld r16,Dout_pin_b1
      118. Out Dout_port_b1 , R16
      119. in R16, dout_port_r2
      120. BST r21,0
      121. BLD r16,Dout_pin_r2
      122. Out Dout_port_r2 , R16
      123. in R16, dout_port_g2
      124. BST r22,0
      125. bld r16,Dout_pin_g2
      126. Out Dout_port_g2 , R16
      127. in R16, dout_port_b2
      128. BST r23,0
      129. bld r16,Dout_pin_b2
      130. Out Dout_port_b2 , R16
      131. SBI shift_clock_Port, shift_clock_Pin
      132. LSR r18
      133. LSR r19
      134. lsr r20
      135. lsr r21
      136. lsr r22
      137. lsr r23
      138. dec r17
      139. CBI shift_clock_Port, shift_clock_Pin
      140. BRnE loop_shift2out
      141. $end Asm
      142. End Sub
      143. Clear_memory:
      144. For N_1 = 0 To Mem_size_1
      145. Memory_red(n_1) = 0
      146. Memory_green(n_1) = 0
      147. Memory_blue(n_1) = 0
      148. Next N_1
      149. Return
      150. Sub Set_text_6_8(byval X As Word , Byval Y As Word , Byval Color As Byte)
      151. Local Col As Word
      152. '6x8font
      153. Max_baseline = Row_num - 8
      154. If Y > Max_baseline Then Y = Max_baseline
      155. Inv1 = Inverting Xor Inv
      156. For M_1 = 1 To Len(text)
      157. Sign = Mid(text , M_1 , 1) 'Only one letter
      158. Tab_start = Asc(sign)
      159. Tab_start = Tab_start - 32
      160. Tab_start = Tab_start * 6 'Starting point in the font table
      161. For Character_column = 0 To 5
      162. Bit_num = X Mod 8 'bit-number of byte
      163. Col = X / 8 'number of column
      164. Startbyte_low = Col * Row_num
      165. Startbyte_low = Startbyte_low + Y
      166. If Startbyte_low > Mem_size_1 Then Exit Sub 'there is no space, you are ready
      167. X1 = Tab_start + Character_column
      168. Font_byte_low = Lookup(x1 , Font_6x8)
      169. For M_2 = 0 To 7
      170. M_22 = Startbyte_low + M_2
      171. If Color.0 = 1 Then 'red
      172. If Inv1 = 1 Then
      173. Memory_red(m_22).bit_num = Not Font_byte_low.m_2
      174. Else
      175. Memory_red(m_22).bit_num = Font_byte_low.m_2
      176. End If
      177. Else
      178. Memory_red(m_22).bit_num = Inverting
      179. End If
      180. If Color.1 = 1 Then 'green
      181. If Inv1 = 1 Then
      182. Memory_green(m_22).bit_num = Not Font_byte_low.m_2
      183. Else
      184. Memory_green(m_22).bit_num = Font_byte_low.m_2
      185. End If
      186. Else
      187. Memory_green(m_22).bit_num = Inverting
      188. End If
      189. If Color.2 = 1 Then 'blue
      190. If Inv1 = 1 Then
      191. Memory_blue(m_22).bit_num = Not Font_byte_low.m_2
      192. Else
      193. Memory_blue(m_22).bit_num = Font_byte_low.m_2
      194. End If
      195. Else
      196. Memory_blue(m_22).bit_num = Inverting
      197. End If
      198. Next M_2
      199. Incr X
      200. Next Character_column
      201. Next M_1
      202. End Sub
      203. Font_6x8:
      204. Data 0 , 0 , 0 , 0 , 0 , 0 ' <SPACE>
      205. Data 0 , 0 , 96 , 250 , 96 , 0 ' !
      206. Data 0 , 224 , 192 , 0 , 224 , 192 ' "
      207. Data 0 , 48 , 64 , 254 , 64 , 48 ' #
      208. Data 0 , 24 , 4 , 254 , 4 , 24 ' $
      209. Data 0 , 16 , 56 , 84 , 84 , 16 ' %
      210. Data 0 , 16 , 84 , 84 , 56 , 16 ' &
      211. Data 0 , 0 , 224 , 192 , 0 , 0 ' <ZAP>
      212. Data 48 , 96 , 255 , 255 , 96 , 48 ' (
      213. Data 12 , 6 , 255 , 255 , 6 , 12 ' )
      214. Data 24 , 60 , 126 , 90 , 24 , 24 ' *
      215. Data 16 , 16 , 124 , 16 , 16 , 0 ' +
      216. Data 0 , 0 , 7 , 6 , 0 , 0 ' ,
      217. Data 0 , 16 , 16 , 16 , 16 , 16 ' -
      218. Data 0 , 0 , 6 , 6 , 0 , 0 ' .
      219. Data 2 , 4 , 8 , 16 , 32 , 64 ' /
      220. Data 0 , 124 , 138 , 146 , 162 , 124 ' 0
      221. Data 0 , 0 , 66 , 254 , 2 , 0 ' 1
      222. Data 0 , 70 , 138 , 146 , 146 , 98 ' 2
      223. Data 0 , 68 , 146 , 146 , 146 , 108 ' 3
      224. Data 0 , 24 , 40 , 72 , 254 , 8 ' 4
      225. Data 0 , 228 , 162 , 162 , 162 , 156 ' 5
      226. Data 0 , 60 , 82 , 146 , 146 , 12 ' 6
      227. Data 0 , 192 , 142 , 144 , 160 , 192 ' 7
      228. Data 0 , 108 , 146 , 146 , 146 , 108 ' 8
      229. Data 0 , 96 , 146 , 146 , 148 , 120 ' 9
      Display All
      image_12.jpg
    • I think that 's not the right option.
      Probably need to change this code

      Source Code

      1. Display_refresh:
      2. Load Timer2 , Timer2reload
      3. If Page < 4 Then
      4. Incr Page
      5. Else
      6. Page = 0
      7. End If
      8. Select Case Page
      9. Case 0:
      10. Mem_offset_1 = 0 * Bytes_in_row
      11. Mem_offset_3 = 5 * Bytes_in_row 'page=1
      12. Case 1:
      13. Mem_offset_1 = 1 * Bytes_in_row
      14. Mem_offset_3 = 6 * Bytes_in_row 'page=2
      15. Case 2:
      16. Mem_offset_1 = 2 * Bytes_in_row
      17. Mem_offset_3 = 7 * Bytes_in_row 'page=3
      18. Case 3:
      19. Mem_offset_1 = 3 * Bytes_in_row
      20. Mem_offset_3 = 8 * Bytes_in_row 'page=4
      21. Case 4:
      22. Mem_offset_1 = 4 * Bytes_in_row
      23. Mem_offset_3 = 9 * Bytes_in_row 'page=5
      24. End Select
      25. For R_0 = 1 To Dy_num_h
      26. St_byte_1 = Mem_offset_1 : St_byte_2 = St_byte_1 + Channel_offset 'set start-bytes
      27. St_byte_3 = Mem_offset_3 : St_byte_4 = St_byte_3 + Channel_offset
      28. For B_1 = 1 To Bytes_in_row
      29. 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)
      30. 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)
      31. 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)
      32. 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)
      33. St_byte_1 = St_byte_1 + 1
      34. St_byte_2 = St_byte_2 + 1
      35. St_byte_3 = St_byte_3 + 1
      36. St_byte_4 = St_byte_4 + 1
      37. Next B_1
      38. Mem_offset_1 = Mem_offset_1 + Dy_offset
      39. Mem_offset_3 = Mem_offset_3 + Dy_offset
      40. Next R_0
      41. Pwm1b = 0
      42. Waitus 100
      43. P_lat = 1 : P_lat = 0
      44. P_a = Page.0
      45. P_b = Page.1
      46. P_c = Page.2
      47. Pwm1b = Brightness
      48. Return
      49. ' R1 G1 B1 R2 G2 B2
      50. 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 )
      51. 'bit7 first to bit4
      52. $asm
      53. LDI r17,4 ;only 4 bits
      54. Loop_shift2out_h:
      55. in R16, dout_port_r1
      56. BST r18,7
      57. BLD r16,Dout_pin_r1
      58. Out Dout_port_r1 , R16
      59. in R16, dout_port_g1
      60. BST r19,7
      61. bld r16,Dout_pin_g1
      62. Out Dout_port_g1 , R16
      63. in R16, dout_port_b1
      64. BST r20,7
      65. bld r16,Dout_pin_b1
      66. Out Dout_port_b1 , R16
      67. in R16, dout_port_r2
      68. BST r21,7
      69. BLD r16,Dout_pin_r2
      70. Out Dout_port_r2 , R16
      71. in R16, dout_port_g2
      72. BST r22,7
      73. bld r16,Dout_pin_g2
      74. Out Dout_port_g2 , R16
      75. in R16, dout_port_b2
      76. BST r23,7
      77. bld r16,Dout_pin_b2
      78. Out Dout_port_b2 , R16
      79. SBI shift_clock_Port, shift_clock_Pin
      80. LSl r18
      81. LSl r19
      82. lsl r20
      83. lsl r21
      84. lsl r22
      85. lsl r23
      86. dec r17
      87. CBI shift_clock_Port, shift_clock_Pin
      88. BRnE loop_shift2out_h ; if = 0 exit
      89. $end Asm
      90. End Sub
      91. 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 )
      92. 'bit3 first to bit0
      93. $asm
      94. LDI r17,4 ;only 4 bits
      95. Loop_shift2out_l:
      96. in R16, dout_port_r1
      97. BST r18,3 ;start with bit3
      98. BLD r16,Dout_pin_r1
      99. Out Dout_port_r1 , R16
      100. in R16, dout_port_g1
      101. BST r19,3
      102. bld r16,Dout_pin_g1
      103. Out Dout_port_g1 , R16
      104. in R16, dout_port_b1
      105. BST r20,3
      106. bld r16,Dout_pin_b1
      107. Out Dout_port_b1 , R16
      108. in R16, dout_port_r2
      109. BST r21,3
      110. BLD r16,Dout_pin_r2
      111. Out Dout_port_r2 , R16
      112. in R16, dout_port_g2
      113. BST r22,3
      114. bld r16,Dout_pin_g2
      115. Out Dout_port_g2 , R16
      116. in R16, dout_port_b2
      117. BST r23,3
      118. bld r16,Dout_pin_b2
      119. Out Dout_port_b2 , R16
      120. SBI shift_clock_Port, shift_clock_Pin
      121. LSl r18
      122. LSl r19
      123. lsl r20
      124. lsl r21
      125. lsl r22
      126. lsl r23
      127. dec r17
      128. CBI shift_clock_Port, shift_clock_Pin
      129. BRnE loop_shift2out_l ; if = 0 exit
      130. $end Asm
      131. End Sub
      Display All
    • New code. New mistakes :)

      video - GKGD matrix

      Source Code

      1. '20x40 Ledmatrixes RGB, 1_5 scan
      2. $regfile = "m328pdef.dat"
      3. $crystal = 16000000
      4. $hwstack = 64 : $swstack = 64 : $framesize = 64
      5. Const Dy_num_h = 1 'displays in a horizontal direction
      6. Const Dy_num_v = 1 'displays in the vertical direction
      7. Const Bytes_in_row = 5 * Dy_num_v
      8. Const Row_num = 20 * Dy_num_h
      9. Const Row_num1 = Row_num - 1
      10. Const Mem_size = Row_num * Bytes_in_row
      11. Const Mem_size_1 = Mem_size - 1
      12. Const Dy_offset = Dy_num_v * 100
      13. Const Channel_offset = 10 * Bytes_in_row
      14. 'ports--------------------
      15. P_r1 Alias Portd.5 : Config P_r1 = Output : Dout_port_r1 Alias Portd : Const Dout_pin_r1 = Pd5
      16. P_g1 Alias Portd.7 : Config P_g1 = Output : Dout_port_g1 Alias Portd : Const Dout_pin_g1 = Pd7
      17. P_b1 Alias Portd.6 : Config P_b1 = Output : Dout_port_b1 Alias Portd : Const Dout_pin_b1 = Pd6
      18. P_r2 Alias Portc.4 : Config P_r2 = Output : Dout_port_r2 Alias Portc : Const Dout_pin_r2 = Pc4
      19. P_g2 Alias Portc.3 : Config P_g2 = Output : Dout_port_g2 Alias Portc : Const Dout_pin_g2 = Pc3
      20. P_b2 Alias Portc.2 : Config P_b2 = Output : Dout_port_b2 Alias Portc : Const Dout_pin_b2 = Pc2
      21. P_a Alias Portc.0 : Config P_a = Output
      22. P_b Alias Portc.1 : Config P_b = Output
      23. P_c Alias Portb.0 : Config P_c = Output
      24. P_ckl Alias Portb.5 : Config P_ckl = Output : Shift_clock_port Alias Portb : Const Shift_clock_pin = Pb5
      25. P_lat Alias Portb.3 : Config P_lat = Output
      26. P_oe Alias Portb.2 : Config P_oe = Output
      27. Config Base = 0
      28. Const Timer2reload = 70000
      29. Config Timer2 = Timer , Prescale = 256
      30. Load Timer2 , Timer2reload
      31. On Ovf2 Display_refresh
      32. Enable Ovf2
      33. Start Timer2
      34. 'PWM ************************************************** *************************
      35. Config Timer1 = Pwm , Pwm = 8 , Compare_b_pwm = Clear_down , Prescale = 1
      36. '************************************************* ******************************
      37. 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 )
      38. 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 )
      39. Declare Sub Set_text_6_8(byval X As Word , Byval Y As Word , Byval Color As Byte)
      40. Dim Memory_red(mem_size) As Byte , Memory_green(mem_size) As Byte , Memory_blue(mem_size) As Byte , N_1 As Word
      41. Dim Brightness As Byte
      42. Dim Red As Byte , Green As Byte , Blue As Byte , Yellow As Byte , Magenta As Byte , Cyan As Byte , White As Byte
      43. Red = 1 : Green = 2 : Yellow = 3 : Blue = 4 : Magenta = 5 : Cyan = 6 : White = 7
      44. Dim Text As String * 10
      45. Dim Tab_start As Word
      46. Dim Page As Byte
      47. Dim Mem_offset_1 As Word , Mem_offset_3 As Word
      48. Dim R_0 As Byte , B_1 As Byte
      49. Dim St_byte_1 As Word , St_byte_2 As Word , St_byte_3 As Word , St_byte_4 As Word
      50. Dim Trigger As Bit
      51. Dim H As Byte , Speed As Byte
      52. Enable Interrupts
      53. Gosub Clear_memory
      54. Brightness = 90
      55. Speed = 20
      56. 'Text = "0"
      57. 'Call Set_text_6_8(0 , 0 , Green)
      58. Do
      59. For H = 0 To 99
      60. Memory_green(h) = &B10000000
      61. Waitms Speed
      62. Memory_green(h) = &B11000000
      63. Waitms Speed
      64. Memory_green(h) = &B11100000
      65. Waitms Speed
      66. Memory_green(h) = &B11110000
      67. Waitms Speed
      68. Memory_green(h) = &B11111000
      69. Waitms Speed
      70. Memory_green(h) = &B11111100
      71. Waitms Speed
      72. Memory_green(h) = &B11111110
      73. Waitms Speed
      74. Memory_green(h) = &B11111111
      75. Waitms Speed
      76. Next H
      77. Wait 5
      78. Gosub Clear_memory
      79. Loop
      80. End
      81. Clear_memory:
      82. For N_1 = 0 To Mem_size_1
      83. Memory_red(n_1) = 0
      84. Memory_green(n_1) = 0
      85. Memory_blue(n_1) = 0
      86. Next N_1
      87. Return
      88. 'Interrupt service
      89. Display_refresh:
      90. Load Timer2 , Timer2reload
      91. If Page < 4 Then
      92. Incr Page
      93. Else
      94. Page = 0
      95. End If
      96. Select Case Page
      97. Case 0:
      98. Mem_offset_1 = 0
      99. Mem_offset_3 = 25 'page=1
      100. Case 1:
      101. Mem_offset_1 = 5
      102. Mem_offset_3 = 30 'page=2
      103. Case 2:
      104. Mem_offset_1 = 10
      105. Mem_offset_3 = 35 'page=3
      106. Case 3:
      107. Mem_offset_1 = 15
      108. Mem_offset_3 = 40 'page=4
      109. Case 4:
      110. Mem_offset_1 = 20
      111. Mem_offset_3 = 45 'page=5
      112. End Select
      113. For R_0 = 1 To Dy_num_h
      114. St_byte_1 = Mem_offset_3 : St_byte_2 = St_byte_1 + 50
      115. St_byte_3 = Mem_offset_1 : St_byte_4 = St_byte_3 + 50
      116. For B_1 = 1 To Bytes_in_row
      117. Shift6out_4h Memory_red(0) , Memory_green(st_byte_3) , Memory_blue(0) , Memory_red(0) , Memory_green(st_byte_4) , Memory_blue(0)
      118. Shift6out_4l Memory_red(0) , Memory_green(st_byte_3) , Memory_blue(0) , Memory_red(0) , Memory_green(st_byte_4) , Memory_blue(0)
      119. Shift6out_4h Memory_red(0) , Memory_green(st_byte_1) , Memory_blue(0) , Memory_red(0) , Memory_green(st_byte_2) , Memory_blue(0)
      120. Shift6out_4l Memory_red(0) , Memory_green(st_byte_1) , Memory_blue(0) , Memory_red(0) , Memory_green(st_byte_2) , Memory_blue(0)
      121. St_byte_1 = St_byte_1 + 1
      122. St_byte_2 = St_byte_2 + 1
      123. St_byte_3 = St_byte_3 + 1
      124. St_byte_4 = St_byte_4 + 1
      125. Next B_1
      126. Mem_offset_1 = Mem_offset_1 + Dy_offset
      127. Mem_offset_3 = Mem_offset_3 + Dy_offset
      128. Next R_0
      129. Pwm1b = 0
      130. Waitus 100
      131. P_lat = 1 : P_lat = 0
      132. P_a = Page.0
      133. P_b = Page.1
      134. P_c = Page.2
      135. Pwm1b = Brightness
      136. Trigger = 1
      137. Return
      138. ' R1 G1 B1 R2 G2 B2
      139. 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 )
      140. 'bit7 first to bit4
      141. $asm
      142. LDI r17,4 ;only 4 bits
      143. Loop_shift2out_h:
      144. in R16, dout_port_r1
      145. BST r18,7
      146. BLD r16,Dout_pin_r1
      147. Out Dout_port_r1 , R16
      148. in R16, dout_port_g1
      149. BST r19,7
      150. bld r16,Dout_pin_g1
      151. Out Dout_port_g1 , R16
      152. in R16, dout_port_b1
      153. BST r20,7
      154. bld r16,Dout_pin_b1
      155. Out Dout_port_b1 , R16
      156. in R16, dout_port_r2
      157. BST r21,7
      158. BLD r16,Dout_pin_r2
      159. Out Dout_port_r2 , R16
      160. in R16, dout_port_g2
      161. BST r22,7
      162. bld r16,Dout_pin_g2
      163. Out Dout_port_g2 , R16
      164. in R16, dout_port_b2
      165. BST r23,7
      166. bld r16,Dout_pin_b2
      167. Out Dout_port_b2 , R16
      168. SBI shift_clock_Port, shift_clock_Pin
      169. LSl r18
      170. LSl r19
      171. lsl r20
      172. lsl r21
      173. lsl r22
      174. lsl r23
      175. dec r17
      176. CBI shift_clock_Port, shift_clock_Pin
      177. BRnE loop_shift2out_h ; if = 0 exit
      178. $end Asm
      179. End Sub
      180. 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 )
      181. 'bit3 first to bit0
      182. $asm
      183. LDI r17,4 ;only 4 bits
      184. Loop_shift2out_l:
      185. in R16, dout_port_r1
      186. BST r18,3 ;start with bit3
      187. BLD r16,Dout_pin_r1
      188. Out Dout_port_r1 , R16
      189. in R16, dout_port_g1
      190. BST r19,3
      191. bld r16,Dout_pin_g1
      192. Out Dout_port_g1 , R16
      193. in R16, dout_port_b1
      194. BST r20,3
      195. bld r16,Dout_pin_b1
      196. Out Dout_port_b1 , R16
      197. in R16, dout_port_r2
      198. BST r21,3
      199. BLD r16,Dout_pin_r2
      200. Out Dout_port_r2 , R16
      201. in R16, dout_port_g2
      202. BST r22,3
      203. bld r16,Dout_pin_g2
      204. Out Dout_port_g2 , R16
      205. in R16, dout_port_b2
      206. BST r23,3
      207. bld r16,Dout_pin_b2
      208. Out Dout_port_b2 , R16
      209. SBI shift_clock_Port, shift_clock_Pin
      210. LSl r18
      211. LSl r19
      212. lsl r20
      213. lsl r21
      214. lsl r22
      215. lsl r23
      216. dec r17
      217. CBI shift_clock_Port, shift_clock_Pin
      218. BRnE loop_shift2out_l ; if = 0 exit
      219. $end Asm
      220. End Sub
      Display All
    • This is the German BASCOM-forum. As you have realized by getting answers there is no ban or something like that on other languages but to my mind it is some kind of natural to keep German as the language in this German forum and to go to the mcselec-forum when discussing topics in english language. There is no political reason behind that. Exceptions may happen for quick questions or so. See: Not everyone here is able to follow a conversation in english.
      You can continue and finalize this thread - I just suggested to use German in this forum in future threads.
      Thank you for your understanding
      Stefan