Posts

Interfacing a DAC

Image
Interface a DAC and generate Triangular and Square waveforms   Interfacing diagram: P0.4 to P0.11 are used to get the Digital values. 1. Program to generate square wave with DAC interface           0xff   ________              |                       |                   |              |                       |                   |              |                      |                   |              |                       |                   |     0x00 |                       |_________| Program: #include <LPC17xx.H> void delay(void); int main () { LPC_PINCON->PINSEL0 = 0x0 ;// Configure P0.4 to P0.11 as GPIO LPC_GPIO0->FIODIR   = 0x00000FF0 ;   while(1)     {          LPC_GPIO0->FIOPIN   = 0x00000FF0 ;         delay();         LPC_GPIO0->FIOCLR   = 0x00000FF0 ;         delay();     } }    void delay(void) {           unsigned int i=0;           for(i=0;i<=9500;i++); } -------------------

7-segment LED interface

Image
Display the Hex digits 0 to F on a 7-segment LED interface Theory: DISPLAY ARE CONNECTED IN COMMON CATHODE MODE Port0 Connected to data lines of all 7 segement displays               a             ----           f|  g |b            |----|           e|    |c             ----  . dot               d             a = P0.04                                                    b = P0.05           c = P0.06           d = P0.07           e = P0.08           f = P0.09           g = P0.10           dot = P0.11                              Select lines for two 7 Segments           DIS1 P0.19           DIS2 P0.20 Program: #include <LPC17xx.h> unsigned int delay, count=0, Switchcount=0,j; unsigned int Disp[16]={0x000003f0, 0x00000060, 0x000005b0, 0x000004f0, 0x00000660,0x000006d0, 0x000007d0, 0x00000070, 0x000007f0, 0x000006f0, 0x00000770,0x000007c0,0x00000390, 0x000005e0, 0x00000790, 0x00000710 }; #define ALLDISP 

Interface a Stepper motor

Image
Interface a Stepper motor and rotate it in clockwise and anti- clockwise direction: THEORY: A stepper motor (also referred to as step or stepping motor) is an electromechanical device achieving mechanical movements through conversion of electrical pulses. Stepping motors can be viewed as electric motors without commutators. Typically, all winding in the motor are part of the stator, and the rotor is either a permanent magnet or, in the case of variable reluctance motors, a toothed block of some magnetically soft material. All of the commutation must be handled externally by the motor controller, and typically, the motors and controllers are designed so that the motor may be held in any fixed position as well as being rotated one way or the other.  Stepper motors are driven by digital pulses rather than by a continuous applied voltage. Unlike conventional electric motors which rotate continuously, stepper motors rotate or step in fixed angular increments. A stepper motor i