Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Output: seven-segment
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
boscostudents




PostPosted: Mon Jun 15, 2009 10:23 pm   Post subject: Output: seven-segment

From the topic my friend made: http://compsci.ca/v3/viewtopic.php?t=21277
Yeah. lol

Since we don't have that chip (forgot the name of it) which its purpose is to connect 2 or more seven-segment displays, and simply do parallelput (34) and outputs 34 on the display.
We only have 2 seven-segment and 2 decoders.

I made an alternate:
Quote:
var input : string
var n1_string, n2_string : string
var n1_stringbin, n2_stringbin : string
var n1_int, n2_int : int

put "Please enter 2 digits: " ..
get input
if length (input) < 2 then
input := "0" + input
end if

%split it
n1_string := input (1)
n2_string := input (2)

n1_int := strint (n1_string, 10)
n2_int := strint (n2_string, 10)



%n1 binary conversion

n1_stringbin := intstr (n1_int, 0, 2)

loop
if length (n1_stringbin) not= 4 then
n1_stringbin := "0" + n1_stringbin
end if
exit when length (n1_stringbin) = 4
end loop

%put n1_stringbin

%n2 binary conversion
n2_stringbin := intstr (n2_int, 0, 2)

loop
if length (n2_stringbin) not= 4 then
n2_stringbin := "0" + n2_stringbin
end if
exit when length (n2_stringbin) = 4
end loop

%put n2_stringbin

%put strint (n1_stringbin + n2_stringbin, 2)
parallelput (strint (n1_stringbin + n2_stringbin, 2))


It requires 2 seven-segment display and 2 decoder chips.
One decoder for each seven-segment.
Connect the first decoder to the parallel port (which uses pins 2-5)
And the second decoder (which uses pins 6-9).

The limitation with this is the max seven-segments you can use are two. Crying or Very sad
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: