The DS5000 Micro controller.

Well, finally, this is what all the previous lessons have been getting you ready for. To start looking at the micro we will be using in this course. All the previous lessons have been laying the ground work and basic concepts common to most micros. The one we will be using is the Dallas Semiconductor DS5000 micro controller. This chip, in my mind, is one of the neatest ones ever made. Dallas Semiconductor knew what to put in a chip. There are a few external parts needed along with the DS5000, but they are few, and cheap to buy. I will give you a schematic and a parts list, along with the places to get all the parts later.

I would recommend that you get the Soft Micro controller Data Book from Dallas Semiconductor, as soon as you can. The telephone number is 972 - 371 - 4448. They are located in Dallas Texas at 4401 South Beltwood Parkway, zip 752444-3292. It is several hundred pages, and best of all, it's FREE!! (at least it was when I got mine) It's loaded with information and is absolutely crucial for a good understanding of the DS5000. The book actually covers several versions of the 5000 series of microcontroller chips. It will be the best money you never spent!

My hope is that you will buy one of the DS5000 parts and really start building things with it. I think it costs about $50. Cheap, considering what you can do with it. But don't buy it yet, I'll tell you when. There is still lots to learn before you will be able to start building something with it.

The DS5000 is a microcontroller based on the Intel 8051 microprocessor. It looks like an 8051 as far as programming and the general pinout of the package. The pinout refers to the physical package and what each pin on the package is used for. But the DS5000 is much more. There are 40 pins on the package. Of these pins, 32 are connections to the outside world that information can be brought into or out of the DS5000. There are a few other pins, but more on them later.

These 32 pins show up inside the package as 4 ports. Each port is 8 bits wide and have the names p0, p1, p2, and p3. Each port can be inputs or outputs to or from the outside. Besides being inputs and outputs, p0, p2, and p3 have special functions assigned to them. P0 and p2 are used for external memory interface, which we will not use since there is plenty of memory inside the DS5000. These 16 pins will be used for input / output. But if we were talking about an 8051, this is where memory would connect. Half of the pins of port 3 will be used for their special functionality. The other four pins of p3 will be used as regular inputs and outputs, not using their special functions. These functions will be discussed later, however.

Two pins of p3 are for serial communications with the DS5000. Through these pins, serial data can be sent or received with another computer. This is how we will load a program into the DS5000 from a PC.

Two more pins are for a different kind of input called interrupts. In our example in lesson 1 of the program where we are standing at the street corner, watching the light and the traffic, if a person walked up and tapped us on the shoulder and asked what time it is, this would be an example of an interrupt. It doesn't alter the program we are doing, it just temporarily stops us while we tell the time to the person. As soon as we tell the time, we go back to watching the lights and traffic as before. This describes the action of an interrupt.

The interrupt has a program associated with it to guide the micro through a problem. In the case of the above example, this program would be to look at our watch, read the time, and then tell it to the person. This is called an interrupt service routine. Each time an interrupt occurs, the current program is temporarily stopped and the service routine is executed and when complete, returns to the current program. We will spend a lot more time later describing interrupts and how we'll use them.

Inside the DS5000 is a 128 byte memory area called internal ram (random access memory). The first 32 bytes are used for 4 banks of registers. They are called bank 0, bank 1, bank 2, and bank 3. When the micro is first powered up, bank 0 is the selected bank. Afterwards there is a command which allows switching to another bank, but we won't do that right now. Inside each bank there are 8 seperate registers. They are called r0, r1, r2, r3, r4, r5, r6, and r7. These registers are used for temporary storage of whatever is needed by the program. There is also a register that is the accumulator called a. This register is different from the other 8 registers. It is used to accumulate the results of various instructions like add or sub (subtract).

The next 16 bytes of internal ram are for bit storage and retrieval. This allows for 128 different bits that can be used by the program. Most early micros didn't have this very useful feature.

The last 80 bytes of internal ram are for general storage and is used for many different things.

There is another 128 byte area of memory called the special function registers. This is where p0, p1, p2, and p3 are located. The accumulator and program counter are also in this area along with other registers that control various aspects of the operation of the DS5000. More on these as they come up later.

Lastly there is one more area of memory that is divided into two parts. The program memory and the data memory. This is in reality a block of 32K (32768) bytes of ram that, through the programming of one of the special function registers, can be divided into the two sections. In most of our work we will divide this up into 16K (16384) bytes of program and 16K (16384) bytes of data. The program memory is write protected so that an errant program can't change itself accidently and really make a mess out of things. The data memory can be written to or read from as needed by the program.

There is a lithium battery inside the DS5000 that keeps all the memory alive when power is turned off. This is one of the neatest features of the DS5000, and I don't know of another micro that has this. In most micros there is PROM ( programmable read only memory) or EPROM (erasable programmable read only memory), as the program memory. PROM can be programmed once and that's it. EPROM can be programmed and then erased with ultra violet light through a glass window in the micro's package. But this requires a special programmer and an ultra violet light source for erasure (over $125 worth of stuff!!).

But in the DS5000, 2 of the pins can be placed in a special state, and the program downloaded to the chip through the serial port from a PC. There is a special program inside the DS5000 that allows all this to happen, that goes away when these 2 pins are returned to their normal state. This special program can be accessed anytime to change the user program by, in our case, flipping a switch, downloading the program, and then returning the switch to its normal position. Neat, huh? It takes just a few seconds to do this, where it used to take a half hour to go through the erase / program cycle of an EPROM based micro. And no special hardware is needed, other than the serial port.

This speeds up program development and allows a change to be made to the program, downloaded to the micro, and executed, in under a minute. Slick!!! It will still take plenty of time to develope and debug a program, but very little time or effort to get the program into the DS5000, ready to run.

I have also located a free 8051 simulator for your use that will allow you to test small programs out on your PC without downloading them to the DS5000. You can see all the registers change as the program is stepped through each instruction. This greatly speeds up the debugging process, and is an educational tool that shows how each instruction affects the various parts of the DS5000. We will use this in later lessons to illustrate the different instructions and programs that we will write.

There are other features to be covered later, as they come up. In the next lesson we will start looking at assembly language, the method we will use to write a program.

My home page is .

On to lesson 6.