Implementing microcontrollers (AT89C51-24PC)

  • Thread starter Packocrayons
  • Start date
In summary, the main reason to move away from the Arduino for programming is the increased difficulty of the task. The Picaxe chip can do more than the Arduino and is more powerful.
  • #1
Packocrayons
49
0
I'm planning on learning how to use microcontrollers (ATmega series) so that I can use the skill for various other projects.
I already know how to use arduino (which use the ATmega series of microcontrollers) and I feel as though this will only be an extension, since the coding will be the same.
What is required circuitry wise in order to run this? I understand I likely need to have a 5V regulator and peripherals in order to power the logic, but what else?
Do I need to add some sort of flash memory? What about SRAM?
Is programming as easy as hooking up the right pins to a USB cord and flashing to the chip (using which program, will the standard arduino program work for this?).
 
Engineering news on Phys.org
  • #2
There is a big difference between programming an Arduino in a C/C+ language and programming an Atmega in machine code.

So, if you want the convenience of the high level language, you should stick to the Arduino.

I often use Picaxe chips because they can be placed in normal circuits like any other IC, perhaps unlike the Arduino which requires a relatively expensive circuit module. Picaxe chips start at about $3.
 
  • #3
What do you mean by machine code?
I'd like to learn and be able to expand my horizons, withing reasonable difficulty. I don't like the picaxe flow chart system, it's too easy.
 
  • #4
Actually I should have said Assembler code.

Here is an introduction to Assembler for an Atmega:
http://www.avr-asm-download.de/beginner_en.pdf

Don't knock Picaxe, at least on the grounds of being too easy. Easy is good.:biggrin:

You don't have to use the "kiddy" flow charts. Real programming is done in a type of Basic which is heavily laced with I/O commands. It can be challenging enough if you try to get serious about programming.

I have a friend who wanted to read a pot voltage and convert the result to Pulse Width Modulation to control a motor.

A hardware solution to this was going to be very complex while a Picaxe did it in about 4 lines of code.

Have a look here:
http://www.picaxe.com/
http://www.picaxe.com/Getting-Started/PICAXE-Manuals
 
  • #5
Well I am still 16 so maybe I should go for the kiddy programming :p
The main reason I'm moving away from arduino is because I want more of a challenge, as well as the ability to expand by using different micros.
I guess picaxe it is, it seems both languages are reasonably similar so I won't be losing anything.
Thanks for the help.
 
  • #6
Each Picaxe chip can do a large number of useful tricks and it is worth knowing about them so you can use them if you need to.

There are "programming kits" available but these tend to be overpriced and you can make a programming cable yourself for a few dollars or less if you have an old serial mouse you don't want.

I like the freedom of buying a cheap powerful chip I can just plug into a socket and use instead of having to buy a module (like Arduino or Stamp) which costs a lot more and is much more bulky.

If you want to get started, go for a larger Picaxe chip like the Picaxe 20X2. The 20 means it has 20 pins but it looks like any other DIP chip.
 
  • #7
I was planning on going with the 28 something one (forget the name).
What do I need to make the programming cable so that I can get it on the same order?
 
  • #8
Packocrayons said:
I was planning on going with the 28 something one (forget the name).
What do I need to make the programming cable so that I can get it on the same order?

There are several 28 pin Picaxes and some of them are nearly 10 years old now. The important bit is the end part of the type number.

Look for an X or an M. These are more recent. They have more memory and can operate at faster speeds than the older ones.

Download the manuals from the link above.
http://www.picaxe.com/Getting-Started/PICAXE-Manuals
The first one gives the programming cable details. It is just two resistors and a serial port plug.
It also gives the pinouts of the various chips.
 
  • #9
Okay so I have it (I actually ended up with 2 20M2's) and I'd like to start programming as soon as possible.
I'm planning on making my own cable from a USB port. What is the pinout and/or wire color of a standard USB port on a computer? I don't have the right connectors on my laptop as depicted in the manual, and it never says anything about USB ports as far as I know.
 
  • #10
If you don't have a serial port on your laptop, you will need a USB to serial adapter. You can't directly connect the USB port to the Picaxe input.

However, not all such adapters will work for programming a Picaxe chip. You need to get one which is assured to work for Picaxe programming.

You could have a look on the Picaxe Forum to get a type of adapter that works OK. This comes up as a topic quite often and you should find one easily. Ebay has them for $1 plus postage, but they may not work.

Alternatively, you can get a USB cable from Rev-Ed in England. It is type AXE027 and sells for about 10 pounds (British).
http://www.picaxe.com/Hardware/Cables/PICAXE-USB-Download-Cable/
Other distributors sell these too.

Just about any old PC is OK for this job so you could consider using an older computer just for programming. Even very old laptops had a serial port on them.
 
  • #11
Alright, I guess I'll have to pull out the dinosaur and use it. It's only 13, it can handle it :p.
What about building the adapter? I do have one built for programming brushless motor controllers, I'm assuming it'll be different?
 
  • #12
The programming board for a Picaxe is so simple, it is easy to just include the couple of resistors on each project board.

You can buy programming boards, but they tend to be expensive. Putting a socket on a bit of circuit board with pre-etched tracks is pretty easy and there are lots of such boards available.

If you can find it, this type would be OK:
http://www.jaycar.com.au/products_uploaded/productLarge_1105.jpg

You may have an old serial mouse you don't want any more. Like the old ball type. You can use the cable from that.
Just trace the wires with a multimeter on "ohms".

Using a serial port is very simple and avoids the problems some people seem to have with USB ports, so it is good to, at least, start with a serial port.
 
Last edited by a moderator:
  • #13
I'll crank out an old computer then and start with the serial port. Once I get it working and want to be able to flash more often I'll start working on a USB to serial.
 
  • #14
Yes, that would be a good choice. You could just leave it set up while you test the various commands from the Picaxe manual.

You need all three manuals and you can download them from here when you download the programming editor:
http://www.picaxe.com/Software
I suggest you print out the pinout diagram for the 20M so that you can refer to it easily.

A useful setup would have a couple of LEDs (with series resistors) a switch, a pot and (because the 20 M can produce music) a sound transducer.

This would let you test various input and output commands. You will find these very well documented in the second manual with liberal use of examples to explain the command structures.

This is a very powerful chip and it should keep you amused for a while.
 
  • #15
I plan on being very amused. Maybe next I'll build a little ipod with flash memory with an 08M2.
I'll make a book with the cover page being the pinouts and print out the manual on paper for quick reference.
 
  • #16
OK. Maybe try to turn a LED on and off before you make an iPod?

The Programming Editor has a pull down syntax help thing which is useful when you want a quick clue like where to put the brackets, etc.
But a printed version would be nice, if a bit bulky.
 
  • #17
Yeah I'll start slow. I'll learn quickly once I get started because of my experience with arduino.
Old laptop is not working, so I'm going to have to jump right into the usb to serial. Wheres the best place to get started?
 
  • #18
I did notice this on Sparkfun:

https://www.sparkfun.com/products/9260

Seems promising. You have to install some drivers and it then seems like a com port to your laptop.

They are in Boulder, Colorado.

Yes, the batteries in laptops do not cope well with not being used so even a year or so of disuse is enough to wreck them. I fixed one by leaving it on charge for a few days. It suddenly fixed itself and started to charge.

Have you downloaded the Programming Editor yet?
 
  • #19
Seems like a pretty simple circuit. I might have a line on a free laptop with serial ports but if not I'll do that. Screw the breakout board, it's too easy :p.
Yes I have the editor.
 

Related to Implementing microcontrollers (AT89C51-24PC)

1. What is a microcontroller and how does it work?

A microcontroller is a small computer on a single integrated circuit that is designed to perform specific tasks. It contains a processor, memory, and input/output interfaces. The AT89C51-24PC is a specific type of microcontroller that uses an 8051 architecture. It works by executing instructions stored in its memory in response to input signals from its interfaces.

2. How do I program the AT89C51-24PC microcontroller?

To program the AT89C51-24PC microcontroller, you will need an external programmer and a software development tool such as the Keil uVision IDE. The programmer connects to the microcontroller and allows you to upload your code to its memory. The IDE provides a user-friendly interface for writing, compiling, and debugging your code.

3. What are the advantages of using a microcontroller like the AT89C51-24PC?

Microcontrollers offer several advantages compared to traditional computers. They are smaller, more cost-effective, and consume less power. They are also designed for specific tasks, making them more efficient for those tasks. Additionally, microcontrollers can be integrated into a wide range of devices, making them ideal for embedded systems.

4. Can I use the AT89C51-24PC microcontroller for projects involving sensors and actuators?

Yes, the AT89C51-24PC microcontroller can be used for projects involving sensors and actuators. It has built-in input/output interfaces, including analog-to-digital converters and pulse-width modulation outputs, which allow it to interface with a variety of sensors and actuators. Additionally, its programmable nature makes it versatile for different types of projects.

5. Are there any common challenges when implementing microcontrollers like the AT89C51-24PC?

One common challenge when implementing microcontrollers is ensuring compatibility between the microcontroller and other components in the system. It is important to carefully select components that are compatible with the microcontroller and to properly configure the interfaces. Another challenge can be debugging and troubleshooting code, as microcontrollers often have limited debugging capabilities. It is important to thoroughly test and troubleshoot code before deploying it in a project.

Similar threads

  • Electrical Engineering
Replies
5
Views
2K
  • Electrical Engineering
Replies
3
Views
2K
  • Electrical Engineering
Replies
4
Views
5K
  • Computing and Technology
Replies
5
Views
2K
  • Electrical Engineering
Replies
32
Views
3K
  • Electrical Engineering
Replies
19
Views
2K
  • Electrical Engineering
Replies
2
Views
1K
Replies
11
Views
2K
  • Electrical Engineering
Replies
5
Views
1K
  • Electrical Engineering
Replies
7
Views
3K
Back
Top