MicroController Pros Home Page
My Account  Cart Contents  Checkout  
  Store » PCAM+ 8051 Tutorial 1 My Account  |  Cart Contents  |  Checkout   
Quick Find
 
Enter keywords to find the product you are looking for in the Quick Find field above

or use
Advanced Search
Categories
Accessory Boards->
8051->
ADI Blackfin
Arduino->
ARM->
Atmel AVR->
Cypress PSoC
Freescale->
FTDI->
Locktronics
Microchip PIC->
MIPS
Parallax->
Renesas
Silicon Labs
ST Microelectronics->
Texas Instruments->
Tibbo->
Books->
Displays->
E-Blocks->
EEPROM/EPROM/FLASH
Embedded Ethernet->
Embedded Software->
I/O Modules->
Parts & Components->
Pick & Place Tools
Programmable Logic (PLD)
Prototype PCBs->
Robotics
ROM/Flash Emulators
Test & Measurement->
Tutorial CD-ROMs
Universal Programmers->
Wireless->
Information
Intro to Embedded Tools
Embedded News Digest
Useful Resources
Shipping & Returns
Warranty & Liability
Privacy Notice
Conditions of Use
Contact Us
PCAM+ 8051 Tutorial 1: LED Interface

Back to PCAM+ page.


LED Interface with 89S52

Beginning of Learning Embedded Systems

To use this tutorial, you will need the PCAM+ hardware kit.

Let's get started!

On the PCAM+ hardware board, locate the row of LEDs.

Locate the 89S52 on the PCAM+ board. This is a microcontroller of the 8051 family into which your application will be programmed.

Use the included prototyping wires to connect the 8 pins between Port1 and the LEDs. Notice the male pins near the LEDs and near the 89S52.

Our first application will switch ON every other LED and keep the other four LEDs in OFF condition. At this time, we won't use any blinking effect.

To type the code, use the 8051IDE software. The 8051IDE is assembler software which will allow you to write assembly language instructions and will create the HEX file via the Assemble command menu. If you have not yet installed the 8051IDE software, do so now.

Once installed, start 8051IDE and write the following source code:

MOV P1,#55H
LOOP:
SJMP LOOP

When you have finished writing, save the assembly file in a suitable folder.

The MOV P1,#55H code will copy (or move) hex value 55 to PORT1. The # sign indicates that 55 is a value; the H at the end indicates it is hexadecimal. The LOOP: section creates a never-ending loop as the program will jump to LOOP again and again using SJMP LOOP statement. Thus the program will never end, keeping the LEDs (which we connected to PORT1) lighted in a 10101010 pattern. Why 10101010? Because hexidecimal 55 equals 10101010 in binary.

Now it's time to "Assemble" the file. To do this, use the Assemble menu in the 8051IDE software.

This action will create a HEX file in the same folder where you saved your assembly file earlier.

Next, download the HEX file to the microcontroller using the HandyProg-USB Programmer. If you don't know how, go ahead and read the next chapter. It will explain how to use the HandyProg and its software.

When you've completed the download, you should see every other LED turn on, provided you have powered the kit.

Congratulations! You have written your first microcontroller program! Try changing the value of 55H to 33H, save the file, assemble, program, and note the difference in the LED pattern. You can set up any pattern of on/off by changing that hex value. Each digit of the hex value represents four binary numbers, i.e. four LEDs. See the following table:

Hex0123456789ABCDEF
Binary0000000100100011010001010110011110001001101010111100110111101111

Thus entering #8DH instead of #55H would make the LEDs appear like 10001101.

Proceed to Chapter 2


Back to PCAM+ page.

Shopping Cart more
0 items
What's New? more
ESP8266 WiFi Module Breakout Board, Through-Hole and Stamp-Hole
ESP8266 WiFi Module Breakout Board, Through-Hole and Stamp-Hole
US$6.95
Specials more
Arduino Duemilanove Compatible ATmega328P Board, 3.3V/5V
Arduino Duemilanove Compatible ATmega328P Board, 3.3V/5V
US$22.50
US$19.00
Bestsellers
01. PIC16F877A-I/P Microcontroller, 40 DIP, 20 MHz
02. 2x10 Pin male header, 2.54mm, 7.5mm plastic spacer
03. LCD 4-mux, 7 digits x 14 segments, progress bar, arrows
04. PIC16F628A-I/P Microcontroller, 18 DIP, 20 MHz
05. Atmel ATtiny2313-20PU AVR Microcontroller, 20 DIP, 20 MHz
06. LCD 4-mux, 7.1 digits x 7 segments, progress bar, arrows
07. USB Universal In-Circuit Programmer PIC AVR ARM MSP 8051 EEPROM
08. ARM JTAG Debugger & Programmer, parallel port
09. Power Supply 3-12V DC, US/UK/Euro/AU Plugs, 100-240VAC
10. Power Supply 3-12V DC, U.S. plug, 6 connection tips
Reviews more
Universal Development Board 8051/ARM/AVR/PIC/dsPIC/PSoC: UNI-DS6
I just got the development board and have tried examples on ..
5 of 5 Stars!
  Sunday 21 December, 2014   List of all our Products

Copyright © 2003-2014 MicroController Pros LLC
Powered by osCommerce