
-----------------------------------
NitzGuy
Tue Oct 21, 2003 10:06 am

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 :D

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 :D


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.

-----------------------------------
hackman
Tue Oct 21, 2003 10:54 am


-----------------------------------
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
Tue Oct 21, 2003 3:23 pm


-----------------------------------
heh, grade 9s just solder the board and hook it up to the software writen in turing :lol:

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.

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

-----------------------------------
NitzGuy
Wed Oct 22, 2003 4:05 pm


-----------------------------------
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 :D

-----------------------------------
Tony
Wed Oct 22, 2003 5:13 pm


-----------------------------------
heh, if your students will be doing programming - tell them about compsci.ca :D We're always looking for new members to broaden the community.

-----------------------------------
Rudiger
Wed Oct 22, 2003 7:46 pm


-----------------------------------
ok what is IS and what are GATES and the other thing.....

-----------------------------------
Blade
Thu Oct 23, 2003 10:16 pm


-----------------------------------
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
Fri Oct 24, 2003 12:15 am


-----------------------------------
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 :P  actually the assignments and shit in high school were harder than college is

-----------------------------------
NitzGuy
Fri Oct 24, 2003 8:07 am


-----------------------------------
Yeah the Grade 9's already have been taught more about logic gates then the grade 10;s, dont ask me why.

-----------------------------------
NitzGuy
Fri Oct 24, 2003 8:32 am


-----------------------------------
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
Fri Oct 24, 2003 9:13 am


-----------------------------------
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.

-----------------------------------
NitzGuy
Mon Oct 27, 2003 9:57 am


-----------------------------------
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  for A:parallelput(21) and like for B:parallelput(22) stuff like that. Im not sure, pop me some more examples or explinations please :D, I'm just alittle slow sometimes.

-----------------------------------
Tony
Mon Oct 27, 2003 6:06 pm


-----------------------------------
ok, see... "Now Displaying : A" and it shows "1" means that ASCII does not correspond to values you need.

the value of

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:


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

parallelput (list(ord("A"))

should display "A" on your LCD

-----------------------------------
NitzGuy
Thu Oct 30, 2003 10:04 am


-----------------------------------
Ok I'm getting 1 error when trying to run that program.list(chr(letter)):=i

Argument to 'chr' must be integer.

Help? lol.

-----------------------------------
Dan
Thu Oct 30, 2003 12:20 pm


-----------------------------------
chr() only takes an int, you probly wont ord()

-----------------------------------
Tony
Thu Oct 30, 2003 5:43 pm


-----------------------------------
oh yeah, ops :oops:

it should be

ord() instead of chr(). Thx Dan.

-----------------------------------
NitzGuy
Thu Nov 27, 2003 7:21 pm


-----------------------------------
Ok sorry for the long reply...

Got all that, cept wen I press teh same key like twice, or three times, so on, it displays differant characters. And also I couldnt find a list file, how would I save it?

-----------------------------------
Tony
Thu Nov 27, 2003 7:26 pm


-----------------------------------
ehh :? what?

list is the array which holds the values that correspond to parallelput values needed to display the proper character.

to reuse it later on, you just save the array to a datafile, and then reload it from the file in another program.

I dont understand what you mean by "pressing same key multiple times"
