LED MATRIX P10 RED-GREEN 2 INCH

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

    Aufgrund technischer Veränderungen ist der Mailverkehr innerhalb des Forums (Private Nachrichten) nur noch eingeschränkt möglich. Die Einschränkung ist notwendig, um zusätzliche Betriebskosten für das Forum zu vermeiden. Näheres zu den Hintergründen im Thread "Aktuelles zum Forum".Wir bitten um Verständnis.

    Hinweis kann nach Kenntnisnahme deaktiviert werden!

    • LED MATRIX P10 RED-GREEN 2 INCH

      Hi, everybody!
      I ask to help with finishing of a code.
      This code to me was provided by Mike Tschoeatsch.
      Now he probably is busy, I ask somebody to help me.
      2 matrixes (red-green) connect. The code works perfectly.
      I corrected a code for 3 matrixes, and I don't understand where an error. The matrix doesn't work.
      Thanks in advance!


      BASCOM-Quellcode

      1. $regfile = "m128def.dat"
      2. $crystal = 12000000 : $hwstack = 80 : $swstack = 80 : $framesize = 80
      3. Ddrb = &B01001110
      4. Ddre = &B00010111
      5. Ddrf = &B00000011
      6. Shift_clock Alias Portb.1
      7. D_green Alias Portb.2
      8. D_red Alias Portb.3
      9. Port_write Alias Porte.4
      10. B Alias Portf.0
      11. A Alias Portf.1
      12. Config Base = 0
      13. 'timer for multiplex
      14. Const Timer2reload = 26
      15. Config Timer2 = Timer , Prescale = 1024
      16. Load Timer2 , Timer2reload
      17. On Ovf2 Display_refresh
      18. Enable Ovf2
      19. Start Timer2
      20. 'PWM ************************************************** *************************
      21. Config Timer1 = Pwm , Pwm = 8 , Compare B Pwm = Clear Up , Prescale = 1
      22. '************************************************* ******************************
      23. Dim Memory_red(192) As Byte , Memory_green(192) As Byte 'memory red/green
      24. Dim Memory_invisible(192)as Byte 'memory invisible
      25. Dim Temp_m_r As Byte , Temp_m_g As Byte 'temp memory red/green
      26. Dim Page_counter As Byte
      27. Dim C_1 As Byte , D_1 As Byte 'counter in isr
      28. Dim Character_column As Byte
      29. Dim Font_byte As Byte
      30. Dim N_1 As Byte , N_11 As Byte , N_12 As Byte , N_13 As Byte 'counter
      31. Dim M_1 As Byte , M_2 As Byte , M_22 As Byte
      32. Dim Sign As String * 1
      33. Dim Tab_start As Word 'Startwert der Fonttabelle
      34. Dim X1 As Word
      35. Dim Inverting As Bit
      36. Dim Speed As Word
      37. Dim Text As String * 254
      38. Dim Trigger As Bit
      39. Dim Display_on As Bit
      40. Dim N As Byte 'counterin main
      41. Dim Inv1 As Bit , Inv As Bit
      42. Dim Color As Byte , Red As Byte , Green As Byte , Orange As Byte , Invisible As Byte
      43. Dim Brightness As Byte , Ascii_sign As Byte
      44. Red = 1 : Green = 2 : Orange = 3 : Invisible = 4
      45. '**************************************************
      46. 'user settings
      47. Inverting = 0
      48. '**************************************************
      49. '$sim
      50. Brightness = 0 'max brightness
      51. Gosub Clear_memory
      52. Enable Interrupts
      53. Do
      54. Speed = 8
      55. Color = Red
      56. Text = "012345678 "
      57. Gosub Scroll_text_16
      58. Waitms 100
      59. Loop
      60. End
      61. Shift_left: 'shift the display one column to left
      62. Inv1 = Inverting Xor Inv
      63. Trigger = 0
      64. Bitwait Trigger , Set 'wait untill isr is done
      65. For N_1 = 0 To 15 'number of row
      66. N_11 = N_1 + 0
      67. For N_13 = 1 To 7 'number of column
      68. Shift Memory_red(n_11) , Right , 1 'shift all bits to left
      69. N_12 = N_11 + 16
      70. Memory_red(n_11).7 = Memory_red(n_12).0 'copy left bit of the byte in the right
      71. N_11 = N_11 + 16
      72. Next N_13
      73. Shift Memory_red(n_12) , Right , 1 'last column
      74. Memory_red(n_12).7 = Inv1
      75. Next N_1
      76. Return
      77. Scroll_text_16:
      78. Inv1 = Inverting Xor Inv
      79. For M_1 = 1 To Len(text)
      80. Sign = Mid(text , M_1 , 1) 'Only one letter
      81. Tab_start = Asc(sign)
      82. Tab_start = Tab_start - 32
      83. Tab_start = Tab_start * 24 'Starting point in the font table
      84. For Character_column = 0 To 24 Step 2
      85. Gosub Shift_left
      86. X1 = Tab_start + Character_column
      87. Font_byte = Lookup(x1 , Font_12x16)
      88. For M_2 = 0 To 7
      89. M_22 = 176 + M_2 'last column, upper byte 112 - 2 display, 176 - 3 display
      90. Gosub Set_bit
      91. Next M_2
      92. X1 = X1 + 1
      93. Font_byte = Lookup(x1 , Font_12x16)
      94. For M_2 = 0 To 7
      95. M_22 = 184 + M_2 'last column, 8 byte under upper byte 120 - 2 display, 184 - 3 display
      96. Gosub Set_bit
      97. Next M_2
      98. Waitms Speed
      99. Next Character_column
      100. Next M_1
      101. Return
      102. Loads:
      103. Pwm1b = 255 'switch all leds off
      104. For D_1 = 1 To 48 '48 bytes are to send 3 display
      105. Read C_1
      106. D_red = Memory_red(c_1).0 : D_green = Memory_green(c_1).0 : Shift_clock = 1 : Shift_clock = 0
      107. D_red = Memory_red(c_1).1 : D_green = Memory_green(c_1).1 : Shift_clock = 1 : Shift_clock = 0
      108. D_red = Memory_red(c_1).2 : D_green = Memory_green(c_1).2 : Shift_clock = 1 : Shift_clock = 0
      109. D_red = Memory_red(c_1).3 : D_green = Memory_green(c_1).3 : Shift_clock = 1 : Shift_clock = 0
      110. D_red = Memory_red(c_1).4 : D_green = Memory_green(c_1).4 : Shift_clock = 1 : Shift_clock = 0
      111. D_red = Memory_red(c_1).5 : D_green = Memory_green(c_1).5 : Shift_clock = 1 : Shift_clock = 0
      112. D_red = Memory_red(c_1).6 : D_green = Memory_green(c_1).6 : Shift_clock = 1 : Shift_clock = 0
      113. D_red = Memory_red(c_1).7 : D_green = Memory_green(c_1).7 : Shift_clock = 1 : Shift_clock = 0
      114. Next D_1
      115. Port_write = 1
      116. Return
      117. Byte_order_0: '48 bytes
      118. Data 3 , 7 , 19 , 23 , 11 , 15 , 27 , 31 , 35 , 39 , 51 , 55 , 43 , 47 , 59 , 63
      119. Data 67 , 71 , 83 , 87 , 75 , 79 , 91 , 95 , 99 , 103 , 115 , 119 , 107 , 111 , 123 , 127
      120. Data 131 , 135 , 147 , 151 , 139 , 143 , 155 , 159 , 163 , 167 , 179 , 183 , 171 , 175 , 187 , 191
      121. Byte_order_1:
      122. Data 2 , 6 , 18 , 22 , 10 , 14 , 26 , 30 , 34 , 38 , 50 , 54 , 42 , 46 , 58 , 62
      123. Data 66 , 70 , 82 , 86 , 74 , 78 , 90 , 94 , 98 , 102 , 114 , 118 , 106 , 110 , 122 , 126
      124. Data 130 , 134 , 146 , 150 , 138 , 142 , 154 , 158 , 162 , 166 , 178 , 182 , 170 , 174 , 186 , 190
      125. Byte_order_2:
      126. Data 1 , 5 , 17 , 21 , 9 , 13 , 25 , 29 , 33 , 37 , 49 , 53 , 41 , 45 , 57 , 61
      127. Data 65 , 69 , 81 , 85 , 73 , 77 , 89 , 93 , 97 , 101 , 113 , 117 , 105 , 109 , 121 , 125
      128. Data 129 , 133 , 145 , 149 , 137 , 141 , 153 , 157 , 161 , 165 , 177 , 181 , 169 , 173 , 185 , 189
      129. Byte_order_3:
      130. Data 0 , 4 , 16 , 20 , 8 , 12 , 24 , 28 , 32 , 36 , 48 , 52 , 40 , 44 , 56 , 60
      131. Data 64 , 68 , 80 , 84 , 72 , 76 , 88 , 92 , 96 , 100 , 112 , 116 , 104 , 108 , 120 , 124
      132. Data 128 , 132 , 144 , 148 , 136 , 140 , 152 , 156 , 160 , 164 , 176 , 180 , 168 , 172 , 184 , 188
      133. Set_bit:
      134. If Color.2 = 1 Then 'invisible
      135. If Inv1 = 1 Then Memory_invisible(m_22).7 = Not Font_byte.m_2 Else Memory_invisible(m_22).7 = Font_byte.m_2
      136. Else
      137. 'write to memory only when color is red or green
      138. If Color.0 = 1 Then 'red
      139. If Inv1 = 1 Then Memory_red(m_22).7 = Not Font_byte.m_2 Else Memory_red(m_22).7 = Font_byte.m_2
      140. Else
      141. Memory_red(m_22).7 = Inverting
      142. End If
      143. End If
      144. Return
      145. 'Interrupt service
      146. Display_refresh: 'show the memory on the display
      147. Load Timer2 , Timer2reload
      148. Incr Page_counter
      149. If Page_counter > 3 Then Page_counter = 0
      150. Select Case Page_counter
      151. Case 0:
      152. Restore Byte_order_0
      153. Gosub Loads
      154. A = 0 : B = 0
      155. Port_write = 0
      156. Pwm1b = Brightness 'max brightness switch all leds on
      157. Case 1:
      158. Restore Byte_order_1
      159. Gosub Loads
      160. A = 1 : B = 0
      161. Port_write = 0
      162. Pwm1b = Brightness 'max brightness switch all leds on
      163. Case 2:
      164. Restore Byte_order_2
      165. Gosub Loads
      166. A = 0 : B = 1
      167. Port_write = 0
      168. Pwm1b = Brightness 'max brightness switch all leds on
      169. Case 3:
      170. Restore Byte_order_3
      171. Gosub Loads
      172. A = 1 : B = 1
      173. Port_write = 0
      174. Pwm1b = Brightness 'max brightness switch all leds on
      175. End Select
      176. Trigger = 1
      177. Return
      178. Clear_memory:
      179. For N_1 = 0 To 191
      180. Memory_red(n_1) = 0
      181. Memory_green(n_1) = 0
      182. Memory_invisible(n_1) = 0
      183. Next N_1
      184. Return
      Alles anzeigen
      Operation of 2 led matrixes: VIDEO
      Operation of 3 led matrixes: VIDEO
      Dateien
    • Hi samego, I think I have found the error. For 3 displays, 3x4 = 12 bytes are shifted in one line, which are shifted at the shift left. In your example, only 8 bytes are moved. Try this code once, note line 8

      BASCOM-Quellcode

      1. Shift_left: 'shift the display one column to left
      2. Inv1 = Inverting Xor Inv
      3. Trigger = 0
      4. Bitwait Trigger , Set 'wait untill isr is done
      5. For N_1 = 0 To 15 'number of row
      6. N_11 = N_1 + 0
      7. For N_13 = 1 To 11 'number of column
      8. Shift Memory_red(n_11) , Right , 1 'shift all bits to left
      9. N_12 = N_11 + 16
      10. Memory_red(n_11).7 = Memory_red(n_12).0 'copy left bit of the byte in the right
      11. N_11 = N_11 + 16
      12. Next N_13
      13. Shift Memory_red(n_12) , Right , 1 'last column
      14. Memory_red(n_12).7 = Inv1
      15. Next N_1
      16. Return
      Alles anzeigen
      Raum für Notizen

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

      -----------------------------------------------------------------------------------------------------
    • Eine Erklärung für interessierte Mitleser:
      Die verwendeten Led-matrixe (?) haben 16x32 Led x2 (rot und grün), jeweils 8 Leds nebeneinander werden durch ein byte angesteuert. Die byte-matrix ist also 16 bytes übereinander und 4 bytes nebeneinander (für 1 Led-Matrix). Je Led-Matrix werden 16 bytes in die verbauten Schieberegister geladen, sodass nach 4 Durchgängen die komplette Matrix angezeigt wird. Die Anordnung dieser 16 bytes erfolgt nach einem Muster, dass sich in einer data-Liste wieder findet. Damit ich das Beschreiben der leds einfach habe und auch leicht Effekte wie Textscrollen in alle Richtungen machen kann, habe ich einen Bildspeicher angelegt. Dieser ist von der Anordnung der bytes 'gleichmäßiger', links unter byte 0 links oben byte 15, rechts unten byte 48, rechts oben byte 63.
      Damit ein Text geladen werden kann, wird in die Letzte Spalte eine Spalte des Zeichens geschrieben und der gesamte Bildspeicher um eine Spalte nach links geshiftet. So scrollt der Text in die Anzeige. Bei samegos letztem Video sieht man, das diese Spalte beschrieben wird, aber nicht nach links geshiftet wird. So entsteht kein vollständiger Text. Der Fehler liegt im Programmteil shift_left. Hier waren die Anzahl der Spalten nicht auf die 3 Displays angepasst.

      Da jetzt samego das Programm zum posten gekürzt hat, hier mal die Version wie ich sie mal erdacht hatte. Das erklärt auch den 'Memory_invisible'. Den kann man genauso mit Text füllen und dann von unten oder von oben in das display hineinschieben.
      Matrix_A128_7_1.bas
      Raum für Notizen

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

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

      Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von tschoeatsch ()

    • Then you have to adjust the number of columns accordingly. If several displays are activated, more bytes must also be transmitted by the interrupt. There can be a limit. You could also use the SPI interface for transmission, which is faster than shiftout. Do you still have displays to try? What effects should be possible?

      (Dann muss man die Anzahl der Spalten entsprechend anpassen. Wenn man mehrere displays ansteuert, müssen auch mehr bytes durch den interrupt übertragen werden. Da kann eine Grenze erreicht werden. Man könnte aber auch die SPI-Schnittstelle zur Übertragung verwenden, die ist schneller als shiftout. Hast du noch displays, um es zu probieren? Welche Effekte sollen möglich sein?)
      Raum für Notizen

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

      -----------------------------------------------------------------------------------------------------
    • Stop, SPI and shiftout does not go, you must put out at 2 different pins at the same time bits.

      (Stopp, SPI und shiftout geht nicht, mann muss ja an 2 verschiedenen pins gleichzeitig bits ausgeben.)
      Raum für Notizen

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

      -----------------------------------------------------------------------------------------------------
    • SAMEGO schrieb:

      Yes. I have 5 displays.
      Ok, then let's just try a scrolling text?

      (Ok, dann probieren wir einmal nur einen scrollenden Text?)
      Raum für Notizen

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

      -----------------------------------------------------------------------------------------------------
    • Hi samego. I have now made an attempt to write the program you sent me for several displays. You can now specify the number of displays, the necessary changes are automatically calculated. Now it is set to 5 displays.
      I can not test the program unfortunately, I have no such displays.

      (Hi samego. Ich habe jetzt einen Versuch unternommen, das Programm, das du mir geschickt hast, für mehrere displays um zu schreiben. Man kann jetzt die Anzahl der displays angeben, die nötigen Änderungen werden automatisch errechnet. Jetzt ist es auf 5 displays eingestellt.
      Ich kann das Programm leider nicht testen, ich habe keine solchen displays.)

      Matrix_A128_R_G-multi-displays.bas
      Font_6x8.bas
      Font_8x16.bas
      Font_10x16.bas
      Font_12x16.bas
      Raum für Notizen

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

      -----------------------------------------------------------------------------------------------------
    • All counters must be changed from byte to word. From 5 displays, the number of bytes in shift operations is greater than 255.

      (Es müssen alle Zähler von byte auf word umgestellt werden. Ab 5 displays ist die Anzahl der bytes bei den shift-Operationen größer als 255.)


      new version
      Matrix_A128_R_G-multi-displays.bas
      Raum für Notizen

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

      -----------------------------------------------------------------------------------------------------
    • Ok, ok, I've already found an error. The byte_order table must be changed to word.

      (Ok, ok, ich habe schon einen Fehler gefunden. Die byte_order Tabelle muss auf word umgestellt werden.)

      Matrix_A128_R_G-multi-displays.bas
      Raum für Notizen

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

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