wood burning stoves 2.0*
The moose likes General Computing and the fly likes Microcontroller???? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Microcontroller????" Watch "Microcontroller????" New topic
Author

Microcontroller????

Ali Gilani
Ranch Hand

Joined: Mar 01, 2002
Posts: 137
what exactly are micro controllers used for? are they just like micro processors without the motherboard?

i hear its used in the Lego Robots?

Ali
M Beck
Ranch Hand

Joined: Jan 14, 2005
Posts: 323
microcontrollers typically are microprocessors. they're usually small, often fairly slow, CPUs that don't need a lot of extra circuitry (motherboard) to make them work. some of them have memory (RAM) embedded on the same chip as the CPU, others have various other support circuitry as well. they're used for custom hardware applications where you want a small computer to run a (usually small) program which seldom if ever changes; think elevator controllers, fuel injection system controllers, lots of different applications in industrial control systems, ...

and yes, the programmable lego robots are powered by microcontrollers. that's the part that you program; in that particular case, the program (somewhat unusually for a microcontroller, perhaps) isn't fixed and unchangeable in ROM.
[ June 08, 2005: Message edited by: M Beck ]
Ali Gilani
Ranch Hand

Joined: Mar 01, 2002
Posts: 137
How many companies offer microcontrollers? and can anyone buy them??

Also can microcontrollers be used to make a cluster?


Ali
[ June 08, 2005: Message edited by: Ali Gilani ]
M Beck
Ranch Hand

Joined: Jan 14, 2005
Posts: 323
how many companies? i've no idea. i doubt if anyone knows, because it depends on what you'd count as a "microcontroller" — the difference between them and "ordinary" microprocessors is vague. probably dozens of companies, though. Motorola, Zilog (if they're still around), AMD (i think), Intel (i'm pretty sure), and several less known microelectronics corporations do. google it for yourself.

can anyone buy them? well, anyone with the money. i don't know what an "average" microcontroller goes for, or even if there is any "average" such, but i doubt they're any more expensive than desktop computer CPUs. possibly they're cheaper, but of course you still need whatever other hardware is needed to take advantage of them.

a cluster of microcontrollers? i suppose it's possible, but what would be the point? it's much easier to build clusters out of regular computers, and likely cheaper, since you'll have less work to do. ordinary computers tend to be much, much more powerful than microcontrollers, anyway.
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
If you want to get a taste of the microcontroller/processor world just look at Zilog's site (zilog.com). They are just one of dozens of companies out there that make chips. There are even companies that can fab custom chips and have them back to you overnight (if you send them the 'blueprints' of course).

I still have one of their reference Z8 development boards from an embedded systems class I took. It's really pretty fun to play with the stuff. That said if you plan to actully use something like that you really need to know exactly what you want to use it for and what requirments you have.

I'm not sure what you would get from clustering them, you would have more horsepower in a single desktop chip than you would in a dozen of most of these microprocessors.

The question is what are you trying to do?
Ali Gilani
Ranch Hand

Joined: Mar 01, 2002
Posts: 137
Not really doing anything just curious.

SO why use microcontrollers in Lego robots instead of Microprocessors??

Also Does a normal Desktop Computer require a Harddisk? If i put the OS on the ROM and just have a processor and ram would it work??

Ali
M Beck
Ranch Hand

Joined: Jan 14, 2005
Posts: 323
the reason to use a microcontroller is simplicity — they tend to have more of the stuff they need, and that you're likely to need, built-in. things like input/output circuitry, memory, and so on, that with a regular CPU you'd have to add on as extra chips, often come as part of the microcontroller. the backdraw is that they're usually less powerful.

regular desktops can be run diskless, especially if you have them hooked up to a network with a dedicated server computer. (diskless terminals, also called "thin clients"; google those terms.) but if you only have the one single computer, running it diskless is sortof pointless — where would you save your data?
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
I'm actually not sure if the Lego system (which I've programmed in) uses microcontroller(s) or microprocessor(s) (possibly both) as I'm not sure what the actual distinction is. The difference may depend on who you're talking to, not sure. If we go with a general distinction of a microprocessor being more powerful and more capable than a microcontroller I would guess that there is at least one microprocessor in the body of the lego system and at least one microcontroller in each motor or motor interface. Just a guess.

As for desktop computers the only ROM (which is actually some type of PROM) holds the BIOS as it is part of the motherboard. There is usually just enough here to control the the setup and basic diagnostics of the motherboard and whatever features/tools it comes with. It also dictates what it can boot from which is usually a floppy, CD, Hard Drive, USB Drive, Network Drive...

It is quite possible, and I have seen it done, to load a small OS into memory, from disk, and run the computer without any drives. This of course removes the ability to store anything from one boot to the next as everything must be in memory, but it is so fricken fast . Also without a drive you have no 'virtual memory' or 'swap space' so if you run out of memory the program you are using and/or the whole system will crash.

If you were really, really ambitious you could, theoretically, write a BIOS for a motherboard that would also be an OS and run without drives, disks etc... Of course it would be an extremely limited OS as you don't have much space to work with.
Ali Gilani
Ranch Hand

Joined: Mar 01, 2002
Posts: 137
actually heres what i wanted to do.

I wanted to build a car from lego, run by an onboard computer. As Microcontrollers are not easily available in pakistan i would be using a Pentium processor. The car would have to be quite big to house an entire hard-disk, which itself would be quite redundant as the program would occupy 2mb of space and i have heard that the linux kernel can fit on about 20 Mb of space.

That is why i wanted to know if i could run a compute without the darkness. But does this mean that i would have to write my own BIOS program???
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Sorry for the long wait on a response.

I'm not sure what you mean by running an onboard computer. The main body of the lego robotics system has basically a computer built in. It's not something you could run 'regular' programs on, but as you say that a hard drive is to large I imagine you're not planning on attaching a monitor keyboard and mouse.
Ali Gilani
Ranch Hand

Joined: Mar 01, 2002
Posts: 137
i didnt mean using the lego Robot with the microcontroller, rather using Lego to build a different robot with a pentium processor.

Ali
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Let me see if I understand.

You want to take the Lego mindstorm system as in this. Build a car from this. And run the car from a pentium powered computer mounted to it. That pentium powered computer will not have a hard drive attached if possible.

Is this correct? What kind of things will this car do?
Ali Gilani
Ranch Hand

Joined: Mar 01, 2002
Posts: 137
No,

there will be no Lego mindstorm system. I will make a car from Lego pieces(not the mindstorm circuit!!) and attach wheels to it. on top of the car will be a motherboard with ram and a Pentium processor. to install a harddisk would need more room, power and add extra weight. i guess i can plug in a USB 128 Mb memory stick for the OS and the program?, would that work?

Ali
Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
If you're really interested, an Intel 8051 would probably be more than enough to control your car, depending on the size of your algorithm. Would probably cost less than $10 (there are low-ram versions for under $5), depending on where you buy and how much ram you want on chip. But beware, you will need minor skills in electronics to mount it on a board with the actuators you will need.

The thing with these microcontrollers is, you won't be able to fit much on them. You will probably also want to put some ram on it. The 8051 is (or was for a long time if it's not anymore) the industry standard for microcontrollers. About 70% of the world's digital computers are from the 8051 family. They are used in everything from toasters, vcrs, industrial control, ......
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
I'm sorry. I misunderstood.

I think Timmy has a pretty good solution there. If you wanted to go with an actual motherboard and pentium processor you might be able to get something going with a USB drive, but I'm not sure it's worth the expense.
Ali Gilani
Ranch Hand

Joined: Mar 01, 2002
Posts: 137
the problem is that micro controllers are not easily available in pakistan. But pentium processors are. i think i can find the actuators to turn the wheels.

Is there a link that describes using java with actuators? perhaps in the java docs?


Ali
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
You are probably going to have to do alot of C coding to work with actuators unless you can find some Java wrapper. This is all very hardware dependant stuff.

If my small dabble into the world of embedded systems taught me anything it was that when you deal with hardware at that level your world consists of C, assymbler, and many thick specification manuals, at least one for each piece of hardware you are working with.
Ali Gilani
Ranch Hand

Joined: Mar 01, 2002
Posts: 137
You are probably going to have to do alot of C coding to work with actuators unless you can find some Java wrapper. This is all very hardware dependant stuff.


so java cant run actuators? then how does the Lego mindstorm system do it?

Also what is a java wrapper? isnt there a opensource program that converts class files to assembler or bitcode?


Ali
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
The Lego mindstorm runs it's own language. When I programmed Lego mindstorm systems I used a project called BrickOS. This is basically an OS that allows you to run C code on the mindstorm system. Using the BrickOS I had much better control over the robot that was possible with the default mindstorm OS. There is also an OS that allows you the run a slimed down version of Java, but it's not as complete as the BrickOS system. Note that these are basically full fledged Operating Systems.

When I say a Java Wrapper, I mean you find a project where somebody has already done the work of writing the C code and the JNI to deal with the actuators in question.

There are some projects out there that will compile Java to native code, but this is platform specific, I only think they exist for X86 arcitecture.

Java is great, but it is not the best tool for all things. If you want to do low level hardware programming you will want to know C and maybe some assymbler.

There are some embedded Java chips out there, I think the most recent one I've seen has Java 1.3 on it. You might be able to find one of these and build something from that. They do have their limitations though.
Ali Gilani
Ranch Hand

Joined: Mar 01, 2002
Posts: 137
Bell,

thankyou for the reply, but i meant building a system without the Lego Mindstorm system. An altogether different robot. i wanted to know if i could run that with java?

why cant i run actuators with java??

and could you name those embedded chips?


Ali
Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
One company bringing out such java enabled microcontrollers is muvium. I have no idea about pricing. There should also be, somewhere a VM for PIC controllers. The search so far, though, has been fruitless.

If you really wanted to go with a microcontroller, there is a company that will ship worldwide. A PIC 16F84A costs about $3.75 (You will probably pay pretty dearly for shipping to Pakistan, though). Would probably be more worthwhile if you were to order more than one. In spite of hours of googling, I haven't been able to find a VM for it. Muvium says that you can integrate PIC controllers into their system, but they want $10 per controller.

I don't think you will find a pentium for the price, and it is actually a bit overkill. A small controller will be able to handle the software to drive your lego car very well. If you need information about the PIC family and sample projects, there are a couple of books by John Iovine (including one e-version) about the PIC especially with regards to robotics. Do a search of Amazon to find them.

The difference between C and Java for these types of projects is in C it is fairly easy to map a variable to a specific register whereas in Java, you have no control over where in the memory map your variables will land. In C you don't necessarily have to worry about it (for instance when you program your PC using only memory and OS calls) but in order to write device drivers (which you in essence need to do to drive your peripherals in this case), you have to be able to map to a specific address.
 
Don't get me started about those stupid light bulbs.
 
subject: Microcontroller????