Go Down

Topic: 'High' voltage 7-seg LED interface (Read 4221 times) previous topic - next topic

Mr. Swarf

Glad to help  :) I would strongly suggest that you use common anode though, makes it much easier!

Count on it. Thank you.

--
M.S.
M.S.

Graynomad

I think the problem is that dp_bit is local and reset every time the function is called, try

static byte dp_bit = 0;

Actually using the ^= instead of != should work exactly the same because the DP bit in hour will always be 0 before the operation.
Rob Gray aka the GRAYnomad www.robgray.com

smartroad

Sorted the problem. It needed to be:
Code: [Select]
outputChar(character[hour] ^ dp_bit);

not ^=

I couldn't see why the next 10's minute digit was also being affected and why when I added the static to dp_bit it caused this weird 3 way random brightness flash. By using ^= put the result back into the byte held in the character[] the hour was using, which is why it actually flashed when static dp_bit wasn't used. As the 10's minute was using the same number, on the next run round it also had the DP switched on.

Using the ^ now only applies the result at the time the procedure is called :)

Many thanks for all your help!

Graynomad

Doh! + sound of hand slapping forehead  ::)

Well done, yes that would have had some interesting affects. It's the sort of dumb error I make all the time but normally it's in the code I'm working on and it's fixed 2 minutes later. Much harder debugging code with a 5-hour turn around.
Rob Gray aka the GRAYnomad www.robgray.com

smartroad

Quote
Much harder debugging code with a 5-hour turn around.


I know  ;D But thanks again!

Although now I feel guilty and have to look at the rest of my code to tidy it up :D Already cleaned the main loop, not sure why I had so many IF statements all doing the same thing!! And calling displayOut in every result?! Saved about 50 bytes i think.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy