Saturday 16 August 2014

8051 INTERFACING WITH LED, SWITCH, SSD AND KEYPAD

This is a wrap-up article for interfacing hardware with 8051 microcontroller. It's a combo deal for starters because this time, I have interfaced switches, LEDs, seven-segment-display and keypad all at the same time. I have already talked about them, individually, in my previous articles but for better understanding I think it's important to know how they work together. It will also give you some idea about dividing your code into segments and pieces which ultimately polishes your code writing skills.

If you came here the first time and you don't have any clear idea of how the above mentioned hardware actually work, I suggest you read these posts for details and understanding. 

LED Interfacing
Switch Interfacing
Seven Segment Display Interfacing
Keypad Interfacing

For the rest of the audience, I won't go into details to avoid repetition and jump straight to business. Here is the interfacing diagram.

Interfacing multiple hardware to 8051 microcontroller

And before you get confused, let me take just one more minute of your precious time to explain how it works.

The flow of program code is controlled by the switches (left side). I have connected four switches and when you TURN-ON a certain switch, it activates a CERTAIN part of the code. For example if you turn-on third switch from the right, it will activate a 0-15 counter on the seven-segment-display. I think you will better understand when you go through the code as I have properly commented it so need to panic there. Even if you do come across a problem, please have a look at my previous posts for your corresponding answers because this code is just a combination of what I did previously.

I have written the code in Assembly Language just for fun. If you have trouble understanding, you can compile your own C code by getting help from my previous posts. I guess I'm talking too much about the previous stuff.

All things aside, here is your package.


This ZIP package contains the following files
  • Assembly Language Code
  • Compiled HEX file
  • Proteus Design File
You can use all these files at your will but remember that they are for the sake of understanding the concept. You have to know what's going on and then it won't hurt if you just copy/paste but if you do it without caring about understanding, well all I can say is that it's not good for development. 

4 comments:

  1. where is the assembly code

    ReplyDelete
    Replies
    1. You can click "DOWNLOAD ZIP" above.

      Or go here

      Delete
  2. plz write the same code in c

    ReplyDelete
    Replies
    1. You can get individual C codes from my previous posts.

      Delete