开发者

How do I write a generic function that takes a Number or some alphabets and display that in 7- bit segment display.? [closed]

As it currently stands, this question is not a good fit for our Q&开发者_运维百科amp;A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

I want to write a Digital Clock application in which I have a 7- bit segment display. I want to write a generic code for displaying all the input. I have a CGPath in which I have 1 line for each segment. Now, how would I write a generic function for the above description? Any help with some logic or code will be appreciated. Thanks


Simplest would be a look-up table. You could do it with ten bytes. Assign one bit in the bytes to each segment. Pre-load the table with the hex values necessary to set the bits. Index the table with your digit 0-9. If you want to have additional combinations of segments then make the table larger -- typically these are set up to display an additional 6 "characters" (eg, A, b, C, d, E, and F), making the table conveniently 16 long.

But, for extra credit, do it with NAND gates.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜