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

Username:   Password: 
 RegisterRegister   
 Plz Help Parallel Porting
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
cwlvc




PostPosted: Thu Jan 10, 2008 5:50 pm   Post subject: Plz Help Parallel Porting

i need HELP

i have written this program in class, i have done what the teacher asked us for. The program just adds two numbers and shows the answer.

BUT i need to add one thing i don't know HOW?
ok here is my story, , in computer engineering first we build a counter by using a 7 segment ship. after that i need to use the program below in order to show the sum of the answer of the cicuit or the ship. SO if the answer is 7. then on the 7 segment it will show the number 7.

basicly i don't know how to use parallelporting


so plz can anyone help me Confused


loop

var variableName : int
var num,ans : int
put "enter a number between 1 and 5 "
get num
cls
put "the number you entered is " , num
delay (1000)
cls

var num2 : int
put "enter a number between 1 and 4 "
get num2
cls
put "the number you entered is " , num2
delay (1000)
cls

var sum : int

sum := num + num2
put num," + ",num2," = ",sum
delay (1000)
cls
put "if you want to exit, press 1, if you wanna redo it, press 2"
get ans
exit when ans = 1
cls


end loop
Sponsor
Sponsor
Sponsor
sponsor
McKenzie




PostPosted: Sat Jan 12, 2008 3:14 pm   Post subject: Re: Plz Help Parallel Porting

cwlvc,

The reason no one is helping is that your post is way too vague. There is a lot of knowledge involved in getting a 7-segment display to work properly.
1. You need to understand how to send information using parallelput. Pins 2-9 are the data bits. Basically when put your number, look at it's binary representation, the 1s will be 5v, and the 0s will be 0v. e.g with parallelput(6), 6 is 110, so pins 3 and 4 will get power.

2. The hard part is getting the seven segment to display the right value. Each segment has a pin that controls it. There is a chip (I forget the number) that will take binary input and output the correct values for the 7-segment display.

3. If you are not supposed to use that chip you need to make a table that looks at when you need each of the segments and build a circuit for each segment. I would suggest K-Mapping to get a minimal circuit for each.

4. Because the biggest number you need is 7 you will only need three likes of your parallelport. You could instead use seven lines from your parallel port, and do all the heavy lifting in your program.
fobbio




PostPosted: Sat Jan 12, 2008 3:52 pm   Post subject: Re: Plz Help Parallel Porting

Hey, I'm doing the same thing and I can't turn my 7 segment on as well.
I have a few questions:
1)I've seen examples of this program with the 7th segment and all of them have like "cls" and "delay (1000)", I did not put those things in mine. I do not understand WHY you put those there, what do they do?
2)Also at the end I put parallelput (product), product being the sum of num1 and num2. I had hope that would work, but it doesn't. Is my idea of "parallelput (product)" correct? should it even be there?
Tony




PostPosted: Sat Jan 12, 2008 5:23 pm   Post subject: RE:Plz Help Parallel Porting

@fobbio
delay(1000) pauses the program for 1 second. Sometimes you want to slow things down, so this is it.

Your idea about num1 + num2 is not entirely correct, seeing as parallelput(num1) will not be correct either.

Re-read what McKenzie has said above. Especially the part about a lookup table.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
fobbio




PostPosted: Sat Jan 12, 2008 7:13 pm   Post subject: Re: Plz Help Parallel Porting

I've read what mackenzie said, I have the chip, and its the right one cause the teacher gave it to me, I just don't know how to make the 7-segment show the number that is the sum of num1 and num2. I plug it into the computer and it lights up as 8, and it just stays there. I really need help on what to type to make the number show on the 7-segment. If you people have any idea what commands to use, please show me, its really important to me!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: