After I turned in my initial report, I demonstrated the display in the lab. Since the display seemed too dim, Fred suggested that I use the oscilloscope to see the duty cycle of each column. I was surprised to see that each column was enabled for only 4% of the time.
I rearranged the code so that it keeps a column enabled while it calculates the value for the next column. I also inserted a delay so that a proportionally longer time would be spent with a column enabled than in switching between columns. I increased the delay to the maximum value before the display began to flicker.
Note that the LogoChip has to write the row value for a column after it has turned off the previous column. This is necessary to avoid bleeding from one column to the next.
With this improved code, the duty cycle was increased to 19% and the display was noticeably brighter. Since there are 5 columns in the display, the upper bound is 20%, so this result is quite good. Even when I increased the delay to the point where the display flickered, the duty cycle improved by only 0.2%.
Here is the new LogoChip code:
constants [[porta 5][porta-ddr $85]
[portb 6][portb-ddr $86]
[portc 7][portc-ddr $87]
[adcon1 $9f]]
global [char rows prev curr]
to main
write adcon1 6
write porta-ddr 0
write portb-ddr 1
setchar $21
when [newbus?] [if brcv = $180 [waituntil [newbus?] setchar brcv]]
setprev 4
setcurr 0
loop [
setrows read-rom $1000 + ((char - $20) * 5) + curr
repeat 30 [no-op] ; kill some time
setbit prev porta
write portb rows
clearbit curr porta
setprev (prev + 1) % 5
setcurr (curr + 1) % 5
]
end