Pluto25 schrieb:
Natürlich nicht , Wer rastet der rostet. Da lag ich ja mit der ersten Vermutung richtig.tschoeatsch schrieb:
Darf ich mir keine Auszeit nehmen?
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)
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.tschoeatsch schrieb:
Die Ausgabe so zurück bauen,
RGB Matrix module 20x40 1/5 scan GKGD - error of display of the image
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!
-
-
New code of the test
Quellcode
- Const Dy_num_h = 1
- Const Dy_num_v = 1
- Const Bytes_in_row = 5 * Dy_num_h
- Const Row_num = 20 * Dy_num_v
- 'Const Row_num1 = Row_num - 1
- Const Mem_size = Row_num * Bytes_in_row
- Const Mem_size_1 = Mem_size - 1
- 'Const Bytes_to_send = Dy_num_h * Dy_num_v * 20
- Const Dy_offset = Dy_num_h * 100
- Const Channel_offset = 10 * Bytes_in_row
- 'Const Mem_offset_2 = 5 * Bytes_in_row
- $regfile = "m328pdef.dat"
- $crystal = 16000000
- $hwstack = 64 : $swstack = 64 : $framesize = 64
- P_r1 Alias Portd.5 : Config P_r1 = Output : Dout_port_r1 Alias Portd : Const Dout_pin_r1 = Pd5
- P_g1 Alias Portd.7 : Config P_g1 = Output : Dout_port_g1 Alias Portd : Const Dout_pin_g1 = Pd7
- P_b1 Alias Portd.6 : Config P_b1 = Output : Dout_port_b1 Alias Portd : Const Dout_pin_b1 = Pd6
- P_r2 Alias Portc.4 : Config P_r2 = Output : Dout_port_r2 Alias Portc : Const Dout_pin_r2 = Pc4
- P_g2 Alias Portc.3 : Config P_g2 = Output : Dout_port_g2 Alias Portc : Const Dout_pin_g2 = Pc3
- P_b2 Alias Portc.2 : Config P_b2 = Output : Dout_port_b2 Alias Portc : Const Dout_pin_b2 = Pc2
- P_a Alias Portc.0 : Config P_a = Output
- P_b Alias Portc.1 : Config P_b = Output
- P_c Alias Portb.0 : Config P_c = Output
- P_ckl Alias Portb.5 : Config P_ckl = Output : Shift_clock_port Alias Portb : Const Shift_clock_pin = Pb5
- P_lat Alias Portb.3 : Config P_lat = Output
- P_oe Alias Portb.2 : Config P_oe = Output
- Config Base = 0
- Const Timer2reload = 35
- Config Timer2 = Timer , Prescale = 1024
- Load Timer2 , Timer2reload
- On Ovf2 Display_refresh
- Enable Ovf2
- Start Timer2
- 'PWM ************************************************** *************************
- Config Timer1 = Pwm , Pwm = 8 , Compare_b_pwm = Clear_down , Prescale = 1
- '************************************************* ******************************
- Enable Interrupts
- 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 )
- Dim Memory_red(mem_size) As Byte
- Dim Memory_green(mem_size) As Byte
- Dim Memory_blue(mem_size) As Byte
- Dim Trigger As Bit
- Dim Brightness As Byte
- Dim N_1 As Word 'counter
- Dim Red As Byte , Green As Byte , Blue As Byte , Yellow As Byte , Magenta As Byte , Cyan As Byte , White As Byte
- Red = 1 : Green = 2 : Yellow = 3 : Blue = 4 : Magenta = 5 : Cyan = 6 : White = 7
- Dim Page As Byte
- Dim Mem_offset_1 As Word
- Dim R_0 As Byte , B_1 As Byte
- Dim St_byte_1 As Word , St_byte_2 As Word , St_byte_3 As Word , St_byte_4 As Word
- Brightness = 250
- Gosub Clear_memory
- Gosub Load_pic
- Do
- Loop
- End
- Clear_memory:
- For N_1 = 0 To Mem_size_1
- Memory_red(n_1) = 0
- Memory_green(n_1) = 0
- Memory_blue(n_1) = 0
- Next N_1
- Return
- Load_pic:
- For N_1 = 0 To Mem_size_1
- Memory_red(n_1) = Lookup(n_1 , Pic_data_red)
- ' Memory_green(n_1) = Lookup(n_1 , Pic_data_green)
- 'Memory_blue(n_1) = Lookup(n_1 , Pic_data_blue)
- Next N_1
- Return
- Display_refresh:
- Load Timer2 , Timer2reload
- If Page < 4 Then
- Incr Page
- Else
- Page = 0
- End If
- Mem_offset_1 = Page
- For R_0 = 1 To Dy_num_v
- St_byte_1 = Mem_offset_1 : St_byte_2 = St_byte_1 + 5
- St_byte_3 = St_byte_1 + Channel_offset : St_byte_4 = St_byte_3 + 5
- For B_1 = 1 To 5
- 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)
- 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)
- St_byte_1 = St_byte_1 + 10
- St_byte_2 = St_byte_2 + 10
- St_byte_3 = St_byte_3 + 10
- St_byte_4 = St_byte_4 + 10
- Next B_1
- Mem_offset_1 = Mem_offset_1 + Dy_offset
- Next R_0
- Pwm1b = 0
- Waitus 100
- P_lat = 1 : P_lat = 0
- P_a = Page.0
- P_b = Page.1
- P_c = Page.2
- Pwm1b = Brightness
- Trigger = 1
- Return
- ' R1 G1 B1 R2 G2 B2
- 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 )
- $asm
- LDI r17,8
- Loop_shift2out:
- in R16, dout_port_r1
- BST r18,7
- BLD r16,Dout_pin_r1
- Out Dout_port_r1 , R16
- in R16, dout_port_g1
- BST r19,7
- bld r16,Dout_pin_g1
- Out Dout_port_g1 , R16
- in R16, dout_port_b1
- BST r20,7
- bld r16,Dout_pin_b1
- Out Dout_port_b1 , R16
- in R16, dout_port_r2
- BST r21,7
- BLD r16,Dout_pin_r2
- Out Dout_port_r2 , R16
- in R16, dout_port_g2
- BST r22,7
- bld r16,Dout_pin_g2
- Out Dout_port_g2 , R16
- in R16, dout_port_b2
- BST r23,7
- bld r16,Dout_pin_b2
- Out Dout_port_b2 , R16
- SBI shift_clock_Port, shift_clock_Pin
- LSl r18
- LSl r19
- lsl r20
- lsl r21
- lsl r22
- lsl r23
- dec r17
- CBI shift_clock_Port, shift_clock_Pin
- BRnE loop_shift2out
- $end Asm
- End Sub
- Pic_data_red:
- Data &B11000001 , &B11100001 , &B11110001 , &B11111001 , &B11111101
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00000000
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00111111
- Data &B00000000 , &B00000000 , &B00000000 , &B00000000 , &B00011111
- Data &B00000000 , &B00000000 , &B00000000 , &B00001111 , &B00000111
- Pic_data_green:
- Pic_data_blue:
-
It works bedder then the nibbels. Sure that Red(94) was B00011111 and not 11111000? Please fill red(6or7)
-
Pluto25 schrieb:
It works bedder then the nibbels. Sure that Red(94) was B00011111 and not 11111000? Please fill red(6or7)
new screen
image_9.jpg -
It works bedder then the nibbelsNow jumped the hole Byte
"Red(94) was B00011111 - Yes!" Not only jump; MSB changed too
Back too roots?
Maybe you try this
Quellcode
-
Pluto25 schrieb:
It works bedder then the nibbelsNow jumped the hole Byte
"Red(94) was B00011111 - Yes!" Not only jump; MSB changed too
Back too roots?
Maybe you try this
Quellcode
-
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:
Quellcode
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von Pluto25 ()
-
Here what turned out:
image_10.jpg -
SAMEGO schrieb:
Here what turned out:
10 must be R_1 = blue + 128 -
Pluto25 schrieb:
SAMEGO schrieb:
Here what turned out:
10 must be R_1 = blue + 128
-
SAMEGO schrieb:
R_1?
Quellcode
- Display_refresh:
- Load Timer2 , Timer2reload
- If Page < 4 Then
- Incr Page
- Else
- Page = 0
- End If
- For R_0=0 to 49 ' (99?)
- blue=r_0+page
- B_1=blue +128
- Shift6out(blue,0,0,B_1,0,0)
- Next R_0
- Pwm1b = 0
- Waitus 100
- P_lat = 1 : P_lat = 0
- P_a = Page.0
- P_b = Page.1
- P_c = Page.2
- Pwm1b = Brightness
- Trigger = 1
- Return
-
Not quite a good picture:)
image_11.jpg -
New test code
Quellcode
- Const Dy_num_h = 1 'displays in a horizontal direction
- Const Dy_num_v = 1 'displays in the vertical direction
- Const Row_num = 20
- Const Col_num = 5
- Const Bytes_in_row = Col_num * Dy_num_h
- Const Row_num1 = Row_num - 1
- Const Col_num_1 = Col_num - 1
- Const Mem_size = Row_num * Bytes_in_row
- Const Mem_size_1 = Mem_size - 1
- Const Dy_offset = Dy_num_h * 100
- Const Channel_offset = 10 * Bytes_in_row
- Const Last_col_byte = Mem_size - Row_num
- $regfile = "m328pdef.dat"
- $crystal = 16000000
- $hwstack = 64 : $swstack = 64 : $framesize = 120
- P_r1 Alias Portd.5 : Config P_r1 = Output : Dout_port_r1 Alias Portd : Const Dout_pin_r1 = Pd5
- P_g1 Alias Portd.7 : Config P_g1 = Output : Dout_port_g1 Alias Portd : Const Dout_pin_g1 = Pd7
- P_b1 Alias Portd.6 : Config P_b1 = Output : Dout_port_b1 Alias Portd : Const Dout_pin_b1 = Pd6
- P_r2 Alias Portc.4 : Config P_r2 = Output : Dout_port_r2 Alias Portc : Const Dout_pin_r2 = Pc4
- P_g2 Alias Portc.3 : Config P_g2 = Output : Dout_port_g2 Alias Portc : Const Dout_pin_g2 = Pc3
- P_b2 Alias Portc.2 : Config P_b2 = Output : Dout_port_b2 Alias Portc : Const Dout_pin_b2 = Pc2
- P_a Alias Portc.0 : Config P_a = Output
- P_b Alias Portc.1 : Config P_b = Output
- P_c Alias Portb.0 : Config P_c = Output
- P_ckl Alias Portb.5 : Config P_ckl = Output
- P_lat Alias Portb.3 : Config P_lat = Output
- P_oe Alias Portb.2 : Config P_oe = Output
- Shift_clock_port Alias Portb : Const Shift_clock_pin = Pb5
- Const Timer2reload = 15
- Config Timer2 = Timer , Prescale = 1024
- Load Timer2 , Timer2reload
- On Ovf2 Display_refresh
- Enable Ovf2
- Start Timer2
- 'PWM ************************************************** *************************
- Config Timer1 = Pwm , Pwm = 8 , Compare B Pwm = Clear Down , Prescale = 1
- '************************************************* ******************************
- Dim Memory_red(mem_size) As Byte , Memory_green(mem_size) As Byte , Memory_blue(mem_size) As Byte 'memory red/green
- Dim Page_counter As Byte
- Dim D_1 As Word , D_2 As Byte 'counter in isr
- Dim Index_1 As Word , Index_2 As Word
- Dim Character_column As Byte
- Dim Font_byte_low As Byte , Font_byte_high As Byte
- Dim N_1 As Word , N_11 As Word , N_12 As Word , N_13 As Word 'counter
- 'Dim N_2 As Word , N_21 As Word , N_22 As Word , N_23 As Word 'counter
- 'Dim N_3 As Word , N_31 As Word
- 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
- Dim Sign As String * 1
- Dim Tab_start As Word 'Startwert der Fonttabelle
- Dim X1 As Word
- Dim Inverting As Bit
- Dim Speed As Word
- Dim Text As String * 15
- Dim Text_baseline As Word , Max_baseline As Word
- Dim Startbyte_low As Word , Startbyte_high As Word , Text_top_line As Word , Bit_num As Byte
- Dim Trigger As Bit
- Dim N As Word 'counter in main
- Dim Inv1 As Bit , Inv As Bit
- 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
- Dim Brightness As Byte , Ascii_sign As Byte
- Dim Hh As Byte
- 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 )
- Declare Sub Set_text_6_8(byval X As Word , Byval Y As Word , Byval Color As Byte)
- Red = 1 : Green = 2 : Yellow = 3 : Blue = 4 : Magenta = 5 : Cyan = 6 : White = 7
- '**************************************************
- 'user settings
- Inverting = 0
- '**************************************************
- Brightness = 25
- Gosub Clear_memory
- Enable Interrupts
- Inv = 0
- Text = "374 2"
- Call Set_text_6_8(0 , 0 , Green)
- Do
- Loop
- End
- Display_refresh:
- Load Timer2 , Timer2reload
- If Page_counter < 4 Then
- Incr Page_counter
- Else
- Page_counter = 0
- End If
- Index_1 = 5 - Page_counter
- For D_1 = 1 To 8
- Index_2 = Index_1 + 5
- 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)
- Index_1 = Index_1 + 10
- Next D_1
- 'Index_2 = Index_1
- 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)
- Pwm1b = 0
- Waitus 100
- P_lat = 1 : P_lat = 0
- P_a = Page_counter.0
- P_b = Page_counter.1
- P_c = Page_counter.2
- Pwm1b = Brightness
- Trigger = 1
- Return
- ' R1 G1 B1 R2 G2 B2
- 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 )
- $asm
- LDI r17,8
- Loop_shift2out:
- in R16, dout_port_r1
- BST r18,0
- BLD r16,Dout_pin_r1
- Out Dout_port_r1 , R16
- in R16, dout_port_g1
- BST r19,0
- bld r16,Dout_pin_g1
- Out Dout_port_g1 , R16
- in R16, dout_port_b1
- BST r20,0
- bld r16,Dout_pin_b1
- Out Dout_port_b1 , R16
- in R16, dout_port_r2
- BST r21,0
- BLD r16,Dout_pin_r2
- Out Dout_port_r2 , R16
- in R16, dout_port_g2
- BST r22,0
- bld r16,Dout_pin_g2
- Out Dout_port_g2 , R16
- in R16, dout_port_b2
- BST r23,0
- bld r16,Dout_pin_b2
- Out Dout_port_b2 , R16
- SBI shift_clock_Port, shift_clock_Pin
- LSR r18
- LSR r19
- lsr r20
- lsr r21
- lsr r22
- lsr r23
- dec r17
- CBI shift_clock_Port, shift_clock_Pin
- BRnE loop_shift2out
- $end Asm
- End Sub
- Clear_memory:
- For N_1 = 0 To Mem_size_1
- Memory_red(n_1) = 0
- Memory_green(n_1) = 0
- Memory_blue(n_1) = 0
- Next N_1
- Return
- Sub Set_text_6_8(byval X As Word , Byval Y As Word , Byval Color As Byte)
- Local Col As Word
- '6x8font
- Max_baseline = Row_num - 8
- If Y > Max_baseline Then Y = Max_baseline
- Inv1 = Inverting Xor Inv
- For M_1 = 1 To Len(text)
- Sign = Mid(text , M_1 , 1) 'Only one letter
- Tab_start = Asc(sign)
- Tab_start = Tab_start - 32
- Tab_start = Tab_start * 6 'Starting point in the font table
- For Character_column = 0 To 5
- Bit_num = X Mod 8 'bit-number of byte
- Col = X / 8 'number of column
- Startbyte_low = Col * Row_num
- Startbyte_low = Startbyte_low + Y
- If Startbyte_low > Mem_size_1 Then Exit Sub 'there is no space, you are ready
- X1 = Tab_start + Character_column
- Font_byte_low = Lookup(x1 , Font_6x8)
- For M_2 = 0 To 7
- M_22 = Startbyte_low + M_2
- If Color.0 = 1 Then 'red
- If Inv1 = 1 Then
- Memory_red(m_22).bit_num = Not Font_byte_low.m_2
- Else
- Memory_red(m_22).bit_num = Font_byte_low.m_2
- End If
- Else
- Memory_red(m_22).bit_num = Inverting
- End If
- If Color.1 = 1 Then 'green
- If Inv1 = 1 Then
- Memory_green(m_22).bit_num = Not Font_byte_low.m_2
- Else
- Memory_green(m_22).bit_num = Font_byte_low.m_2
- End If
- Else
- Memory_green(m_22).bit_num = Inverting
- End If
- If Color.2 = 1 Then 'blue
- If Inv1 = 1 Then
- Memory_blue(m_22).bit_num = Not Font_byte_low.m_2
- Else
- Memory_blue(m_22).bit_num = Font_byte_low.m_2
- End If
- Else
- Memory_blue(m_22).bit_num = Inverting
- End If
- Next M_2
- Incr X
- Next Character_column
- Next M_1
- End Sub
- Font_6x8:
- Data 0 , 0 , 0 , 0 , 0 , 0 ' <SPACE>
- Data 0 , 0 , 96 , 250 , 96 , 0 ' !
- Data 0 , 224 , 192 , 0 , 224 , 192 ' "
- Data 0 , 48 , 64 , 254 , 64 , 48 ' #
- Data 0 , 24 , 4 , 254 , 4 , 24 ' $
- Data 0 , 16 , 56 , 84 , 84 , 16 ' %
- Data 0 , 16 , 84 , 84 , 56 , 16 ' &
- Data 0 , 0 , 224 , 192 , 0 , 0 ' <ZAP>
- Data 48 , 96 , 255 , 255 , 96 , 48 ' (
- Data 12 , 6 , 255 , 255 , 6 , 12 ' )
- Data 24 , 60 , 126 , 90 , 24 , 24 ' *
- Data 16 , 16 , 124 , 16 , 16 , 0 ' +
- Data 0 , 0 , 7 , 6 , 0 , 0 ' ,
- Data 0 , 16 , 16 , 16 , 16 , 16 ' -
- Data 0 , 0 , 6 , 6 , 0 , 0 ' .
- Data 2 , 4 , 8 , 16 , 32 , 64 ' /
- Data 0 , 124 , 138 , 146 , 162 , 124 ' 0
- Data 0 , 0 , 66 , 254 , 2 , 0 ' 1
- Data 0 , 70 , 138 , 146 , 146 , 98 ' 2
- Data 0 , 68 , 146 , 146 , 146 , 108 ' 3
- Data 0 , 24 , 40 , 72 , 254 , 8 ' 4
- Data 0 , 228 , 162 , 162 , 162 , 156 ' 5
- Data 0 , 60 , 82 , 146 , 146 , 12 ' 6
- Data 0 , 192 , 142 , 144 , 160 , 192 ' 7
- Data 0 , 108 , 146 , 146 , 146 , 108 ' 8
- Data 0 , 96 , 146 , 146 , 148 , 120 ' 9
-
SAMEGO schrieb:
Not quite a good picture:)
SAMEGO schrieb:
New test code
It seems Data you send on Green1(PinD.7) are not correct. Change calculation of index_2 (or memory 6/7 to ?14/15?) -and reverse? -
Pluto25 schrieb:
SAMEGO schrieb:
Not quite a good picture:)
SAMEGO schrieb:
New test code
-
I think that 's not the right option.
Probably need to change this code
Quellcode
- Display_refresh:
- Load Timer2 , Timer2reload
- If Page < 4 Then
- Incr Page
- Else
- Page = 0
- End If
- Select Case Page
- Case 0:
- Mem_offset_1 = 0 * Bytes_in_row
- Mem_offset_3 = 5 * Bytes_in_row 'page=1
- Case 1:
- Mem_offset_1 = 1 * Bytes_in_row
- Mem_offset_3 = 6 * Bytes_in_row 'page=2
- Case 2:
- Mem_offset_1 = 2 * Bytes_in_row
- Mem_offset_3 = 7 * Bytes_in_row 'page=3
- Case 3:
- Mem_offset_1 = 3 * Bytes_in_row
- Mem_offset_3 = 8 * Bytes_in_row 'page=4
- Case 4:
- Mem_offset_1 = 4 * Bytes_in_row
- Mem_offset_3 = 9 * Bytes_in_row 'page=5
- End Select
- For R_0 = 1 To Dy_num_h
- St_byte_1 = Mem_offset_1 : St_byte_2 = St_byte_1 + Channel_offset 'set start-bytes
- St_byte_3 = Mem_offset_3 : St_byte_4 = St_byte_3 + Channel_offset
- For B_1 = 1 To Bytes_in_row
- 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)
- 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)
- 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)
- 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)
- St_byte_1 = St_byte_1 + 1
- St_byte_2 = St_byte_2 + 1
- St_byte_3 = St_byte_3 + 1
- St_byte_4 = St_byte_4 + 1
- Next B_1
- Mem_offset_1 = Mem_offset_1 + Dy_offset
- Mem_offset_3 = Mem_offset_3 + Dy_offset
- Next R_0
- Pwm1b = 0
- Waitus 100
- P_lat = 1 : P_lat = 0
- P_a = Page.0
- P_b = Page.1
- P_c = Page.2
- Pwm1b = Brightness
- Return
- ' R1 G1 B1 R2 G2 B2
- 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 )
- 'bit7 first to bit4
- $asm
- LDI r17,4 ;only 4 bits
- Loop_shift2out_h:
- in R16, dout_port_r1
- BST r18,7
- BLD r16,Dout_pin_r1
- Out Dout_port_r1 , R16
- in R16, dout_port_g1
- BST r19,7
- bld r16,Dout_pin_g1
- Out Dout_port_g1 , R16
- in R16, dout_port_b1
- BST r20,7
- bld r16,Dout_pin_b1
- Out Dout_port_b1 , R16
- in R16, dout_port_r2
- BST r21,7
- BLD r16,Dout_pin_r2
- Out Dout_port_r2 , R16
- in R16, dout_port_g2
- BST r22,7
- bld r16,Dout_pin_g2
- Out Dout_port_g2 , R16
- in R16, dout_port_b2
- BST r23,7
- bld r16,Dout_pin_b2
- Out Dout_port_b2 , R16
- SBI shift_clock_Port, shift_clock_Pin
- LSl r18
- LSl r19
- lsl r20
- lsl r21
- lsl r22
- lsl r23
- dec r17
- CBI shift_clock_Port, shift_clock_Pin
- BRnE loop_shift2out_h ; if = 0 exit
- $end Asm
- End Sub
- 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 )
- 'bit3 first to bit0
- $asm
- LDI r17,4 ;only 4 bits
- Loop_shift2out_l:
- in R16, dout_port_r1
- BST r18,3 ;start with bit3
- BLD r16,Dout_pin_r1
- Out Dout_port_r1 , R16
- in R16, dout_port_g1
- BST r19,3
- bld r16,Dout_pin_g1
- Out Dout_port_g1 , R16
- in R16, dout_port_b1
- BST r20,3
- bld r16,Dout_pin_b1
- Out Dout_port_b1 , R16
- in R16, dout_port_r2
- BST r21,3
- BLD r16,Dout_pin_r2
- Out Dout_port_r2 , R16
- in R16, dout_port_g2
- BST r22,3
- bld r16,Dout_pin_g2
- Out Dout_port_g2 , R16
- in R16, dout_port_b2
- BST r23,3
- bld r16,Dout_pin_b2
- Out Dout_port_b2 , R16
- SBI shift_clock_Port, shift_clock_Pin
- LSl r18
- LSl r19
- lsl r20
- lsl r21
- lsl r22
- lsl r23
- dec r17
- CBI shift_clock_Port, shift_clock_Pin
- BRnE loop_shift2out_l ; if = 0 exit
- $end Asm
- End Sub
-
New code. New mistakes
video - GKGD matrix
Quellcode
- '20x40 Ledmatrixes RGB, 1_5 scan
- $regfile = "m328pdef.dat"
- $crystal = 16000000
- $hwstack = 64 : $swstack = 64 : $framesize = 64
- Const Dy_num_h = 1 'displays in a horizontal direction
- Const Dy_num_v = 1 'displays in the vertical direction
- Const Bytes_in_row = 5 * Dy_num_v
- Const Row_num = 20 * Dy_num_h
- Const Row_num1 = Row_num - 1
- Const Mem_size = Row_num * Bytes_in_row
- Const Mem_size_1 = Mem_size - 1
- Const Dy_offset = Dy_num_v * 100
- Const Channel_offset = 10 * Bytes_in_row
- 'ports--------------------
- P_r1 Alias Portd.5 : Config P_r1 = Output : Dout_port_r1 Alias Portd : Const Dout_pin_r1 = Pd5
- P_g1 Alias Portd.7 : Config P_g1 = Output : Dout_port_g1 Alias Portd : Const Dout_pin_g1 = Pd7
- P_b1 Alias Portd.6 : Config P_b1 = Output : Dout_port_b1 Alias Portd : Const Dout_pin_b1 = Pd6
- P_r2 Alias Portc.4 : Config P_r2 = Output : Dout_port_r2 Alias Portc : Const Dout_pin_r2 = Pc4
- P_g2 Alias Portc.3 : Config P_g2 = Output : Dout_port_g2 Alias Portc : Const Dout_pin_g2 = Pc3
- P_b2 Alias Portc.2 : Config P_b2 = Output : Dout_port_b2 Alias Portc : Const Dout_pin_b2 = Pc2
- P_a Alias Portc.0 : Config P_a = Output
- P_b Alias Portc.1 : Config P_b = Output
- P_c Alias Portb.0 : Config P_c = Output
- P_ckl Alias Portb.5 : Config P_ckl = Output : Shift_clock_port Alias Portb : Const Shift_clock_pin = Pb5
- P_lat Alias Portb.3 : Config P_lat = Output
- P_oe Alias Portb.2 : Config P_oe = Output
- Config Base = 0
- Const Timer2reload = 70000
- Config Timer2 = Timer , Prescale = 256
- Load Timer2 , Timer2reload
- On Ovf2 Display_refresh
- Enable Ovf2
- Start Timer2
- 'PWM ************************************************** *************************
- Config Timer1 = Pwm , Pwm = 8 , Compare_b_pwm = Clear_down , Prescale = 1
- '************************************************* ******************************
- 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 )
- 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 )
- Declare Sub Set_text_6_8(byval X As Word , Byval Y As Word , Byval Color As Byte)
- Dim Memory_red(mem_size) As Byte , Memory_green(mem_size) As Byte , Memory_blue(mem_size) As Byte , N_1 As Word
- Dim Brightness As Byte
- Dim Red As Byte , Green As Byte , Blue As Byte , Yellow As Byte , Magenta As Byte , Cyan As Byte , White As Byte
- Red = 1 : Green = 2 : Yellow = 3 : Blue = 4 : Magenta = 5 : Cyan = 6 : White = 7
- Dim Text As String * 10
- Dim Tab_start As Word
- Dim Page As Byte
- Dim Mem_offset_1 As Word , Mem_offset_3 As Word
- Dim R_0 As Byte , B_1 As Byte
- Dim St_byte_1 As Word , St_byte_2 As Word , St_byte_3 As Word , St_byte_4 As Word
- Dim Trigger As Bit
- Dim H As Byte , Speed As Byte
- Enable Interrupts
- Gosub Clear_memory
- Brightness = 90
- Speed = 20
- 'Text = "0"
- 'Call Set_text_6_8(0 , 0 , Green)
- Do
- For H = 0 To 99
- Memory_green(h) = &B10000000
- Waitms Speed
- Memory_green(h) = &B11000000
- Waitms Speed
- Memory_green(h) = &B11100000
- Waitms Speed
- Memory_green(h) = &B11110000
- Waitms Speed
- Memory_green(h) = &B11111000
- Waitms Speed
- Memory_green(h) = &B11111100
- Waitms Speed
- Memory_green(h) = &B11111110
- Waitms Speed
- Memory_green(h) = &B11111111
- Waitms Speed
- Next H
- Wait 5
- Gosub Clear_memory
- Loop
- End
- Clear_memory:
- For N_1 = 0 To Mem_size_1
- Memory_red(n_1) = 0
- Memory_green(n_1) = 0
- Memory_blue(n_1) = 0
- Next N_1
- Return
- 'Interrupt service
- Display_refresh:
- Load Timer2 , Timer2reload
- If Page < 4 Then
- Incr Page
- Else
- Page = 0
- End If
- Select Case Page
- Case 0:
- Mem_offset_1 = 0
- Mem_offset_3 = 25 'page=1
- Case 1:
- Mem_offset_1 = 5
- Mem_offset_3 = 30 'page=2
- Case 2:
- Mem_offset_1 = 10
- Mem_offset_3 = 35 'page=3
- Case 3:
- Mem_offset_1 = 15
- Mem_offset_3 = 40 'page=4
- Case 4:
- Mem_offset_1 = 20
- Mem_offset_3 = 45 'page=5
- End Select
- For R_0 = 1 To Dy_num_h
- St_byte_1 = Mem_offset_3 : St_byte_2 = St_byte_1 + 50
- St_byte_3 = Mem_offset_1 : St_byte_4 = St_byte_3 + 50
- For B_1 = 1 To Bytes_in_row
- Shift6out_4h Memory_red(0) , Memory_green(st_byte_3) , Memory_blue(0) , Memory_red(0) , Memory_green(st_byte_4) , Memory_blue(0)
- Shift6out_4l Memory_red(0) , Memory_green(st_byte_3) , Memory_blue(0) , Memory_red(0) , Memory_green(st_byte_4) , Memory_blue(0)
- Shift6out_4h Memory_red(0) , Memory_green(st_byte_1) , Memory_blue(0) , Memory_red(0) , Memory_green(st_byte_2) , Memory_blue(0)
- Shift6out_4l Memory_red(0) , Memory_green(st_byte_1) , Memory_blue(0) , Memory_red(0) , Memory_green(st_byte_2) , Memory_blue(0)
- St_byte_1 = St_byte_1 + 1
- St_byte_2 = St_byte_2 + 1
- St_byte_3 = St_byte_3 + 1
- St_byte_4 = St_byte_4 + 1
- Next B_1
- Mem_offset_1 = Mem_offset_1 + Dy_offset
- Mem_offset_3 = Mem_offset_3 + Dy_offset
- Next R_0
- Pwm1b = 0
- Waitus 100
- P_lat = 1 : P_lat = 0
- P_a = Page.0
- P_b = Page.1
- P_c = Page.2
- Pwm1b = Brightness
- Trigger = 1
- Return
- ' R1 G1 B1 R2 G2 B2
- 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 )
- 'bit7 first to bit4
- $asm
- LDI r17,4 ;only 4 bits
- Loop_shift2out_h:
- in R16, dout_port_r1
- BST r18,7
- BLD r16,Dout_pin_r1
- Out Dout_port_r1 , R16
- in R16, dout_port_g1
- BST r19,7
- bld r16,Dout_pin_g1
- Out Dout_port_g1 , R16
- in R16, dout_port_b1
- BST r20,7
- bld r16,Dout_pin_b1
- Out Dout_port_b1 , R16
- in R16, dout_port_r2
- BST r21,7
- BLD r16,Dout_pin_r2
- Out Dout_port_r2 , R16
- in R16, dout_port_g2
- BST r22,7
- bld r16,Dout_pin_g2
- Out Dout_port_g2 , R16
- in R16, dout_port_b2
- BST r23,7
- bld r16,Dout_pin_b2
- Out Dout_port_b2 , R16
- SBI shift_clock_Port, shift_clock_Pin
- LSl r18
- LSl r19
- lsl r20
- lsl r21
- lsl r22
- lsl r23
- dec r17
- CBI shift_clock_Port, shift_clock_Pin
- BRnE loop_shift2out_h ; if = 0 exit
- $end Asm
- End Sub
- 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 )
- 'bit3 first to bit0
- $asm
- LDI r17,4 ;only 4 bits
- Loop_shift2out_l:
- in R16, dout_port_r1
- BST r18,3 ;start with bit3
- BLD r16,Dout_pin_r1
- Out Dout_port_r1 , R16
- in R16, dout_port_g1
- BST r19,3
- bld r16,Dout_pin_g1
- Out Dout_port_g1 , R16
- in R16, dout_port_b1
- BST r20,3
- bld r16,Dout_pin_b1
- Out Dout_port_b1 , R16
- in R16, dout_port_r2
- BST r21,3
- BLD r16,Dout_pin_r2
- Out Dout_port_r2 , R16
- in R16, dout_port_g2
- BST r22,3
- bld r16,Dout_pin_g2
- Out Dout_port_g2 , R16
- in R16, dout_port_b2
- BST r23,3
- bld r16,Dout_pin_b2
- Out Dout_port_b2 , R16
- SBI shift_clock_Port, shift_clock_Pin
- LSl r18
- LSl r19
- lsl r20
- lsl r21
- lsl r22
- lsl r23
- dec r17
- CBI shift_clock_Port, shift_clock_Pin
- BRnE loop_shift2out_l ; if = 0 exit
- $end Asm
- End Sub
-
My suggestion for the future is to have english discussions/threads in the excellent english forum on mcselec.com
Stefan -
stefanhamburg schrieb:
My suggestion for the future is to have english discussions/threads in the excellent english forum on mcselec.com
Stefan
Is there a ban on all languages except German on your forum? -
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