Finished my 8255 driver object!
Dennis Ferron
Posts: 480
I finally finished my 8255 driver object. It is the first step to getting my suitcase computer up and running. I posted it to the object exchange but I wanted share my excitement on the forum and put up a few pictures.
Some things that this driver + the 8255 chip will allow you to do that you "couldn't" do before: program RAM / EEPROM chips that have many address lines, connect to IDE hard drive (connect electrically speaking, but you still need to send the right codes), get more I/O pins.
Basically what the 8255 chip gives you is a whole bunch of extra I/O pins that you can program how you want. If you need to control a great many lines in parallel, then any way you slice it, the 8255 is the best solution. My driver object allows you to connect up to sixteen 8255 chips on the same data bus, allowing the Propeller to control as many as 384 I/O lines.
In my suitcase computer, I'm using two 8255's to program SRAM chips in the 68000 side of the board, and to run the control inputs to my 68000 processor. This will allow the Propeller to pre-load a program into the RAM chips and then cause the 68000 to run it. No ROM needed.
I'm also going to be using an 8255 to connect to an IDE hard drive. I set up the circuit to be similar to how a demo board would be connected so that people with the demo board might be able to use this too. My 8255 driver object would allow you to put an 8255 on the demo board and control an IDE hard drive. When I have it finished I will post an IDE hard drive controller object that uses the 8255 in this way. The 8 free pins on the demo board can be connected to the 8 data bus pins of the 8255. Unfortunately, you have to find a way to get 6 more pins for the control bus. I sacrificed the VGA pins for this purpose - thus my PropStick-based circuit only has TV out.
Later I plan to add another 8255 chip to interface to both Playstation controllers and to NES controllers.
Some things that this driver + the 8255 chip will allow you to do that you "couldn't" do before: program RAM / EEPROM chips that have many address lines, connect to IDE hard drive (connect electrically speaking, but you still need to send the right codes), get more I/O pins.
Basically what the 8255 chip gives you is a whole bunch of extra I/O pins that you can program how you want. If you need to control a great many lines in parallel, then any way you slice it, the 8255 is the best solution. My driver object allows you to connect up to sixteen 8255 chips on the same data bus, allowing the Propeller to control as many as 384 I/O lines.
In my suitcase computer, I'm using two 8255's to program SRAM chips in the 68000 side of the board, and to run the control inputs to my 68000 processor. This will allow the Propeller to pre-load a program into the RAM chips and then cause the 68000 to run it. No ROM needed.
I'm also going to be using an 8255 to connect to an IDE hard drive. I set up the circuit to be similar to how a demo board would be connected so that people with the demo board might be able to use this too. My 8255 driver object would allow you to put an 8255 on the demo board and control an IDE hard drive. When I have it finished I will post an IDE hard drive controller object that uses the 8255 in this way. The 8 free pins on the demo board can be connected to the 8 data bus pins of the 8255. Unfortunately, you have to find a way to get 6 more pins for the control bus. I sacrificed the VGA pins for this purpose - thus my PropStick-based circuit only has TV out.
Later I plan to add another 8255 chip to interface to both Playstation controllers and to NES controllers.
Comments
I've been throwing around the idea of a "suitcase computer" and the prop is a great way to go!
Nice job on interfacing with the 8255's, the extra I/O's will certainly be handy.
I see that you are using a massive breadboard for this, are you planning on maybe doing a pcb for this? Or possibly soldering everything together on a perfboard? I know that the soldering would be a PAIN, but it would be cool.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
while alive = 1
wakeup
program(propeller)
eat(3)
sleep(7)
(Affordable = cheaper than the Propeller )
With the IDE-interface, it should also be possible to read/write to CF-cards...
(I have a few IDE-to-CF adapters. one is in 2.5" format to replace HDDs in laptops, but if it's possible to go direct from 8255 to CF, that would be nice, too)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't visit my new website...
Building a device and putting it in a case is one thing, but it looks as though you got a case and are having to build a device for it. Great job!
Are you going to keep it all on bread boards or do you plan to print a circuit out?
But seriously, a 1.8" IDE drive would be awesome..
bambino - I'm flattered that you made the observation. Yes, I often do get the case/chassis for a project first and dream up something to put into it. As another example, I got a wooden box, like a small pirate's treasure chest, because it fascinated me for some reason. I didn't have any idea what I was going to do with it. I ended up taking my miter saw and some fence stakes and giving it 4 legs like a crab. I used brass hinges for the joints to keep the "look" of the wooden chest. When I get around to fastening the servos, it will make a neat walking robot, and I plan to hide the high-tech parts as much as possible so that it really looks like a walking wooden and brass construction. I want to keep that theme to it.
For me, having a solid piece in front of me to turn over in my hands and comtemplate makes the project more tangible. I sort of do the whole thing in reverse, really, because rather than starting with plans, I start with a case or a box, build a circuit to go in it, and then I document what I did to get the schematic out of it. I never work from a schematic from the start; I keep the circuit diagrams in my head while I'm building.
I got 2 of my 8255's from an old computer, but I bought several more from Jameco for $5 a piece. Since the Propeller is only $12, it really almost does make sense to use more Propellers to increase the I/O, because then you only need a serial interface between them. The advantage to doing it with the 8255s is really more in that the 8255 is a 5 volt part, so it doesn't need resistors on its inputs as the Propeller would when connecting to 5 volt signals. However, I have a second Propeller and I may use that to interface to NES controllers simply because the NES interface object has already been written by someone else. Sometimes, it is easier to change the hardware to fit the software.
Cobalt, bambino - I will probably keep this particular model strictly on breadboards simply because as I built more on it I came to realize that what I have here is a super-amazing development lab, and keeping everything on the breadboards will allow me to continue to experiment with it and with new devices and never freeze the design. As the circuits get more complex I do worry about a wire coming lose while I'm carrying it around, so when I get a chance I'm going to solder the ribbon cables you see to pin connectors that will plug into the breadboard. Much less chance of an entire connector coming out.
What I do plan to do is, rather than taking this model apart and converting it to a soldered board, I'm going to take what I learn on this one and use to it build a better, smaller portable propeller computer that is permanently soldered. I have a tiny keyboard meant for a Palm Pilot, and I think that I could add a false base onto the bottom of it to store a Propeller protoboard and batteries. It might be a bit thick but it will *look* small when you see it from above because it will have a small outline. I'm waiting until the new Propeller protoboard comes out. My Palm Pilot keyboard has a lid on it which is just the right size to cut into to mount the 2.5 inch LCD tv into it. With some ports for Playstation controllers, this would make a nice portable game machine.
Although the suitcase computer has 256K of RAM on it and a second processor, I will keep this 2nd portable propeller computer down to just the Propeller chip because it is important that the code be interoperable with other people's setups. I benefit from this (can use other people's objects) and you benefit from this (can use my objects and circuits). In fact, if anyone knows of a suitably small PS/2 keyboard that is not too expensive, I would rather use that than the Palm Pilot keyboard just to keep compatibility.
In the front of the case you can see a 2.5" IDE drive from an old Thinkpad. Although using flash memory would be more pratical, I want to get the IDE interface working with a "real" IDE hard drive, one with platters, just to know that I have done it. Originally I was going to use a full size IDE drive, but I compromised with myself that I would use the laptop hard drive because it has lower power requirements.
The IDE interface would give me compact flash, but there is an even easier option: In the future, especially in the 2nd model I discussed, I will probably use the DOSOnChip module from Sparkfun so that I can store files on SD cards and not have to manage the file system myself. Maybe by then Mike's OS will even support it natively.
It would be nice to breathe some new life into it someday.
Keep up the good work and don't scare to many people with that walking chest AAY!
First off, you can get cheap adapters that accept a full-size IDE hard drive cable and power connector and plug into the small connector on the laptop hard drive. You'll need the full sized IDE cable for this.
Then, buy 4 sets of single row headers, each of them 20 pins long. Take a length of pcb perfboard and cut a rectangle 20 holes long and 4 holes wide. Solder 2 of the headers in the middle of the board face-up. Solder the other two rows of headers onto the perfboard face-down. Now you've got an "IDE to DIP adapter" that you should be able to push into a breadboard as if it is a skinny 40 pin IC chip. You'll be able to plug an IDE cable into the face-up headers and make breadboard connections to the face-down header pins.
See my attachments.
As I said, I think one good reason to use the 8255 with the Propeller is that then you only need to protect 8 pins from 5 volt inputs, instead of 24.
A few gotchas with the 8255:
Make sure you always have bit 7 set high when writing control words. (I see that your BS2 files do this correctly.) If you don't set it, the 8255 will interpret it as a PortC bit-set command instead of a port direction change command. That tripped me up at first with my project because the Intel docs are not clear on this. They call bit 7 = high the "mode set" flag but actually it has to be high even if you're only changing the direction and not the mode. A friend of mine loaned me a really good book called "Microcomputer Interfacing with the 8255 PPI Chip", by Paul F. Goldsbrough. It's 214 pages! And every page of that is needed - the Intel docs really fly over it too quickly. Once I read this book some of the annoying problems I had controlling the 8255 turned out to be just cases where I didn't understand the datasheet fully.
Oh, and despite what the datasheet says, you can't read back the control word, at least not from the chips I have. Reading from the control word just returns garbage.
Thanks for the good info. I have taken a long time to research this 8255 chip myself even though there may be more moddern ways of adding more outputs such as the 74HC595 as seen in much of the BS2 postings. I like staying in touch with what I am familiar with as I used this in college with an 8080 design I believe in my EE days. I also have been studying my first computer the ZX81 or what else is known·by the Timex Sinclair 1000. I have bought a couple on Ebay and are slowly working (when time permits and I feel the urge) to interface it to the 8255 and modern technology like an SX-28 or BS2 (or maybe even a propellor - although I have not spent alot of time on it since I got my·Propstick and needed to learn a new·SPIN and / or Assembly language). I would like to see a PropBASIC or something more familiar to me. Yes I know that SPIN is similar but just a bit past·my threshold level. But nevertheless I will learn SPIN at one point. Ok I am digressing.
I searched everywheres on the web for any other documentation for the 8255 and I saw nothing except the book you mention. Low and behold I found it on Ebay and bought it up a few weeks ago. It is a good book but it is very speciallized for assembly and uses·Octal code. I can follow pretty much what is happening because I know the formating so well from studying the datasheet (8255). I have not done much with Inputs because my objective was adding more outputs to the SX-28 and BS2. I bought my initial chips at Jameco like you and got a great deal on Ebay for the rest.
It makes me happy to see others taking an interest in something I have been dealing with so much lately. My wife now says - ok do something with the outputs. lol. Thats another project.
Yesterday there were 8 copies of that book available on Amazon.com
I also picked up 'Data-Parallel Programming on MIMD Computers' with my order, just because I though it sounded neat...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't visit my new website...
Just noticed that you sais amazon, let me try that and see.
Now there is 6 left.
Anyone got a good book on IDE protocals?
It takes a lot of digging but you can find sites that have a little info about IDE interfaces. I figure I'll look them up again when I get to the IDE interface. People have done them for projects and say they were surprised by how easy it was.
However, no matter how good the instructions they give, there is always going to be something that bites you when you try to do it yourself. Maybe your drive behaves slightly differently, or you need to do something they didn't do, or you make a wiring mistake, etc. That's where a book really comes in handy - it can give you a lot more background information.
If you can't find the 8255 book we're talking about, by all means, take a look at my spin code! Almost every line has its own comment, and it is designed to be a step-by-step example of how to use the 8255. When I do the IDE object, I will comment it the same way.
Unfortunately, I won't be working on either of these projects again until May of 2007. I'm going to go work for NASA! I got an internship with the Johnson Space Center that lasts all spring semester, and I decided that I should leave my electronics lab and projects in storage here in Oklahoma until I get back, so that I won't be distracted while I focus on doing the best job I can on whatever I get assigned to work on for NASA. Besides, my electronics lab is too big to fit in my car. I will be getting a Hydra soon though, so I won't be completely out of the loop. I figure I might program a few games in my nonexistent spare time, because that doesn't require a large physical workspace like hardware hacking does.
Hopefully you won't be out of the loop on the Propeller forum.
Enjoy.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
Working at NASA... you lucky b....
Looking for IDE interface info?
Try this page in the wiki...
http://en.wikipedia.org/wiki/Advanced_Technology_Attachment
(Particularly the linked PDFs)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't visit my new website...
Good Luck Dennis, Don't drink the water though, it makes people think they can actually put things in space or something!
As for the 8255 book, I should get it by the middle of the month. I appreciate the code option,I've had to do things that way before. There just nothing like knowing what your doing when you do it though.