Embedded Systems Notes

Interfacing Seven Segment Display with 8051

  • Segments: Each of the 7 segments labeled from "a" to "g" with an optional decimal point "dp". Illuminating specific segments forms various characters.
  • Types of Displays:
    • Common Anode: All segment anodes connected. Each cathode is controlled separately.
    • Common Cathode: All segment cathodes connected. Each anode is controlled separately.
  • Numerical Representation: Shows numbers 0-9 and some characters ('A', 'b', 'C', 'd', 'E', 'F', etc.) through segment combinations.
  • Applications: Used in digital clocks, microwave ovens, calculators, scoreboards, and meters.

HEX Values for Digits 0-9 on 7-Segment Display

  • 0: 0x3F
  • 1: 0x06
  • 2: 0x5B
  • 3: 0x4F
  • 4: 0x66
  • 5: 0x6D
  • 6: 0x7D
  • 7: 0x07
  • 8: 0x7F
  • 9: 0x6F

LCD Pin Details

  • Pin 1 (VSS): Ground.
  • Pin 2 (VCC): +5V Power supply.
  • Pin 3 (VEE): Control contrast.
  • Pin 4 (Rs): Register select; 0 for command, 1 for data.
  • Pin 5 (R/W): Read/Write; 0 for write, 1 for read.
  • Pin 6 (E): Enable.
  • Pins 7-14 (D0-D7): 8-bit data bus.
  • Pin 15 (LEDA): Anode for backlight LED.
  • Pin 16 (LEDK): Cathode for backlight LED.

LCD Command Details

  • Commands:
    • 00: Clear display.
    • 02: Return home.
    • 04: Decrement cursor.
    • 06: Increment cursor.
    • 05: Shift display right.
    • 07: Shift display left.
    • 08: Display off, cursor off.
    • 0A: Display off, cursor on.
    • 0C: Display on, cursor off.
    • 0E: Display on, cursor blinking.
    • 10 to 1C: Shift cursor/display positions.
    • 80: Force cursor to the beginning of 1st line.
    • C0: Force cursor to beginning of 2nd line.
    • 38: 2 lines and 5x7 matrix.

Stepper Motor Functionality

  • Components: Consists of a stator (four coils) and a rotator (permanent magnet).
  • Operation: Energizing coils creates electromagnetic fields that cause rotation. Rotation depends on energizing sequence.
  • Stepper Details:
    • Each step is 1.8 degrees if the motor completes 360 degrees in 200 steps.
    • Calculated as: extStepangle=360200=1.8extdegreesext{Step angle} = \frac{360}{200} = 1.8 ext{ degrees}.

Modes of Stepper Motor

  1. Wave Drive: One coil energized at a time.
  2. Full Step Drive: Two coils energized simultaneously.
  3. Half Step Drive: Alternates energizing one or two coils.

ADC (0804) Overview

  • Function: Converts analog signals into digital numbers for microcontroller interpretation.
  • Key Pins:
    • Vcc: +5 volts.
    • CLK IN, CLK R: Clocking signals, critical for conversion time (minimum 110 μs).
    • VRef/2: Reference voltage for input range adjustment.
    • CS: Chip select (active low).
    • RD: Read data (active low, outputs the converted data).
    • WR: Starts conversion (active low).
    • INTR: Indicates end of conversion (active low).

DAC (Digital to Analog Converter) Overview

  • Purpose: Converts digital values to analog signals for various physical quantities.
  • Example DAC: 8-bit DAC0808.
  • Formula for Output Voltage: V<em>0=DimesV</em>ref2nV<em>{0} = \frac{D imes V</em>{ref}}{2^n}
    • Where D is the digital input, n is the number of bits.

Calculating Resolution and Accuracy

  • Resolution: Smallest change in output for a change of 1 LSB.
  • Accuracy: Difference between actual output and expected output.
  • Full Scale Output Voltage: Highest output when binary input is at maximum value.

Programs for Waveforms

  • Sine Wave Generation: Create a lookup table containing sine values. Use DAC for output.
  • Example Table for Sine Wave Values:
    • Angles for 0 to 360 degrees mapped to DAC input values.
    • Use calculation of output voltage: Vout=5V+(5Vimesextsin(heta))V_{out} = 5V + (5V imes ext{sin}( heta)) for precise output tuning.