RGB MATRIX Module P5 SMD, 64x32pix and Atmega-128

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • Ok, now the display is dark during the entire display_refresh isr. Approx. 0.3 mSec.


      Mal so zwischendurch. Ich lasse ja babelfish für mich übersetzen und manchmal meint babelfish einen Spaß machen zu müssen
      lustiger babelfish.PNG
      Raum für Notizen

      -----------------------------------------------------------------------------------------------------

      -----------------------------------------------------------------------------------------------------
    • A few minor changes to the code that hopefully will not worsen.
      Dateien
      Raum für Notizen

      -----------------------------------------------------------------------------------------------------

      -----------------------------------------------------------------------------------------------------
    • Hi, emhatek!
      Source test code for this project:

      Quellcode

      1. $regfile = "m128def.dat"
      2. $crystal = 16000000 : $hwstack = 64 : $swstack = 64 : $framesize = 80
      3. Config Base = 0
      4. 'ports--------------------
      5. P_r1 Alias Porte.3 : Config P_r1 = Output
      6. P_g1 Alias Porte.4 : Config P_g1 = Output
      7. P_b1 Alias Porte.5 : Config P_b1 = Output
      8. P_r2 Alias Porte.6 : Config P_r2 = Output
      9. P_g2 Alias Porte.7 : Config P_g2 = Output
      10. P_b2 Alias Portb.0 : Config P_b2 = Output
      11. P_a Alias Portf.1 : Config P_a = Output
      12. P_b Alias Portf.0 : Config P_b = Output
      13. P_c Alias Portb.5 : Config P_c = Output
      14. P_d Alias Portb.4 : Config P_d = Output
      15. P_ckl Alias Portb.1 : Config P_ckl = Output
      16. P_lat Alias Portb.2 : Config P_lat = Output
      17. P_oe Alias Portb.6 : Config P_oe = Output
      18. Dout_port_r1 Alias Porte
      19. Dout_port_g1 Alias Porte
      20. Dout_port_b1 Alias Porte
      21. Dout_port_r2 Alias Porte
      22. Dout_port_g2 Alias Porte
      23. Dout_port_b2 Alias Portb
      24. Const Dout_pin_r1 = Pe3
      25. Const Dout_pin_g1 = Pe4
      26. Const Dout_pin_b1 = Pe5
      27. Const Dout_pin_r2 = Pe6
      28. Const Dout_pin_g2 = Pe7
      29. Const Dout_pin_b2 = Pb0
      30. Shift_clock_port Alias Portb
      31. Const Shift_clock_pin = Pb1
      32. Const Timer2reload = 16
      33. Config Timer2 = Timer , Prescale = 1024
      34. Load Timer2 , Timer2reload
      35. On Ovf2 Display_refresh
      36. Enable Ovf2
      37. Start Timer2
      38. 'PWM ************************************************** *************************
      39. Config Timer1 = Pwm , Pwm = 8 , Compare B Pwm = Clear Down , Prescale = 1
      40. '************************************************* ******************************
      41. Dim Memory_red(16) As Byte , Memory_green(16) As Byte , Memory_blue(16) As Byte 'memory red/green
      42. Dim Page_counter As Byte
      43. Dim D_1 As Word 'counter in isr
      44. Dim N_1 As Byte 'counter
      45. Dim Byte_num As Byte , Bit_num As Byte
      46. 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
      47. Dim Brightness As Byte
      48. Dim A As Byte , B As Byte
      49. 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 )
      50. Red = 1 : Green = 2 : Yellow = 3 : Blue = 4 : Magenta = 5 : Cyan = 6 : White = 7
      51. '$sim
      52. Brightness = 255
      53. Enable Interrupts
      54. Do
      55. For A = 1 To 128
      56. Gosub Show_bargraph
      57. Waitms 10
      58. Next A
      59. Wait 1
      60. For A = 128 To 0 Step -1
      61. Gosub Show_bargraph
      62. Waitms 10
      63. Next A
      64. A = 0
      65. Loop
      66. End
      67. Show_bargraph:
      68. B = 128 - A
      69. For N_1 = 0 To 127
      70. Byte_num = N_1 / 8
      71. Bit_num = N_1 Mod 8
      72. If B > N_1 Then
      73. Memory_red(byte_num).bit_num = 0
      74. Memory_green(byte_num).bit_num = 0
      75. Memory_blue(byte_num).bit_num = 0
      76. Else
      77. Select Case N_1
      78. Case 0 To 24 ' red
      79. Memory_red(byte_num).bit_num = 1
      80. Memory_green(byte_num).bit_num = 0
      81. Memory_blue(byte_num).bit_num = 0
      82. Case 25 To 60 ' yellow
      83. Memory_red(byte_num).bit_num = 1
      84. Memory_green(byte_num).bit_num = 1
      85. Memory_blue(byte_num).bit_num = 0
      86. Case 61 To 127 ' green
      87. Memory_red(byte_num).bit_num = 0
      88. Memory_green(byte_num).bit_num = 1
      89. Memory_blue(byte_num).bit_num = 0
      90. End Select
      91. End If
      92. Next N_1
      93. Return
      94. 'Interrupt service
      95. Display_refresh: 'show the memory on the display
      96. Load Timer2 , Timer2reload
      97. Page_counter = Page_counter + 3
      98. If Page_counter > 15 Then Page_counter = Page_counter - 16
      99. Pwm1b = 0 'display off
      100. For D_1 = 0 To 15
      101. Shift6out Memory_red(d_1) , Memory_green(d_1) , Memory_blue(d_1) , Memory_red(d_1) , Memory_green(d_1) , Memory_blue(d_1)
      102. Next D_1
      103. P_lat = 1 : P_lat = 0
      104. P_a = Not Page_counter.0
      105. P_b = Not Page_counter.1
      106. P_c = Not Page_counter.2
      107. P_d = Not Page_counter.3
      108. Pwm1b = Brightness 'display on
      109. Return
      110. ' R1 G1 B1 R2 G2 B2
      111. 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 )
      112. $asm
      113. LDI r17,8
      114. Loop_shift2out:
      115. in R16, dout_port_r1
      116. BST r18,0
      117. BLD r16,Dout_pin_r1
      118. Out Dout_port_r1 , R16
      119. in R16, dout_port_g1
      120. BST r19,0
      121. bld r16,Dout_pin_g1
      122. Out Dout_port_g1 , R16
      123. in R16, dout_port_b1
      124. BST r20,0
      125. bld r16,Dout_pin_b1
      126. Out Dout_port_b1 , R16
      127. in R16, dout_port_r2
      128. BST r21,0
      129. BLD r16,Dout_pin_r2
      130. Out Dout_port_r2 , R16
      131. in R16, dout_port_g2
      132. BST r22,0
      133. bld r16,Dout_pin_g2
      134. Out Dout_port_g2 , R16
      135. in R16, dout_port_b2
      136. BST r23,0
      137. bld r16,Dout_pin_b2
      138. Out Dout_port_b2 , R16
      139. SBI shift_clock_Port, shift_clock_Pin
      140. LSR r18
      141. LSR r19
      142. lsr r20
      143. lsr r21
      144. lsr r22
      145. lsr r23
      146. dec r17
      147. CBI shift_clock_Port, shift_clock_Pin
      148. BRnE loop_shift2out ; if = 0 exit
      149. $end Asm
      150. End Sub
      Alles anzeigen
      Test video of several matrixes

      P.S. Many thanks to Mike!
      Dateien