Hi People,
I have run into another issue, when trying to drive a led strip the led runs up to position 85 or so, no light up after that despite higher addressing of number of IC variable (see code)
Looking at the code it I think it must be addressing is done with bytes.
Can anyone give me pointers on how change to code to word (>255 postions) addressing.
[code:1:6a5b8dc8a8]
Sub Send_frame_400(byval Number_of_ic As word)
''Local I As Byte
''Local J As Byte
Local Last_channel As word
''Local Temp As Byte
''Local Mask As word
Last_channel = Number_of_ic * 3
''Mask = 128
''MASK = 32768
Sdi = 0
Waitms 1
' Bit Zeiten
' für eine 1, T1H 1.2 Ks T1L 1.3 Ks
' für eine 0, T0H 0.5 Ks T0L 2.0 Ks
push r0 ' enthält das aktuelle Byte des Kanals
PUSH r1
push r16 ' Bitzähler
push r17 ' Kanalzähler
Loadadr Last_channel , X
ld r17,x
Loadadr Led_buffer(1) , X
Channel_loop_400:
ld r0,x+
ldi r16,8
Bit_loop_400:
lsl r0
brcc BIT_0_400
Bit_1_400:
SET SDI
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
RESET SDI
nop
nop
NOP
rjmp Next_bit_400
Bit_0_400:
SET SDI
nop
nop
nop
nop
nop
nop
NOP
RESET SDI
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
Next_bit_400:
dec r16
cpi r16,0
brne BIT_LOOP_400
dec r17
cpi r17,0
brne CHANNEL_LOOP_400
pop r17
pop r16
pop r0
Waitus 60
End Sub
[/code:1:6a5b8dc8a8]
TIA
Jim
↧