Pages: 1 2 [3]   Go Down
Author Topic: 'High' voltage 7-seg LED interface  (Read 2250 times)
0 Members and 1 Guest are viewing this topic.
Norman, OK, USA!
Offline Offline
Full Member
***
Karma: 0
Posts: 127
Klingon Machinist
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Count on it. Thank you.

--
M.S.
Logged

M.S.

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8439
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorted the problem. It needed to be:
Code:
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 smiley

Many thanks for all your help!
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8439
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Doh! + sound of hand slapping forehead  :smiley

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.
Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-grin 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.
Logged

Pages: 1 2 [3]   Go Up
Jump to: