In This post you can easy Download some important books
Electronics Lab Created By Muhammad Irfan
Electronics Lab Created By Muhammad Irfan
Please if u like this then share to urs friends
Learn And Share this is free for all
Arduino Tre | Raspberry Pi Model B | |
Processor | 1 GHz – Texas Instrument Sitara AM3359AZCZ100 (ARM Cortex-A8) | 700 MHz – ARM1176JZ-F Applications Processor |
Microcontroller | 3x PRU 32-bit microcontrollers | – |
Memory | 512MB DDR3L | 512MB SDRAM |
Digital I/O Pins | 14(5V logic) + 12 (3.3V logic) | 26-pin from which 8 GPIO (3.3V logic) |
Networking | Ethernet 10/100 | Ethernet 10/100 |
USB ports | 1 USB 2.0 device port, 4 USB 2.0 host ports | 2 USB 2.0 host ports |
Video Output | HDMI (1920×1080) | HDMI (1920×1200) |
Audio Output | HDMI | HDMI |
MicroSD card | Yes | Yes |
Software | Linux | Linux |
Programming languages | C, C++ | Python, Java |
Android support | ? | Yes |
Power | 5V | 5V |
Dimensions | ? | 85.60mm x 56mm x 21mm |
ORG 00H // origin MOV DPTR,#LUT // moves the address of LUT to DPTR MOV P1,#00000000B // sets P1 as output port MOV P0,#00000000B // sets P0 as output port CLR P3.0 // sets P3.0 as output for sending trigger SETB P3.1 // sets P3.1 as input for receiving echo MOV TMOD,#00100000B // sets timer1 as mode 2 auto reload timer MAIN: MOV TL1,#207D // loads the initial value to start counting from MOV TH1,#207D // loads the reload value MOV A,#00000000B // clears accumulator SETB P3.0 // starts the trigger pulse ACALL DELAY1 // gives 10uS width for the trigger pulse CLR P3.0 // ends the trigger pulse HERE: JNB P3.1,HERE // loops here until echo is received BACK: SETB TR1 // starts the timer1 HERE1: JNB TF1,HERE1 // loops here until timer overflows (ie;48 count) CLR TR1 // stops the timer CLR TF1 // clears timer flag 1 INC A // increments A for every timer1 overflow JB P3.1,BACK // jumps to BACK if echo is still available MOV R4,A // saves the value of A to R4 ACALL DLOOP // calls the display loop SJMP MAIN // jumps to MAIN loop DELAY1: MOV R6,#2D // 10uS delay LABEL1: DJNZ R6,LABEL1 RET DLOOP: MOV R5,#100D // loads R5 with 100D BACK1: MOV A,R4 // loads the value in R4 to A MOV B,#100D // loads B with 100D DIV AB // isolates the first digit SETB P1.0 // activates LED display unit D1 ACALL DISPLAY // calls DISPLAY subroutine MOV P0,A // moves digit drive pattern for 1st digit to P0 ACALL DELAY // 1mS delay ACALL DELAY MOV A,B // moves the remainder of 1st division to A MOV B,#10D // loads B with 10D DIV AB // isolates the second digit CLR P1.0 // deactivates LED display unit D1 SETB P1.1 // activates LED display unit D2 ACALL DISPLAY MOV P0,A // moves digit drive pattern for 2nd digit to P0 ACALL DELAY ACALL DELAY MOV A,B // moves the remainder of 2nd division to A CLR P1.1 // deactivates LED display unit D2 SETB P1.2 // activates LED display unit D3 ACALL DISPLAY MOV P0,A // moves the digit drive pattern for 3rd digit to P0 ACALL DELAY ACALL DELAY CLR P1.2 // deactivates LED display unit D3 DJNZ R5,BACK1 // repeats the display loop 100 times RET DELAY: MOV R7,#250D // 1mS delay LABEL2: DJNZ R7,LABEL2 RET DISPLAY: MOVC A,@A+DPTR // gets the digit drive pattern for the content in A CPL A // complements the digit drive pattern (see Note 1) RET LUT: DB 3FH // look up table (LUT) starts here DB 06H DB 5BH DB 4FH DB 66H DB 6DH DB 7DH DB 07H DB 7FH DB 6FH END
MOV PSW, #00H // Register bank '0' is selected by executing this instruction.
MOV R0, 35H // The value of 'N' stored in location 35H is transfered to R0.
MOV R5, #55H// The starting location for storing natural numbers '#55H' is transfered to R5
MOV A, #00H// Accumulator is initiated with value 0 for adding natural numbers cumulatively.
MOV R7, #00H// R7 is initialized to '0' to generate natural numbers. Note: '0' is not a natural number.
LOOP: INC R7// R7 is incremented by 1 to generate next natural number.
MOV @R5, 07H// This is indirect addressing mode used here.It
is not possible to transfer data from one register to another register
directly. So an instruction like MOV R5, R7 is invalid.Instead we use
the direct address (07) of register R7 of register bank #00 to transfer
the generated natural number to it's storage location in register
R5.Indirect addressing is used as we need to save the generated natural
number directly to memory address. R5 holds the starting location
address (of the storage area) as its value i.e #55H.By indirectly addressing, we can save what ever value in R7 directly to location #55H.
INC R5// The storage location is incremented by 1 from #55H to #56H to store the next generated natural number
ADD A, R7// The generated natural number is added to contents in accumulator.
DJNZ R0, LOOP// The value of register Ro (value of 'N') is
decremented by 1. It is checked against stopping condition zero. If its
R0 is not equal to zero, the program control will move to label LOOP
again and the steps from INC R7 will be executed again until R0 is equal
to zero. When R0 is equal to zero, program control will exit the loop
and move to next instruction given below.
MOV 36H,A// The sum of natural numbers in accumulator is moved to storage location 36H.
STOP: SJMP STOP// An infinite loop written at
the end of the program. When this instruction is reached program
control will get stuck at this instruction as it's an infinite loop.To
get out of this infinite loop system reset must be applied.
MOV R0,#30H // Address of the starting location of source data is moved to R0.
MOV R1,#50H // Address of the starting location of destination is moved to R1
MOV R3,#OAH// Set the counter R3 with 10. You can also use decimal number as MOV R3,#10d.
LOOP: MOV A, @R0// Indirect addressing mode is used. Contents at the location of Ro (30H) is copied to accumulator.
MOV @R1, A// Contents in accumulator is copied to location pointed by Ra (that is 50H).
INC R0 // Ro is incremented by 1 to point to next location.
INC R1// R1 is incremented by 1 to point to next location.
DJNZ R3, LOOP // Counter register R3 is decremented by 1 and
checked against zero. See the explanation DJNZ in the first program "sum
of natural numbers"
STOP: SJMP STOP // Infinite loop to terminate programh
BEGIN: MOV R1,30H // Getting the value of "N"
MOV R7,#40H // The first number '0' of series is stored here.
MOV @R7,#00H // Loading value 'o' to address 40H using indirect addressing
INC R7 // Incrementing value of R7 from 40H to 41H to store next number '1'
MOV @R7, #01H // Storing value '1' to location 41H. Note that
'o' and '1' are seed values of a fibonacci series and has to be
generated manually.
MOV R5,#42H // New register R5 is loaded with location address
42H to store next values of series, generated by adding the 2 previously
generated numbers.
DEC R1
DEC R1 // The count value "N" is decremented by 2, as we have already generated and stored 1st two numbers.
DEC R7 // R7 is now reduced from 41H to 40H. We need to add
contents of 40H and 41 H to get the number that is to be stored in 42H.
LOOP: MOV A, @R7 // Contents in R7 is moved to accumulator.
INC R7 // R7 is incremented to get the next value.
ADD A,@R7 // The two values are added and stored in Acc.
MOV @R5,A // The newly generated value of the series is stored in the address held by R5.
INC R5 // R5 is incremented to store next value.
DJNZ R1,LOOP // The count "N" is checked to zero (to know if all the numbers upto N are generated).
STOP: SJMP STOP // Run infinitely here or end of program execution.