Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
#2845 REPEAT DEC82 ; Decrement DPL MOVX A,@DPTR MOV R3,A MOV R5,#02 LCALL 059E MOV A,20 LCALL 2006 MOVA,82 CJNE A,#42; REPEAT (ED) MOVA,#OD ; OD = ASCII FOR ENTER LCALL 2006 LJMP; AGAIN ( 6003 ) To change the RTC 2844-hrs 2843-minutes 2842-seconds 0 comments Labels: 8086, Assembly Language, c program, real time clock
OCT 21, 2008
Program to interface DAC using 8255 and generate square waveform The following is the assembly language using DAC to interface with 8255 and generate a square wave on CRO. Here in the code, we use two delay elements one for the rising part of the wave and the other delay element to reach zero i.e decrement. Certain value chosen is delayed or sustained for a time period to form the square wave. The two loops used in the program are iterated to repeat cycles of a square wave.
Code: MOV DX,8807 : DX is loaded with control word register address of 8255 MOV AL,80 OUT DX,AL : Contents of AL are transferred to portA of 8255 MOV DX,8801 : DX is loaded with Port A address of 8255 Begin MOV AL,00 OUT DX,AL ; Contents of AL are transferred to portA of 8255 MOV CX,00FF Delay1 Loop Delay1 MOV AL,FF OUT DX,AL : Contents of AL are transferred to portA of 8255 MOV CX,00FF : CX is loaded with 00FFH
Delay2 Loop Delay2 : Repeat until CX=0 JMP Begin ; Repeat the same The expected square wave can be observed as in the figure shown. Thus we programed in assembly language to interface DAC using 8255 to generate a square waveform. Related links Ebooks for micro processors and micro controllers 0 comments Labels: 8086, 8255, Assembly Language, generate square waveform, square wave
Program to interface stepper motor with 8086 and rotate with anti clock wise direction in full stepping
The following program is to interface stepper motor with 8086 and rotate with anti clock wise direction in full stepping. The purpose of this is to observe and control the stepping action of the motor using assembly language code. The code is also practically illustrated with two live demonstrations on how speed of the motor varies if one of the instruction codes is changed to a new value. Code: MOV DX,8807 : Load DX with control word register address of 8255 MOV AL,80 : load control word 80 into AL OUT DX,AL: Contents of AL are loaded into control word register of 8255 MOV DX,8801: Load PortA address of 8255 into DX MOV AL,33: Load value 33 into AL Again OUT DX,AL: Contents of AL are loaded into control word register of 8255 MOV CX,0100: set counter to delay Loop Again ROL AL,1 : Rotate left by 1 JMP Again : Unconditional jump to label again Following is the practical illsutration of the output for the above given code.
The instruction MOV CX,0100 can be changed to a new value in order to vary the speed. So, for instance lets say MOV CX,7000. Following is the video demonstration of how the speed varies if the value is changed in the above instruction
Thus by changing the instruction the speed of the stepper motor can be varied according with interfacing it to an 8086 microprocessor for full stepping
Related posts: Interfacing a stepper motor with an AVR Microprocessor Interfacing a stepper motor with pic micro controller Interfacing a stepper motor to 8086 using 8255 0 comments Labels: 8086, Assembly Language, interface stepper motor
SEP 28, 2008
CLC ; clear carry flag MOV SI , 2000 MOV DI, 2050 MOV CX, 0000 ; Load CX register with the value given by 0000 MOV AX,0000 MOV CL,[SI] MOV DL,CL A1: INC SI ; Increment SI contents ADD AL,[SI] ; ADD AL with the value given by that at SI and store in AL LOOP AI ( 1011) ; Repeat until CX=0 DIV BL; Divide AX With the value given by BL MOV [DI],AX ; Load the value in AX into as location at DI INT A5 ; HALT Thus with the above code the arithmetic mean of n numbers can found accordingly. sample input: 0000:2000 array size 0000:20001 array elements from 2001 location Output 0000:2050 Result You might be also interested in: ::Interfacing pic microcontroller with LCD :: Serial Port interfacing with atmega :: TCP/IP on PIC 18 series 0 comments
mov ax,4000h mov ds,ax mov si,0000h mov al,num1 ;num1 is first no. mov cl,num2 ;num2 is second no. mov ah,00h cmp al,cl ja next xchg al,cl next: mov bl,cl div cl cmp ah,00h je down mov al,cl mov cl,ah mov ah,00h jmp next down mov result,bl ;result is the mem.loc. ;where gcd is to be stored hlt You might be also interested in: :: options available for int 21h instruction
:: Answers of Microprocessor(8085) & Electronics FAQ :: The 8085 Microprocessor Architecture Microprocessors & Interfacing 0 comments Labels: 8086, Assembly Language, Program
JUL 6, 2008
:: 8051 or PIC microcontroller which is better :: Effective addresses :: Floating Point Initializations 0 comments Labels: 8086, Assembly Language, Program
APR 3, 2008
load effective address of operand into specified register LDS load DS register and other specified register from memory LES load ES register and other specified register from memory Flag transfer instructions LAHF load AH with the low byte of flag register SAHF store AH register to low byte of flag register PUSHF copy flag register to top of stack POPF copy word to top of stack to flag register You might be also interested in: :: Assembly Language Programs to compute an expression :: Interfacing Analog-to-Digital converter to 8086 using 8255 :: Interfacing Digital-To-Analog converter to 8086 using 8255 0 comments Labels: 8086, Assembly Language
MAR 29, 2008
sub cl, 32 mov al, 5 imul cl mov cl, 9 idiv cl mov result2, al mov bl, result2 call print ; print bl ; wait for any key press... mov ah, 0 int 16h
; procedure prints the binary value of bl print proc near pusha ; print result in binary: mov cx, 8 p1: mov ah, 2 ; print function. mov dl, '0' test bl, 10000000b ; test first bit. jz zero mov dl, '1' zero: int 21h shl bl, 1 loop p1 ; print binary suffix: mov dl, 'b' int 21h
; print carrige return and new line: mov dl, 0Dh int 21h mov dl, 0Ah int 21h popa ret ; return to the main program. print endp 0 comments Labels: 8086, Assembly Language, celsius, centigrade, fahrenheit, temperature
MAR 26, 2008
Equipment for troubleshooting Microcomputers Logical Analyzers a logical analyzer is very powerfully troubleshooting tool but to use it effectively you need some detailed knowledge ans d program listing for the system that you are trying to troubleshoot. for detailed steps for the trouble shooting you can refer the book microprocessor and interfacing by DOUGLAS V HALL . This post is based on that the steps given in that book You might be also interested in: :: Assembly Language Programs to compute an expression :: Interfacing Analog-to-Digital converter to 8086 using 8255 :: Interfacing Digital-To-Analog converter to 8086 using 8255 1 comments Labels: 8086, Troubleshooting
MAR 15, 2008
i8086emu
this is a free and open source Intel 8086 based microprocessor cross-platform emulator. It has support for dynamically loadable device plugins and some peripherals like a PIT, PIC, 8-segment-displays, buttons and leds. i8086emu comes with an ncurses and an GTK-2 gui here is the screen short of the emulator this can work major operating systems likeAll 32bit MS Windows (95/98/NT/2000/XP), All POSIX (Linux/BSD/UNIX-like OSes) Linux this software is downloaded more than 4500 time from sourceforge.net
dowload it here download microprocessor emulator You might be also interested in: :: Find Square Root of a hexadecimal number in assembly language
:: common intreview questions on 8086 :: Assembly Language Source Codes 1 comments Labels: 8086, emulator, microprocessor, software
MAR 8, 2008
.model small .stack .data .code ; program starting main proc mov dl, 00h lop: mov ah, 02h int 21h inc dl jnz lop mov ax,4c00h int 21h main endp end main ; end of the program You might be also interested in: :: Interfacing Stepper Motor to 8086 using 8255 :: MASM 611 SOFTWARE :: bit reversal and sorting programs 0 comments Labels: 8086, Assembly Language, microprocessor, Program
MAR 2, 2008
second one : several pins of 8086 are multiplexed (means they have different functions in different situations). the functions of those pins are controlled by these ground pins. the two functions of processor is grouped in two groups namely 'min mode operation' and 'max mode operation'. third one : there are two pins to support max mode and min mode.....one of the mode is multiprocessor mode i.e. in ithis mode u can connect two or more multiprocessors to work in cooperation. if both pin r grounded it means single procesor mode.. last one : consider a circuit where ur 8086 has to be activated only when certain condition is met. say the output of a logic circuit is low. the output pin of this device is connected to the gnd pin of 8086. when ever the out put pin is low there is a voltage diff between vcc and gnd pins of 8086 and 8086 is activated. so the logic device output pin acts a current sink. the sinking capacities of normal ttl devices are far less compared to the current sourced by a 8086 up. hence 2 gnd pins to split current from 8086 and ensure the current at gnd pin of 8086 does not exceed the sinking capacities of the peripherals. You might be also interested in: 0 comments Labels: 8086, ground pin
FEB 27, 2008
Input 8 bit binary number and print out its decimal equivalent. This is a very basic example of a tiny OS. Your own Operating System that runs from floppy drive - easy! This example shows how to add huge unpacked BCD numbers Calculate the sum of elements in V1 array, store result in V2. How CMP instruction sets the flags. See how to operate with Octal, Binary and Decimal values. Learn how to set and get file attributes, in other words how to make file Read Only or Hidden. This is an example of AAS instruction, it is used to subtract huge BCD numbers. This sample gets two numbers from the user, calculates the sum of these numbers, and prints it out. This sample shows how to use CMPSW instruction to compare strings. Make your own interrupts - Custom_Interrupt.asm Encryption in Assembly Language This sample gets the number from the user, and calculates factorial for it. Supported input from 0 to 8 inclusive! Call a procedure from another segment or interrupt. This program calculates linear equation: ax + b = 0 The result is printed with floating point. This example prints out The easiest and the fastest way to print "Hello World!" using DOS INT 21h (still works under Windows XP in Dos prompt). This example converts 2 digit Hex value into numeric value and decimal string representation (so that it can be easily printed if required). Keyboard example - keybrd.asm
A very handy code that can be assembled into a very tiny utility to make floppy boot records and tiny operating systems. This sample shows the use of input and output string functions of emu8086.inc This sample shows how to use SCASW instruction to find a WORD (2 bytes).
You might be also interested in: :: Temperature Control system using 8086 :: Traffic light control system using 8086 :: Assembly Language Program to serve NMI 0 comments Labels: 8086, Assembly Language
FEB 19, 2008
0000:4100 MOV AX,0000H 0000:4103 MOV DS,AX 0000:4105 MOV AL,00H 0000:4107 MOV [0008],AL 0000:410A MOV AL,40H 0000:410C MOV [0009],AL 0000:410F MOV AL,00H 0000:4111 MOV [000A],AL 0000:4114 MOV AL,00H 0000:4116 MOV [000B],AL 0000:4119 HLT 0000:411A
NOW PRESS NMI BUTTON ON 8086 MICROPROCESSOR KIT You might be also interested in: :: MASM 611 SOFTWARE :: bit reversal and sorting programs :: Find Square Root of a hexadecimal number in assembly language :: common intreview questions on 8086 1 comments Labels: 8086, 8255, Experiment, microprocessor, NMI, Program
FEB 9, 2008
Halt state. The sequence of traffic followed in the program is given below. a) From road north to East From road east to north From road south to west From road west to south From road west to north b) From road north to East From road south to west From road south to north From road south to east c) From road north to south From road south to north Pedestrian crossing at roads west & east d) From road east to west From road west to east Pedestrian crossing at roads north & south
ASSEMBLY LANGUAGE PROGRAMS:MODEL SMALL .STACK 100 .DATA CWR EQU 0FFC6 H PORTA EQU 0FFC0 H PORTB EQU 0FFC2 H PORTC EQU 0FFC4 H
.CODE START: MOV AX,@DATA MOV DS,AX MOV AL,80H MOV DX,CWR OUT DX,AL MOV AL,F3H MOV DX,PORTC OUT DX,AL MOV AL,FFH MOV DX,PORTA OUT DX,AL MOV AL,FFH MOV DX,PORTB OUT DX,AL MOV CL,03H CALL DELAY TOP: MOV AL,EEH MOV DX,PORTA OUT DX,AL MOV AL,EEH MOV DX,PORTB OUT DX,AL MOV CL,02H CALL DELAY
MOV AL,FCH MOV DX,PORTC OUT DX,AL MOV AL,7DH MOV DX,PORTA OUT DX,AL MOV AL,57H MOV DX,PORTB
MOV AL,E7H MOV DX,PORTB OUT DX,AL MOV AL,FDH MOV DX,PORTA OUT DX,AL MOV AL,EDH MOV DX,PORTA OUT DX,AL MOV CL,02H CALL DELAY
MOV AL,F7H MOV DX,PORTB OUT DX,AL MOV AL,F0H MOV DX,PORTC OUT DX,AL MOV AL,F1H MOV DX,PORTA OUT DX,AL MOV CL,15H CALL DELAY
MOV AL,FBH MOV DX,PORTA OUT DX,AL MOV AL,FBH MOV DX,PORTB OUT DX,AL MOV AL,50H MOV DX,PORTC
MOV AL,FEH MOV DX,PORTA OUT DX,AL MOV AL,FEH MOV DX,PORTB OUT DX,AL MOV CL,03H CALL DELAY
MOV AL,FFH MOV DX,PORTA OUT DX,AL MOV AL,AFH MOV DX,PORTC OUT DX,AL MOV AL,EEH MOV DX,PORTA OUT DX,AL MOV AL,EEH MOV DX,PORTB OUT DX,AL MOV CL,02H CALL DELAY
MOV AL,BFH MOV DX,PORTA OUT DX,AL MOV AL,BFH MOV DX,PORTB OUT DX,AL MOV CL,15H CALL DELAY
JMP TOP
DELAY: MOV BX,10H D1: MOV CX,0FFFFH D2: LOOP D2 DEC BX JNZ D1 INT 03H END START
PROCEDURE:1. Connect power supply 5V & GND to both microprocessor trainer kit & Traffic light controller interfacing kit. 2. Connect data bus between microprocessor trainer kit & Traffic light controller interfacing kit. 3. Enter the program to control Traffic light. 4. Execute the program by typing GO E000:0B80 ENTER. 5. Observe the LEDs on traffic light controller PCB.
10 comments Labels: 8086, Experiment, microprocessor, Program, Traffic light control system
JAN 28, 2008
ADC will give binary equivalent of the I/P voltage. Input will vary from 0 to 5V (0 to 100 degree C) and the ADC O/P varies from 00-FFH. So 5V/100 i.e. 5000mvs/100 gives 50mvs/0C. And the counts for indication of temperature are taken as 2.5 (256/100) per degree C. AC supply to the external heating element is controlled through the onboard Relay, based on the set value. When the temperature of the heating element (which is sensed by AD590, AD590 output is analog which is converted to digital by ADC) is less than the set value (reference value) heating element will be switched ON and when temperature crosses the set temperature AC supply is turned OFF.
MODEL .STACK .DATA START: PORTA PORTB PORTC CTL CTL_BYTE CLEAR_DISPLAY DWAD DBDTA DEC_TEMP SET_TEMP ADC_VAL COUNT PRE_TEMP .CODE ADC EQU EQU DB DB DB DB DB EQU EQU EQU EQU EQU FFC6H 98H FFC0H FFC2H FFC4H ; ; EQU ; ; ; Control 8255 PORTA PORTB PORTC port control
SMALL 100
TABLE:
DB
00H,03H,05H,08H,0aH,0dH,0fH,11H,14H,16H
DB
19H,1cH,1eH,21H,24H,27H,2aH,2cH,2eH,32H
DB
34H,36H,39H,3cH,3fH,42H,45H,48H,4aH,4cH
DB
4eH,50H,52H,54H,56H,58H,5bH,61H,64H,67H
DB
6aH,6dH,70H,72H,74H,77H,7aH,7dH,7fH,82H
DB
a0H,a2H,a5H,a8H,aaH,aDH,afH,b0H,b3H,b6H
DB
b9H,bcH,bfH,c1H,c4H,c6H,c9H,ccH,cfH,d0H
DB
d2H,d5H,d7H,daH,dcH,dfH,e0H,e2H,e5H,e7H
DB
e9H,ebH,eeH,f1H,f4H,f6H,f9H,fcH,ffH
START: MOV MOV OUT MOV CALL MOV MOV MOV MOV CALL MOV MOV OUT MOV OUT MOV L0: FAR DX,CTL DX,AL AL,CTL_BYTE ; ; PORTC ; (lower) PORTA as as 8255 output input AL,DEC_TEMP DEC_HEX SET_TEMP,AL AL,DEC_TEMP AH,00 SI,AX DWAD DX,CTL AL,02 DX,AL AL,00 DX,AL CX,70
LOOP BACK: MOV CALL CALL CALL JMP DISP_TEMP: MOV MOV AGAIN: CMP JC JE INC INC JMP FOUND: MOV CALL MOV MOV CALL RET TEMP_CONTL: MOV CMP JC RELAY_OFF: MOV MOV OUT MOV HERE1: MOV HERE: FAR SI,OFFSET
L0
AL,ADC_VAL ADC_TABLE
CX,FFFFH
LOOP DEC JNZ RET TURN_ON_RELAY: MOV MOV OUT CONTINUE: MOV L22: LOOP RET ADC: MOV MOV OUT MOV L10: LOOP MOV OUT L1: MOV IN AND CMP JNZ MOV IN MOV RET HEX_DEC: MOV MOV DIV
HERE DL HERE1
CX,FFFFH
L22
AH,00H CL,0AH CL
MOV ROL AND OR RET DEC_HEX: MOV AND AND MOV ROR MOV MUL ADD RET END START
PROCEDURE:<!--[if !supportLists]-->1. <!--[endif]-->Connect power supply 5V & GND to both microprocessor trainer kit & temperature controller interfacing kit. <!--[if !supportLists]-->2. <!--[endif]-->Connect data bus between microprocessor trainer kit & temperature controller interfacing kit. <!--[if !supportLists]-->3. <!--[endif]-->Enter the program to read temperature of the water bath from ADC at 0000:4000. <!--[if !supportLists]-->4. <!--[endif]-->Execute the program by typing GO 0000:4000 enter. <!--[if !supportLists]-->5. <!--[endif]-->Enter the reference temperature value, when temperature of water bath exceeds reference value then power supply to water bath is switched OFF.
:: Traffic light control system using 8086 :: Assembly Language Program to serve NMI :: Interfacing Stepper Motor to 8086 using 8255