|
USB is complicated. Trust me. I would highly discourage you to implement your own.
That said, the protocol you're looking for is the USB Mass Storage CDC (Common Device Class). You're probably going to have to toush USB Attached SCSI as well.
If you want to do that though, this CH340 won't do, because it is a USB device and not a host. You'll need something with either a USB ROOT hub (like a RasPi), or USB OTG (I heard some AT90's and PIC16F's are capable of this, but I never found anything like that, so dunno).
You also don't "select" devices per se. When a USB device is connected, the USB hub sends you (the ROOT hub) a message. Let's say, it was hub #5. Then you instruct said hub to reset it. This will make the newly attached device assume an address of "5.0". Now, you send a GET DESCRIPTOR followed by a SET ADDRESS to USB address "5.0.0", which is the CONTROL endpoint of the new device. In SET ADDRESS, you give it a permanent address that it can use moving forward.
Now, why did I say you don't really "select" devices? Because, even though you can address individual devices, all attached USB devices will hear the ROOT's messages, and it is up to them to decide whether to activate or not. If you misconfigure a device and cause an address collision, you're screwed.
I could go on and on about USB, but I think you get the point: Don't Implement Your Own.
For your purposes, I'd use a SD/microSD card instead, as these can be used in SPI transfer mode, which is a cakewalk to implement, as opposed to the pain-in-the-backyard you're gonna have if you try to implement a USB host yourselves.
"I don't think about dying. It is the last thing I want to do. " - theoldfool
|
|
|
|
|
Thanks. Upgrading an old computer is not easy and I'm still looking in all directions to see what is reasonable and what is not. Actually I'm not really upgrading it, but restoring it to its original condition and then build a new one with the upgrades.
SD in SPI mode is also possible, but the processor has no real SPI port. however, it does have a few microcontrollerish I/O signals. These already are doing triple duty as bit banged RS232, bit banged cassette tape I/O and bit banged sound generation. Back in the day, be even did digital sound recording and playback with them.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
If I had a 3D printer, could I print myself a stack of $100 bills? The stack doesn't have to be high. A foot or two will do me just fine.
|
|
|
|
|
The treasury will print you a nice set of handcuffs to go with it.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
The Treasury doesn't worry me, but the Secret Service - ooh boy!
|
|
|
|
|
They're the enforcement arm of the treasury, love. =) Little known facet of how the US is structured.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
As long as they let you print a handcuff key. /trollface
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Why print dollar bills? Print a gold bar itself. Or a Platinum object.
Maybe some 3D printers do alchemic transformations.
|
|
|
|
|
Quote: Print a gold bar itself
Good point! Do you have a 3D printer? Wanna go into a partnership?
|
|
|
|
|
Yeah, shared losses are only half the losses.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
I don't have a 3D printer, but about 25 years ago, had seen a STL (Stereolithography) printer, which did something called layered manufacturing using a polymer. I guess today's 3D printers are an evolution of these.
Anyway, my footnote mentions about alchemy, which was supposed to have been practiced by our ancient people, but was systematically destroyed over time.
|
|
|
|
|
Amarnath S wrote: Maybe some 3D printers do alchemic transformations.
Can't I do that with some clever XSLT?
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
That would actually work with a printer that can print metal objects. The problem still is that that filament, powder or whatever the printer uses contains real gold and probably is more expensive than buying that gold bar in the first place.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
but imagine the stuff you could make tho. puts jewelers on the next level.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
You are too late with your idea. Just upload your 3D file and pay the bill: Gold 3D Printing Material Information - Shapeways[^]
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
You could legally print yourself a cheque.
|
|
|
|
|
Quote: You could legally print yourself a cheque
OK, can I please have your bank account info?
|
|
|
|
|
phht, print bitcoins
- nobody really knows what a real one feels like but there's pictures on the net.
1 bitcoin currently at > $7000 (USD). not bad profit for a couple of bucks of metallic printer paste.
take a trip to NY - the capital of fast money greed
how hard would it be to find people dumb enough to buy your bitcoins 'at a discount, say $6000.'
- if they are reluctant show them the pictures on the internet,
- let them bargain you down to $5k
- tell them you need cash because the vending machine is out of change or for a taxi.
this internet has become nothing but fake news.
... time to fix it, time to get back to the fax!
|
|
|
|
|
James, for just $15 an hour, and moderate encouragement, will write you a backtracking recursive descent parser suitable for parsing a modern programming language for less than the cost of using a parser generator tool that cannot parse such languages anyway.
James requires downtime for sleep, recreation, and "family"
Even still, James' parser deliverable will be about the same in terms of scheduling as if you were using a generator tool and refining a grammar input spec.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: James, for just $15 an hour, and moderate encouragement
Define "moderate encouragement".
(Don't you just love those marketing terms?)
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Tell him he's doing a good job. Maybe give him a gold star or a beer and pizza friday or something once in awhile.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
what! all carrots and no stick?
oh wait... OHS probably wouldn't like that.
does he have any relatives in china or india? human rights are only for sissies.
this internet has become nothing but fake news.
... time to fix it, time to get back to the fax!
|
|
|
|
|
If it was outsourced I'd make the team develop the LALR(1) tables by hand.
(parsing geek humor - forgive me)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
In order to implement these operators internally requires the creation of a variable to hold an intermediary result.
i=i+1
versus
var iPrev = i;
i=i+1;
This is murder to implement in an expression parser.
All for what? So some clowns can use a less efficient version of an increment/decrement operator?
is ++<target> really so much worse that <target>++?
In fact, whoever decided on having both? I'd like to have a long conversation with them.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Sometimes you need i++ and sometimes you need ++i. That's why you have them both, and I don't see it as less efficient.
|
|
|
|