Microprocessor and microcontroller: Aseembly language programs.

Interfacing microprocessors, 8086, MASM 6.11, microcontroller 8085 and assembly language programming, projects, ebooks and tutorials on microprocessors and microcontrollers.

Assembly Language Program to generate Square WaveAssembly Language Program to generate Ramp WaveAssembly Language Program to generate Triangular WaveAssembly Language Program to generate Staircase WaveAIM:-To Interface Digital -to-Analog converter to 8086 using 8255 and write Assembly Language Program to generate Square Wave, Ramp Wave, Triangular Wave & Staircase Wave form.APPARATUS:-Microprocessor trainer kit, ADC kit, power supply, data cable, CRO etcTHEORY:-The DAC 0800 is a monolithic 8 bit high speed current output digital to analog converters featuring setting time of 100nSEC. It also features high compliance complementary current outputs to allow differential output voltage of 20 Vp-p with simple resistor load and it can be operated both in unipolar and bipolar mode.FEATURES:-Fast setting output current 100nSFull scale error +/- 1 LSBComplementary current outputseasy interface to all microprocessorWide power supply range +/- 4.5 to +/- 18Vlow power consumptionWORKING:-When chip select of DAC is enabled then DAC will convert digital input value given through portliness PB0-PB7 to analog value. The analog output from DAC is a current quantity. This current is converted to voltage using OPAMP based current-to-voltage converter. The voltage outputs (+/- 5V for bipolar 0 to 5V for unipolar mode) of OPAMP are connected to CRO to see the wave form.; RAMP WAVE GENERATOR with 8086 using 8255MODEL SMALL.STACK 100.DATACONTROL EQU 0FFC6H ; Control port address for 8255PORTA EQU 0FFC0H ; Port A address for 8255PORTB EQU 0FFC2H ; Port B address for 8255PORTC EQU 0FFC4H ; Port C address for 8255.CODESTART:MOV AX,@DATA ;Initialize Data segmentMOV DS,AXMOV DX,CONTROLMOV AL,80H ;Initialize all ports as outputOUT DX,AL ;PortsMOV BL,FFH ;Take FFH in BL analog equivalent to 5VRAMP : MOV DX,PORTBMOV AL,BL ;Copy to ALOUT DX,AL ;And output it on the portDEC BL ; To generate ramp wave this 5V is continuously decreased till 0VJNZ RAMP ; Jump to RAMP if not 0MOV BL,FFH ; To generate same wave this procedure is repeatedJMP RAMPINT 03HEND START;SQUARE WAVE GENERATOR with 8086 using 8255MODEL SMALL.STACK 100.DATACONTROL EQU 0FFC6H ; Control port address for 8255PORTA EQU 0FFC0H ; Port A address for 8255PORTB EQU 0FFC2H ; Port B address for 8255PORTC EQU 0FFC4H ; Port C address for 8255.CODESTART:MOV DX,CONTROLMOV AL,80H ; Initialize all ports as outputOUT DX,AL ; PortsUP: MOV DX,PORTBMOV AL,00H ;Output 00 for 0V levelCALL OUTPUTMOV AL,0FFH ;Output FF for 5V levelCALL OUTPUTJMP UPOUTPUT:OUT DX,ALCALL DELAYINT 21HDELAY:MOV CX,0FFH ; To vary through frequency alter the delay countLUP1 LOOP LUP1INT 21HEND START;TRIANGULAR WAVE GENERATOR with 8086 using 8255MODEL SMALL.STACK 100.DATACONTROL EQU 0FFC6H ; Control port address for 8255PORTA EQU 0FFC0H ; Port A address for 8255PORTB EQU 0FFC2H ; Port B address for 8255PORTC EQU 0FFC4H ; Port C address for 8255.CODESTART:MOV DX,CONTROLMOV AL,80H ; Initialize all ports as outputOUT DX,AL ; PortsBEGIN:MOV DX,PORTBMOV AL,00H ; Output 00 for 0V levelUP: CALL OUTPUTINC AL ; To raise wave from 0V to 5V increment ALCMP AL,00HJNZ UP ; Jump UP till rising edge is reached i.e. 5VMOV AL,0FFHUP1: CALL OUTPUTDEC AL ; To fall wave from 5V to 0V decrement ALCMP AL,0FFHJNZ UP1 ; Jump UP till falling edge is reached i.e. 0VJMP BEGINOUTPUT:OUT DX,ALCALL DELAYINT 21HDELAY:MOV CX,07H ;To vary the frequency alter the delay countLUP1:LOOP LUP1INT 21HEND START;STAIRCASE WAVEFORM GENERATOR with 8086 using 8255MODEL SMALL.STACK 100.DATACONTROL EQU 0FFC6H ; Control port address for 8255PORTA EQU 0FFC0H ; Port A address for 8255PORTB EQU 0FFC2H ; Port B address for 8255PORTC EQU 0FFC4H ; Port C address for 8255.CODESTART:MOV DX,CONTROLMOV AL,80H ;Initialize all ports as outputOUT DX,AL ;PortsUP: MOV DX,PORTBMOV AL,00H ;Output 00 for 0V levelCALL OUTPUT ; And wait for some timeMOV AL,0FFH ;Output FF for 5V levelCALL OUTPUT ; And wait for some timeMOV AL,07FH ;Output 7F for 2.5V levelCALL OUTPUT ; And wait for some timeJMP UPOUTPUT: OUT DX,ALMOV CX,FFHDELAY: LOOP DELAY ; To add DELAYINT 03HEND STARTPROCEDURE:-Connect power supply 5V & GND to both microprocessor trainer kit & DAC interfacing kit.Connect data bus between microprocessor trainer kit & DAC interfacing kit.Enter the program to generate Ramp, Square, Triangular & Staircase Wave.Execute the program by typing GO E000:4770 ENTER for Ramp, GO E000:03A0 ENTER for Square, GO E000:0

410 ENTER for Triangular, GO E000:4890 ENTER for Staircase.Observe the wave forms on CRO.

LEAVE A REPLY

Please enter your comment!
Please enter your name here