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

Username:   Password: 
 RegisterRegister   
 Parallelput help? I'm kinda lost!
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
NitzGuy




PostPosted: Tue Oct 21, 2003 10:06 am   Post subject: Parallelput help? I'm kinda lost!

Sup. What I have here is a student project for a grade 9 class (I do co-op and assist with teaching) and they are doing a project where they need to soldier together 2 logic gates and a 7 segment LED, and then interface it with the computer to get it to display stuff. So far, I have programming to display stuff, but only the numbers come out correctly on the display. I have come to the conclusion that what I need to do is make something that is like input A=parallelput(20) or like a better example, S = parallelput (21) (21 displays an s shape on the 7 segment LED). I am not an uber l337 turing programmer, and I could use some help here Very Happy

This is the code I have so far, if someone could explain to me how to take an input and convert it to a number that parallelput could use, or just integrate it into my current code, it would be greatly aprecieated Very Happy

code:

var name:string
put "Enter your name"
get name:*
for counter:1 .. length(name)
     put name (counter):8, ord(name(counter))
     parallelput (ord(name(counter)))
     delay (2000)
end for


and that does display 0-9 correctly on the LED, but letters come out incomplete and jumbled. Thanks in Advanced, Nitz.
Sponsor
Sponsor
Sponsor
sponsor
hackman




PostPosted: Tue Oct 21, 2003 10:54 am   Post subject: (No subject)

Just wanted to say, thats one hell of a grade 9 asignment. Im in grade 10 and i barely know what your talking about. Sorey I cant help ya.
Tony




PostPosted: Tue Oct 21, 2003 3:23 pm   Post subject: (No subject)

heh, grade 9s just solder the board and hook it up to the software writen in turing Laughing

Anyways, ord() converts a character to its ASCII value. I'm not sure how parallelput and LEDs work, but ASCII value of non numeric values might not neccesearly correspond to the values needed for parallelput.

The following program should shed some light on how parallelput displays values.
code:

for i:1..255
     locate(1,1)
     put "Now Displaying : " + chr(i)
     parallelput (i)
     delay (2000)
end for


The computer screen will display all characters while LEDs will display whatever coresponds for that ASCII value. From there you can draw your own chart
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
NitzGuy




PostPosted: Wed Oct 22, 2003 4:05 pm   Post subject: (No subject)

Thanks tony, ill give it a try on friday.

Yeah their grade 9's, its a general technology class, 3 parts I think, one doing computer and electronics, other doing auto, other doing machining and crap. For this project they have to find out IC pin outs and figure out what ICs they need depending on the logic gates we give them and then they make a diagram on how to connect it all and if it matches the master copy then we let them go at it, from there, they can make their own program or use the one I am attempting to make for them Very Happy
Tony




PostPosted: Wed Oct 22, 2003 5:13 pm   Post subject: (No subject)

heh, if your students will be doing programming - tell them about compsci.ca Very Happy We're always looking for new members to broaden the community.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Rudiger




PostPosted: Wed Oct 22, 2003 7:46 pm   Post subject: (No subject)

ok what is IS and what are GATES and the other thing.....
Blade




PostPosted: Thu Oct 23, 2003 10:16 pm   Post subject: (No subject)

i learnt logic gates in grade 11... we did a unit on it... logic gates take in data and output it depending on which gate you use

of course there's more to it, but i didnt find them that interesting... so i slept most of the time... ok, well i slept all through that class.... was very boring, but i passed with a 94 cuz i did all the assignments
PaddyLong




PostPosted: Fri Oct 24, 2003 12:15 am   Post subject: (No subject)

Blade wrote:
i learnt logic gates in grade 11... we did a unit on it... logic gates take in data and output it depending on which gate you use

of course there's more to it, but i didnt find them that interesting... so i slept most of the time... ok, well i slept all through that class.... was very boring, but i passed with a 94 cuz i did all the assignments


haha exactly like college Razz actually the assignments and shit in high school were harder than college is
Sponsor
Sponsor
Sponsor
sponsor
NitzGuy




PostPosted: Fri Oct 24, 2003 8:07 am   Post subject: (No subject)

Yeah the Grade 9's already have been taught more about logic gates then the grade 10;s, dont ask me why.
NitzGuy




PostPosted: Fri Oct 24, 2003 8:32 am   Post subject: (No subject)

Ok that chart really lost me lol, I went through the whole list, but how can I set it for each letter that is inputted? I was playing with it
Tony




PostPosted: Fri Oct 24, 2003 9:13 am   Post subject: (No subject)

well if you have a list of values needed to be passed for each specific character, you can create an array 1..255, where index is the ASCII value of the character you're trying to output. Then will the array with appropriate values from the chart.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
NitzGuy




PostPosted: Mon Oct 27, 2003 9:57 am   Post subject: (No subject)

Ok I tried that again, let it go through. It's like "Now Displaying : A" and it displays a 1, and for B, it displays a 2, and so on. I'm still not getting how I can make it display letters correctly lol. By the way I'm no pro programmer, I never really bothered with it much. What I was thinking is like as far as I can think programming wise
code:
for A:parallelput(21)
and like
code:
for B:parallelput(22)
stuff like that. Im not sure, pop me some more examples or explinations please Very Happy, I'm just alittle slow sometimes.
Tony




PostPosted: Mon Oct 27, 2003 6:06 pm   Post subject: (No subject)

ok, see... "Now Displaying : A" and it shows "1" means that ASCII does not correspond to values you need.

the value of
code:

ord("A")

produces 1.

Now you just have to wait untill your display board will show "A" and read the computer screen to see what value has been passed.

I think this program will help:

code:

var list:array 1..255 of int
var letter:string(1)

for i:1..255
     parallelput (i)     
     locate(1,1)
     put "What letter is displaying?"
     getch(letter)
     list(chr(letter)):=i
end for


You just sit there, and type in whatever character has been displayed. Now all the values will be stores in array named "list" You might want to save that list in a file and import it in programs so you dont have to retype everything.

If I'm correct, then
code:

parallelput (list(ord("A"))

should display "A" on your LCD
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
NitzGuy




PostPosted: Thu Oct 30, 2003 10:04 am   Post subject: (No subject)

Ok I'm getting 1 error when trying to run that program.
code:
list(chr(letter)):=i


Argument to 'chr' must be integer.

Help? lol.
Dan




PostPosted: Thu Oct 30, 2003 12:20 pm   Post subject: (No subject)

chr() only takes an int, you probly wont ord()
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
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 2  [ 18 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: