Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4 Forum Discussions

DaBa_1448511
Level 3
Level 3
25 replies posted 10 replies posted 5 replies posted

Hi,

I'm running Windows 10 with Creator 4.3 and have a problem that doesn't seem like it's my code (I dare say!), as I've got it down to a very small bit of logic that causes the problem. My hardware has CY8C4246AZI-L423 talking through SPI to four 8x8 LED matrices (MAX7221 drivers). Recently I added text scrolling, which is where I'm seeing the problem and hoped you might be able to help. I stripped down the project to something that just demonstrates the issue and attempted to upload, but it’s still too large. It is uploaded to here: https://1drv.ms/u/s!AhyfeBQ6yeGBpF1o9PF4jRsEuv-q?e=SxRAKA

At line 235 the program creates the final byte sets to be sent out to each display, with a shift factor affecting each. The characters are 4 bits wide, so two are contained in each byte set. That is intended to look like this:

dcbytes[0]=(a<<SH) || (b>>(4-SH));

dcbytes[1]=(b<<SH) || (c>>(4-SH));

dcbytes[2]=(c<<SH) || (d>>(4-SH));

dcbytes[3]=(d<<SH) || (e>>(4-SH));

However, including the code on the right side of the OR turns it into garbage, where all that is displayed is a single vertical line at the right of each matrix. If I comment off that right side, I get roughly what is intended, albeit missing some of the dots in some of the characters as they scroll.

for clarity:  (below works but with some "distortion" of the characters)

dcbytes[0]=(a<<SH);  // || (b>>(4-SH));

dcbytes[1]=(b<<SH);  // || (c>>(4-SH));

dcbytes[2]=(c<<SH);  // || (d>>(4-SH));

dcbytes[3]=(d<<SH);  // || (e>>(4-SH));

Any help would be much appreciated.

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Hi

If you want to perform bit or

use only 1 of |
not 2  ||

So I think

dcbytes[0]=(a<<SH) || (b>>(4-SH));

should be

dcbytes[0]=(a<<SH) | (b>>(4-SH));

moto

View solution in original post

0 Likes
2 Replies
MotooTanaka
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Hi

If you want to perform bit or

use only 1 of |
not 2  ||

So I think

dcbytes[0]=(a<<SH) || (b>>(4-SH));

should be

dcbytes[0]=(a<<SH) | (b>>(4-SH));

moto

0 Likes

Thank you for your input. That did fix the major problem. There is now a new distortion in the characters. Perhaps there is something wrong with my logic. I'll experiment further. Thanks again.