@JonnyMac said:
This code is the equivalent of pinwrite() after the signals from each stream have been moved into a parallel group.
wr_outs testb outs, #5 wc ' lsb pin in outa or outb?
if_nc setq outsmask ' mux pixouts into outa using outsmask
if_nc muxq outa, pixouts
if_c setq outsmask ' mux pixouts into outb using outsmask
if_c muxq outb, pixouts
SETQ does not have to be immediately before MUXQ, unlike most instances of SETQ. It can be a few or many instructions earlier, as long as Q is not changed in the interim. (Another SETQ is not required before the next MUXQ if the mask is the same and nothing else modifies Q.) Therefore the following code is possible:
wr_outs setq outsmask '
testb outs, #5 wc ' lsb pin in outa or outb?
if_nc muxq outa, pixouts ' mux pixouts into outa using outsmask
if_c muxq outb, pixouts ' mux pixouts into outb using outsmask
I wondered about that, Tony, but ended up duplicating what Chip does in the interpreter. The docs on setq are a little confusing; I interpreted them as saying that q gets reset after the next instruction.
From the latest interpreter:
' PINWRITE(pins,val)
'
pinwrite_ mov w,x 'w=val
setq #2-1 'pop pins and new top of stack
rdlong x,--ptra 'y=pins
ror y,#6 wc 'get outa/outb flag into c
bmask v,y 'make mask
rol y,#6
rol v,y 'justify mask
rol w,y 'justify val
if_nc setq v 'mux val into outa using mask
if_nc muxq outa,w
if_c setq v 'mux val into outb using mask
if_c muxq outb,w
_ret_ dirh y 'enable outputs
Took a peek at the @JonnyMac gamma function today and can now see how this WS2812C version with 5 mA max is much better here (for most cases) than the WS2812B version at 12 mA max.
First of all, you probably don't want full power, even with the C version, so probably limiting max to some value like 25 % or so. I mean, maybe there is a case for blinding brightness, but that is probably unusual...
Anyway, when a limited max gets factored in with gamma, looks like the range of possible levels would be very limited with the B version...
Comments
Hmm... Ok, guess overkill... Still if can strobe at 40*900/8 = 4.5 kHz... Maybe good as a flash for high speed camera...
SETQ does not have to be immediately before MUXQ, unlike most instances of SETQ. It can be a few or many instructions earlier, as long as Q is not changed in the interim. (Another SETQ is not required before the next MUXQ if the mask is the same and nothing else modifies Q.) Therefore the following code is possible:
wr_outs setq outsmask ' testb outs, #5 wc ' lsb pin in outa or outb? if_nc muxq outa, pixouts ' mux pixouts into outa using outsmask if_c muxq outb, pixouts ' mux pixouts into outb using outsmaskI wondered about that, Tony, but ended up duplicating what Chip does in the interpreter. The docs on setq are a little confusing; I interpreted them as saying that q gets reset after the next instruction.
From the latest interpreter:
' PINWRITE(pins,val) ' pinwrite_ mov w,x 'w=val setq #2-1 'pop pins and new top of stack rdlong x,--ptra 'y=pins ror y,#6 wc 'get outa/outb flag into c bmask v,y 'make mask rol y,#6 rol v,y 'justify mask rol w,y 'justify val if_nc setq v 'mux val into outa using mask if_nc muxq outa,w if_c setq v 'mux val into outb using mask if_c muxq outb,w _ret_ dirh y 'enable outputsMoments later....
Okay, that works. Thanks for the feedback.
Took a peek at the @JonnyMac gamma function today and can now see how this WS2812C version with 5 mA max is much better here (for most cases) than the WS2812B version at 12 mA max.
First of all, you probably don't want full power, even with the C version, so probably limiting max to some value like 25 % or so. I mean, maybe there is a case for blinding brightness, but that is probably unusual...
Anyway, when a limited max gets factored in with gamma, looks like the range of possible levels would be very limited with the B version...