Search This Blog

Saturday, August 13, 2011

Write a program to bring in a byte of data serially one bit at a time via pin P2.7 and save it in register R2. The byte comes in with the LSB first.

; INITIALIZE A COUNTER REGISTER
MOV R0,#08h       ;
LOOP: MOV C,P2.7  ; BRING IN BIT
RRC A             ;
DJNZ R0,LOOP      ; LOOP TILL ALL 8 BITS ARE IN
END 
; END OF PROGRAM

Electric Field Intensity

Consider a fixed charge Q1. Let us move a second charge say test charge Qt around the Q1. We observe that the test charge Qt experiences force everywhere around Q1. It is experiencing a force field. Force on it will be given by coulombs law as:

But still question arises what is Electric Field?? Before defining electric field let us modify above equation a bit.
Let us write the above equation as force/charge equation:

This quantity that is force/charge describes a vector quantity. This vector quantity is called Electric Field Intensity.So Electric field intesity is defined as the vector force on an unit positive test charge by a fixed charge Q1. Or it can also be defined as force per unit charge.
So to sum it up we can Electric field intensity as:

So it becomes.

Expressing Electric field in cartesian Coordinate:

Expressing Electric Field in Spderical Co-ordinates:
First for considering spherical co ordinate we must see that fixed charge has spherical symmetry at its location like at origin(0,0,0) for that we can either use spherical co-ordinate directly in equation as:

Where Er and r spherical co-ordinates values or we can convert them in cartesian coordinate which will give us the equation as below:
We will have r = R = xi + yj +zk ar = aR = (xi + yj + zk)/√(x^2+y^2+z^2 )

If more charges are added in the surrounding of Q1 then electric field will be sum of individual acting alone. As shown in equation given below:



Before ending the topic let us do a small quick example.
Example: See the figure below. We need to find out Electric field at P(1,1,1) caused by 4 identical 3nC charges located at P1(1,1,0), P2(-1,1,0), P3(-1,-1,0) and P4(1,-1,0).


Electric Field Example
Example of Electric field
[caption id="" align="alignnone" width="615" caption="Example of Electric Field"][/caption]


Answer: As r = i + j + k and r1 = i+j therefore r – r1 = k. Therefore |r – r1| = 1.
Similaraly r – r2 = 2i + k. therefore |r – r2| = √5
Similaraly r – r3 = 2i + 2j + k. therefore |r – r3| = 3
Similaraly r – r4 = 2j + k. therefore |r – r4| = √5
And as




Therefore simplifying we get E =
E = 6.82i + 6.83j + 32.8k V/m ans.

The Coulombs Law

Columbs law state that the force between two small objects seperated in a vaccum by distance much greater that the size of each object is proportional to the product of charges on them and inversely proportional to square of distance between them.

where Q1 and Q2 are positive or negative charge quantity measured in columbs and R is the distance between them measured in meters. Here k is proportionality constant given as:

Again another constant € is called permittivity of free space. Measured in Farad per meter(F/m).

The above quantity is not dimensionless. For coulombs law dimensions are C2/N.m2 . This means Farad has units C2/N.m .This makes are coulombs law as:



VECTOR FORM OF COULOMBS LAW:


[caption id="" align="alignnone" width="349" caption="Vector form of Coulombs law"]Vector form of Coulombs law[/caption]


Let us say charges Q1 and Q2 are like charges distance of each from origin be r1 and r2 respectively. As F2 is in direction of R12. The vector R12 is cleary
R12 = r2 – r1.
Therefore the vector form of coulombs law is:

Where a12 is a unit vector in direction of R12 or we can say:



Let us finish this topic with an example.
Example: let umm. There be 2 charges say Q1 = 3 x 10^(-4) C located at say M(1,2,3) and Q2 = 10^(-4) C located at say L(2,0,5). We require to find force exerted by Q2 on Q1.
Answer: Let F2 = force exerted by Q2 on Q1.
Vector R12 = r2 – r1 = (2 - 1)i + (0 – 2)j + (5 – 3)k = i – 2j + 2k
This gives us |R12| = 3
Which again gives as unit vector

Therefore our F2



F2 = 10i – 20j + 20k N ans.
Therefore we found out F2 that is force of Q2 on Q1. Similary we can find F1 that is force of Q1 on Q2. Interestingly as both charges are like charges. We will find out that



Coulombs law is linear. We can see that multiplying Q1 by some factor n. We find that the force between the 2 charges also get multiplied by factor n.
Another thing is that the force on the charge in presence of the other charges is sum of forces on that charge due to each of the other charges acting alone.

Monday, August 8, 2011

Assembly language program for sum of data in Array

; ADDING DATA IN ARRAY
; IN SIMPLE TERMS SUM OF ARRAY
; STORING ARRAY IN ROM
ORG 300H        ;
DB 1,4,5,6,7    ;
; ARRAY OF 5
ORG 0000H       ;
; INITIALIZE DATA POINTER
MOV DPTR, #0300H;
; FIRST COUNTER
MOV R7, #05H    ;
; RESETING A
MOV A, #00H     ;
; COUNTER REGISTER FOR ROM ACCESS
MOV R0, #00H    ;
; SUM VARIABLE
MOV R6,#00H     ; 
LOOP:
MOV A, R0       ;
MOVC A,@A+DPTR  ;
ADD A, R6       ;
MOV R6,A        ;
INC R0          ;
DJNZ R7, LOOP   ;
END

Assembly program for Simple 2 16bit number addition using registers

; 16 BIT ADDITION
ORG 0000H      ;
; SAY R7 HAS LOWER BYTE 34
; R6 HAS HIGHER BYTE 24
; MAKING NUMBER 2434
MOV R7, #34H   ;
MOV R6, #24H   ;
; ANOTHER NUMBER SAY 3345
; WITH R5 LOWER BYTE 45
; R4 HIGHER BYTE 33
MOV R5,#45H    ;
MOV R4, #33H   ;
; NOW ADDING
MOV A, R5      ;
; ADDING LOWER BYTE
ADD A , R7     ;
MOV R3, A      ;
; R3 BEING LOWER BYTE OF ANSWER
MOV A, R6      ;
; NOW ADD WITH CARRY
ADDC A, R4     ;
MOV R2,A       ;
END

Moving block of data from ROM to RAM

; MOVING BLOCK OF DATA
ORG 0000H       ;
; NEED TO TAKE DATA FROM ROM TO RAM
; FROM 300 TO 302 TO 30 TO 32
; DEFINING DATA POINTER
MOV DPTR, #0300H;
; RESETING A
MOV R2, #00H    ; COUNTER REGISTER
MOV R0, #30H    ;
MOV A, #00H     ;
; AS 3 DATAS SO LOOP OF 3
MOV R7, #03H    ;
LOOP:
MOV A, R2       ;
MOVC A, @A+DPTR ;
MOV @R1,A       ;
MOV R1,A        ;
INC R2          ;
INC R1          ;
DJNZ R7, LOOP   ;
; STORING DATA AT ROM
; SAY FROM 300 TO 302
ORG 300H        ;
DB 'ABC'        ;
END

Friday, August 5, 2011

8085 Interrupts Summary Tables


Interrupt Name
Maskable
Masking Method
Vectored
Memory
Triggering Method
INTR
Yes
DI / EI
No
No
Level Sensitive
RST 5.5 / RST 6.5
Yes
DI / EI
SIM
Yes
No
Level Sensitive
RST 7.5
Yes
DI / EI
SIM
Yes
Yes
Edge Sensitive
TRAP
No
None
Yes
No
Level & Edge Sensitive

Direct Memory Access or DMA (image 8257)


Direct Memory Acsess


8085 SAMPLE DECODING(image)

8085 Sample Decoding

In a semester student has to take 4 courses. The marks of student out off say 30 are stored in RAM location 30h. Find average marks and output it in port1.




MOV R1, #04 ; R1 NUMBER OF COURSES FOR COUNTING
MOV B, #O4 ; B AGAIN NUMBER OF COURSES FOR DIVISION
MOV R0, #30H ; RAM STARTING ADDRESS
MOV A, #0 ;
LOOP: ADD A, @R0 ; WHERE @R0 REFERS TO DATA AT LOCATION 30H
INC R0 ;
DJNZ R1, LOOP ; REPEAT ADDITION UNTIL R1 = 0
DIV AB ; CAUSE ONLY DIVISION OPERATION AVAILABLE
MOV P1, A ; IGNORE REMAINDER AND OUTPUT PORT 1 THE AVERAGE

END ; END OF PROGRAM