Showing posts with label #8051microcontroller. Show all posts
Showing posts with label #8051microcontroller. Show all posts

Saturday, 13 June 2020

8051 MICRO-CONTROLLER PIN CONFIGURATION

✏️8051 MICROCONTROLLER PIN CONFIGURATION



👉40 pin chips available in different packages.
👉It has four eight bit I/O ports.
👉Each port except P1 can be used for two different function.
👉All functions may not be used together.
👉To access the pin either we have to give the instruction or physically connect it.
👉It has effectively 66 pins (40 normal pins +24 alternate function of the port + 2 for programing).


✏️Vcc POWER SUPPLY INPUT PIN

👉The 8051 operates at DC power supply of +5V with respect to ground.
👉The +5V is to be connected to pin 40 (Vcc).
👉Variation of 10% to 20%  in Vcc value is allowed depending on 8051 variant.

GND:GROUND

👉Pin 20 is ground.
👉The supply is connected with respect to the ground.

XTAL1 and XTAL2: Oscillator pins
👉The 8051 has an internal oscillator circuit.
👉It generates the clock pulse which synchronizes all internal operations.
👉To make complete oscillator external resonant circuit is connected.
👉Normally quartz and capacitors are connected.
👉Microcontroller works at crystal frequency.
👉The maximum speed refers to maximum crystal frequency that can be connected to XTAL.
👉The minimum speed indicates that the minimum speed required in the operation otherwise data will be lost.
👉We can use external oscillator  for this signal is connected to XTAL1 and XTAL2 left free. 

Friday, 12 June 2020

Program development process &tools in 8051 micro-controller

✏️Program development process &tools in 8051 micro-controller

📌PROGRAMMING LAUNGUAGE 
👉Programming means developing a sequence of commands(or instructions) that can be used by computer system to perform a predefined task.
👉It also involves trouble shooting or debugging of instruction sequence to ensure that the desired operation is performed.
👉There three types of programming languages:
💡Machine Language
💡Assembly Language 
💡High Level Language


✏️ASSEMBLY LANGUAGE STRUCTURES

👉An assembly language program statement consists of three fields: Labels, instructions and comments.
👉[LABEL:]          INSTRUCTION      [//COMMENTS]
👉Brackets show that the field is optional and may not be present in all statements.


✏️LABEL

👉The label assigns a name to a memory location or a program statement.
👉It must be followed by the colon symbol ”:”.
👉While using label as a part of an instruction the colon symbol should not be used.
👉The name of any register or an instruction of a microcontroller cannot be used as a label.
👉For example: DPTR, DPL, MOV Etc.


✏️INSTRUCTIONS

👉Each Instruction has two parts:
👉One is operation to be performed called as operation code( OP-CODE)(Mnemonic)
For Example: ADD,MOV, INC etc

👉The second part is data on which operation is to be performed called as operands.

👉There two types of operands:
➡️Source operand
➡️Destination Operand
👉The operands can be specified in many ways: It may be 8 bit data, 16bit data, an internal register, a memory location or 8bit(or 16 bit) ADDRESS.


✏️INSTRUCTION SIZE

👉The number of bytes required to represent an instruction in a machine language is called instruction size.
👉There are one two or three bytes instructions in 8051.

Thursday, 11 June 2020

Memory Architecture of 8051 microcontroller

✏️Memory  Architecture of 8051 microcontroller

📌Von  Neumann  Architecture 
📌Harvard  Architecture 

📌This classification organization of a is mainly program based on memory(ROM) data memory(RAM). 

✏️Von  Neumann  Architecture 
👉 It  is also referred  as Princeton  Architecture.

 👉It has a single memory storage tohold both program  Instructions and data instructions .... For example :common program and storage space. 

👉Instructions and data are accessed during same bus system. 

 ✏️Advantage : 
👉Simple design of microcontroller chip. 
👉Reduces  required hardware . 

✏️Disadvantage : 
👉Slower excution  of a program. 


✏️Harvard  Architecture


👉It has physically separate memory storage to hold program Instructions and data i.e separate program and data space.

👉Since it has separate buses to access program and data memory it is possible to access program memory and data memory simultaneously.

✏️Advantage:
👉Faster operation.

✏️Disadvantage:
👉It requires more hardware. 

NOTE:
👉8051 family architecture are based on Harvard Architecture.

C DATA TYPES FOR 8051 MICRO-CONTROLLER

✏️C DATA TYPES FOR 8051 MICRO-CONTROLLER

📌Unsigned char:
1.The most widely used data types for the 8051. 
2.The unsigned char is an 8-bit data type. 
3.The range of  unsigned char is 0-255(0-FF).
Used for:
counter value.
ASCII  Character.

📌Signed char:
1.Signed char is an 8 bit data type.
2.Use the MSB D7 to represent - or +.
3.The range of signed char - 128 to +128.


📌Unsigned int:
1.The unsigned int is an 16-bit data type.
2.Takes the value in the range 0-65535(0-FFFFH).
Used for:
Define 16bit variable such as memory addresses.
Set the counter values of more than 256.


📌Signed int:
1.Signed int is an 16bit data type.
2.use the MSB D15 to represent - or +.
3.We have 15bits for the magnitude of the number - 32768 to +32767.


📌Bit, Sbit, Sfr:
1.The bit data type allows access to single bits of bit - addressable memory spaces 20-2FH.
2.To access bits of SFRs, we use sbit data type.
3.To access the byte-size SFR registers, we use SFR data type. 

ASSEMBLER DIRECTIVES

✏️ASSEMBLER DIRECTIVES

Assembler directives are instructions that direct the assembler to do something. This is used to set the program or register address during assembly.

✏️Types of assembler directives are:

📌ORG (origin):-
 The origin (ORG) directive is used to indicate the beginning of the addresses the number that comes after ORG can be either in hex or in decimal if the number is not followed by H it is decimal and the assembler will convert it to hex.
         Ex:- ORG 0000H


📌EQU (equate):-
    This is used to define a constant without occupying a memory location. The EQU directive does not set aside storage for a data item but associates a constant value with a data label so that when the label appears in the program its constant value will be substituted for the label to use EQU for the counter constant and then the constant is used to load the register.
   Ex:-
       COUNT EQU 25
       MOV R3, # COUNT


📌END:-
The END directive indicates to the assembler at the end of the source (asm) file.The END directive is the last line of an 8051 program meaning that in the source code anything after the END directive is ignored by the assembler.

📌DB (define byte) :-
The define assembler directive is used for allocation of storage space. It can be used to reserve as well as initialize one or more bytes.


📌DW (define word) :-

Define Word [DW]- The DW directive defines items that are one word (two bytes) in length.

Define Double word [DD]- It defines the data items that are a double word (four bytes) in length.

Define Quad word [DQ]- This directive is used to tell the assembler to declare variable 4 words in length or to reserve 4 words of storage in memory.


💁‍♂️ARTIFICIAL SUN CREATED BY CHINA 👈

🌞 ARTIFICIAL SUN MADE BY CHINA 🌞 ☀️China successfully powered up its “artificial sun” nuclear fusion reactor for the first ti...