SlideShare a Scribd company logo
1 of 22
DRIVING SSDs TO DISPLAY DATA USING 8051
Objectives of the Lab
 Getting Introduced to PSW Register and Addressing Modes
 Displaying data on SSDs using 8051 output ports.
 Getting Introduced to Look-up tables
 Implementing up/down counter from 00-99
 Programming 8051 using Smart-PRO Burner. (Review)
Deciding Pins or Ports to use
Use with
caution
If EA high
*We shall
use P2 and
P3.
Flags Register
Carry PSW.7 Holds carry after addition or borrow after subtraction.
Auxiliary PSW.6 Holds (half)carry after addition or borrow after subtraction b/w bit 3
&4.
-- PSW.5 Available to the user for General Purpose.
RS1 PSW.4 Register Bank Selector 1.
RS0 PSW.3 Register Bank Selector 0.
Overflow PSW.2 It is used to show if the result has exceeded the capacity of machine.
Parity PSW.0 Even Parity: If no. of ones odd, P=1, if even, P=0. (Only Accumulator)
Register Banks
(Selected by Default)
Use setb and clr
instructions to
Select register banks.
Addressing Modes
 Before learning to display data on SSD, it is required to
know about the 5 addressing modes used in 8051.
1. Immediate Addressing: Move data directly to registers e.g.
MOV A,#25h
2. Register Addressing: Move data in between registers e.g.
MOV A,R0; MOV R2,A; MOV R4,R7 is invalid.
3. Direct Addressing: Move data from RAM locations e.g.
MOV R0,40h; MOV R4,7Fh; note the missing ‘#’ sign.
4. Register Indirect Addressing: MOV A,@R0; move
contents of RAM location, the location is stored in R0.
5. Indexed Addressing: Widely used to access data from
look-up tables e.g. MOVC A,@A+DPTR
Seven Segment Displays
 First, we decide whether to use Common Anode or
Common Cathode SSDs.
 The decision is a simple one: Since, 8051 is better at
sinking current than sourcing, we shall use CA SSDs.
 To drive a SSD, the common terminal will be tied with 5V
(CA) and the segment terminals will be joined to 8051 port
pins via 470Ω resistors.
 To turn on a segment, we will simply clear 8051 pin to ‘0’
and to turn off we will set 8051 pin to ‘1’.
 LED displays are power hungry and pins hungry but are
cheaper than LCD displays.
Displaying Data on CA SSD
Digit Hexa Px.7 Px.6 Px.5 Px.4 Px.3 Px.2 Px.1 Px.0
X g f e d c b a
0 C0 1 1 0 0 0 0 0 0
1 F9 1 1 1 1 1 0 0 1
2 A4 1 0 1 0 0 1 0 0
3 B0 1 0 1 1 0 0 0 0
4 99 1 0 0 1 1 0 0 1
5 92 1 0 0 1 0 0 1 0
6 82 1 0 0 0 0 0 1 0
7 F8 1 1 1 1 1 0 0 0
8 80 1 0 0 0 0 0 0 0
9 98 1 0 0 1 1 0 0 0
This table is for Common Anode. For Common Cathode, complement the values
Clear pin to ‘0’ to turn on, set pin to ‘1’ to turn off.
Algorithm for SSD Counting
Start
First Digit
to Port
Call Delay
*Controller Programs tend to run forever i.e. in the infinite loop.
mov a,#0C0h
mov a,#98h
call delay
Call Delay
Last Digit
to Port
call delay
.
.
.
Too Complicated!!
 The above code looks simple but it creates a lot of
complication when it is incorporated with other
applications.
 For Example, what if we have to write a code to count up to
00 to 99, then there is a lot of writing to do and memory to
allot.
 Take another example, what if we have to display a value
e.g. temperature, then the process needs to be automated
not manual.
 But as we see there is no pattern between the data being
sent to the port for even the adjacent numbers, e.g. the data
for displaying ‘0’ is way different for displaying ‘1’.
 Our Requirement: We need a code that would modify this
non-pattern data into a pattern.
Look Up Tables
 The non-pattern data can be carved into a pattern using look
up tables, which are more understood as arrays.
 We can make look-up table (array) whose 1st entry contains
the 1st non-pattern data element, 2nd entry contains the 2nd
non-pattern data element and so on.
 Now, on the first index of look-up data (array) is our first
data, on 2nd index, we have the data we needed to come
second and so on.
 Remember the index starts from zero in µC.
 So, the data to display ‘zero’ on SSD is in zero index, to
display ‘one’ on SSD is in 1st index and so on.
 What we need to know is how to make and access these
look-up tables.
Instructions used in this Lab
 MOVC A,@A+DPTR (Explanation during example code)
 CJNE REG,DATA,LABEL (See instruction set)
 INC DPTR (dptr can’t be decremented)
 INC
 DEC
 See instruction set for the details of above commands.
Making and using Look-up Tables
 There are two techniques to make look-up tables.
 table: db 11000000b
db 111111001b
…
 table: db 0C0h,0F9h,0A4h,0B0h,099h,092h,082h,0F8h,
080h,098h.
 mov dptr,#table; label
 mov a,#0
 movc a,@a+dptr
 inc a; then loop these 4 instructions till the last entry.
Index 0 1 2 3 4 5 6 7 8 9
Data 0C0h 0F9h 0A4h 0B0h 099h 092h 082h 0F8h 080h 098h
Review
Program Structure (Directives)
org 00h
.
.
.
call delay
.
.
.
delay: ;subroutine
.
.
.
ret
end
Example code (0-9)
 mov dptr,#table
 main: mov r1,#0
 loop1:
 mov a,r1
 movc a,@a+dptr
 mov p1,a
 inc r1
 call delay
 cjne r1,#10,loop1
 jmp main
 table: db 0C0h,0F9h,0A4h,0B0h,099h,092h,082h,0F8h,
080h,098h.
Index 0 1 2 3 4 5 6 7 8 9
Data 0C0h 0F9h 0A4h 0B0h 099h 092h 082h 0F8h 080h 098h
Using Proteus to simulate 8051
codes
1. The ‘HEX’ file generated by ‘keil’ or any other software as such can be
used to check the working of code on software using proteus.
2. Just search for ‘AT89c51’, place the controller, double click on it to edit
properties
1. Change the clock frequency to 11.0592 MHz.
2. Click the ‘folder icon’ in front of Program files and locate the code hex
file.
3. In advanced properties, select ‘Simulate Program Fetches’ and ‘Yes’.
3. Then, place other devices, interconnect with 8051 and simply play the
simulation.
How to program a µC using
SmartPro 2008 (Programmer)
1. Connect your SmartPro 2008 Programmer to PC via
USB port and turn the device on using its adapter. Also,
place the µC carefully in the ZIF socket.
2. Locate and click ‘SmartPro 2008’ icon available on
desktop.
3. If it asks for the Programmer Select ‘Smart PRO 5000u’
and click demo.
*One must check, how to place different types of controller in the programmer.
How to program a µC using
SmartPro 2008 (Programmer)
4. Click ‘Select Device’ on the window or choose Device>Select or
press Ctrl+S.
1. In ‘Type’, select ‘MCU’
2. In ‘Manufacturer’, select ‘ATMEL’ , AT89Cxx.
3. In ‘Device’, select AT8951.
5. Now, select File>Open or press Ctrl+O, in ‘files of type’ select Intel
Hex and locate the ‘HEX’ file you want to program. Also, see if
buffer is loaded with the new ‘HEX’ file.
How to program a µC using
SmartPro 2008 (Programmer)
6. Now, there are a bunch of options that can be performed depending upon
the users needs.
1. F4 or Click ‘Read’: Reads a previous program already burned in the µC.
2. F5 or ‘Erase’: Erases the previous program in µC.
3. F6 or ‘Blank Check’: Verification if program is erased.
4. F7 or ‘Program’: Loads the *current HEX file in µC.
5. F8 or ‘Verify’: Verification if the program is properly loaded.
6. ‘Batch’: This option is used in Industry.
7. Spacebar or ‘Auto’: Performs all the steps from 2 to 5 in sequence.
7. Shortcut: Open SmartPro, slect device, locate hex file & press spacebar.
Debugging with µC
1. Unlike electronic circuits, the debugging with µC is different.
Firstly, there is software debugging and then there is hardware
debugging.
2. The software debugging includes the working of code.
3. The hardware debugging includes the working of code on
hardware and the devices interfaced.
4. Always perform µC experiment in three stages, test the µC IC and
generic board using led blinking, then verify the working of code
on Proteus software, then finally test the program on hardware.
Proteus Devices needed in this Lab
1. AT89c51
2. CA SSD
Lab Tasks
 Show counting on SSD’s in following patterns with
delay of 500 milli-seconds.
 Pattern 1: Show count from 0-9.
 Pattern 2: Show count from 9-0.
 Pattern 3: Show count from 00-99.
 Pattern 4: Show count from 99-00.
Quiz next week: (all material in LED and SSD slide +
codes)

More Related Content

What's hot (20)

MICROCONTROLLER - INTEL 8051
MICROCONTROLLER - INTEL 8051MICROCONTROLLER - INTEL 8051
MICROCONTROLLER - INTEL 8051
 
8051 microcontroller by K. Vijay Kumar
8051 microcontroller by K. Vijay Kumar8051 microcontroller by K. Vijay Kumar
8051 microcontroller by K. Vijay Kumar
 
program status word
program status wordprogram status word
program status word
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware
 
Microprocessor Part 1
Microprocessor    Part 1Microprocessor    Part 1
Microprocessor Part 1
 
MicroProcessors
MicroProcessors MicroProcessors
MicroProcessors
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
8051 architecture
8051 architecture8051 architecture
8051 architecture
 
8051 Presentation
8051 Presentation8051 Presentation
8051 Presentation
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontroller
 
1206 Interrupts Of 8085
1206 Interrupts Of 80851206 Interrupts Of 8085
1206 Interrupts Of 8085
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interrupt
 
MICROCONTROLLER 8051
MICROCONTROLLER 8051MICROCONTROLLER 8051
MICROCONTROLLER 8051
 
8051 Micro Controller
8051 Micro Controller 8051 Micro Controller
8051 Micro Controller
 
Class5
Class5Class5
Class5
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
8051 Microcontroller
8051 Microcontroller8051 Microcontroller
8051 Microcontroller
 
8051 microcontrolle rclass1
8051 microcontrolle rclass18051 microcontrolle rclass1
8051 microcontrolle rclass1
 
Datasheet 89S8253.pdf
Datasheet 89S8253.pdfDatasheet 89S8253.pdf
Datasheet 89S8253.pdf
 

Viewers also liked

Train the Brain - Improve overall performance
Train the Brain - Improve overall performanceTrain the Brain - Improve overall performance
Train the Brain - Improve overall performanceStig-Arne Kristoffersen
 
MECH; TOE STOP DETAILS 1
MECH; TOE STOP DETAILS 1MECH; TOE STOP DETAILS 1
MECH; TOE STOP DETAILS 1TOMMY MORPHIS
 
Presentacion patricia diaz
Presentacion patricia diazPresentacion patricia diaz
Presentacion patricia diazpattdiaz97
 
Qualitätsmanagement-Plattform mit SharePoint bei HOCHDORF
Qualitätsmanagement-Plattform mit SharePoint bei HOCHDORFQualitätsmanagement-Plattform mit SharePoint bei HOCHDORF
Qualitätsmanagement-Plattform mit SharePoint bei HOCHDORFIOZ AG
 
Hacking Ruby with Python
Hacking Ruby with PythonHacking Ruby with Python
Hacking Ruby with PythonTaisuke Yamada
 
Use Promise, Future and some functional programing stuff without being a math...
Use Promise, Future and some functional programing stuff without being a math...Use Promise, Future and some functional programing stuff without being a math...
Use Promise, Future and some functional programing stuff without being a math...Quentin Adam
 
preventing sqli and xss by ravi rajput in owasp meet ahmedabad
preventing sqli and xss by ravi rajput in owasp meet ahmedabadpreventing sqli and xss by ravi rajput in owasp meet ahmedabad
preventing sqli and xss by ravi rajput in owasp meet ahmedabadRavi Rajput
 
Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To DjangoJay Graves
 
Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6
Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6
Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6Chema Alonso
 
Building a Dynamic Website Using Django
Building a Dynamic Website Using DjangoBuilding a Dynamic Website Using Django
Building a Dynamic Website Using DjangoNathan Eror
 
Easy selenium test automation on python
Easy selenium test automation on pythonEasy selenium test automation on python
Easy selenium test automation on pythonMykhailo Poliarush
 

Viewers also liked (20)

Train the Brain - Improve overall performance
Train the Brain - Improve overall performanceTrain the Brain - Improve overall performance
Train the Brain - Improve overall performance
 
MECH; TOE STOP DETAILS 1
MECH; TOE STOP DETAILS 1MECH; TOE STOP DETAILS 1
MECH; TOE STOP DETAILS 1
 
Evaluation one media
Evaluation one mediaEvaluation one media
Evaluation one media
 
Presentacion patricia diaz
Presentacion patricia diazPresentacion patricia diaz
Presentacion patricia diaz
 
Hola
Hola Hola
Hola
 
1ped
1ped1ped
1ped
 
Ser feliz é
Ser feliz éSer feliz é
Ser feliz é
 
OARS-FUNKY
OARS-FUNKYOARS-FUNKY
OARS-FUNKY
 
Qualitätsmanagement-Plattform mit SharePoint bei HOCHDORF
Qualitätsmanagement-Plattform mit SharePoint bei HOCHDORFQualitätsmanagement-Plattform mit SharePoint bei HOCHDORF
Qualitätsmanagement-Plattform mit SharePoint bei HOCHDORF
 
Middle man
Middle manMiddle man
Middle man
 
Hacking Ruby with Python
Hacking Ruby with PythonHacking Ruby with Python
Hacking Ruby with Python
 
Use Promise, Future and some functional programing stuff without being a math...
Use Promise, Future and some functional programing stuff without being a math...Use Promise, Future and some functional programing stuff without being a math...
Use Promise, Future and some functional programing stuff without being a math...
 
Django Testing
Django TestingDjango Testing
Django Testing
 
preventing sqli and xss by ravi rajput in owasp meet ahmedabad
preventing sqli and xss by ravi rajput in owasp meet ahmedabadpreventing sqli and xss by ravi rajput in owasp meet ahmedabad
preventing sqli and xss by ravi rajput in owasp meet ahmedabad
 
Code 8051
Code 8051Code 8051
Code 8051
 
Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To Django
 
Hacking y python: Hacking de redes con Python
Hacking y python: Hacking de redes con PythonHacking y python: Hacking de redes con Python
Hacking y python: Hacking de redes con Python
 
Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6
Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6
Defcon 21 - Fear the Evil FOCA: mitm attacks using IPv6
 
Building a Dynamic Website Using Django
Building a Dynamic Website Using DjangoBuilding a Dynamic Website Using Django
Building a Dynamic Website Using Django
 
Easy selenium test automation on python
Easy selenium test automation on pythonEasy selenium test automation on python
Easy selenium test automation on python
 

Similar to Micro c lab3(ssd)

Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
Customizable Microprocessor design on Nexys 3 Spartan FPGA BoardCustomizable Microprocessor design on Nexys 3 Spartan FPGA Board
Customizable Microprocessor design on Nexys 3 Spartan FPGA BoardBharat Biyani
 
Microprocessor lab manual
Microprocessor lab manualMicroprocessor lab manual
Microprocessor lab manualDhaval Shukla
 
Introduction to pic
Introduction to picIntroduction to pic
Introduction to picPRADEEP
 
Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Basil John
 
Micro c lab2(led patterns)
Micro c lab2(led patterns)Micro c lab2(led patterns)
Micro c lab2(led patterns)Mashood
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller nitugatkal
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051OGAGA OTOBOR
 
8051 Microcontroller_module_4.1.pptx
8051 Microcontroller_module_4.1.pptx8051 Microcontroller_module_4.1.pptx
8051 Microcontroller_module_4.1.pptxARYAKUMARNIRAV
 
Microprocessor 8085 Chapter 3
Microprocessor 8085 Chapter 3Microprocessor 8085 Chapter 3
Microprocessor 8085 Chapter 3Rishikesh Bhavsar
 
An introduction to microprocessor architecture using INTEL 8085 as a classic...
An introduction to microprocessor  architecture using INTEL 8085 as a classic...An introduction to microprocessor  architecture using INTEL 8085 as a classic...
An introduction to microprocessor architecture using INTEL 8085 as a classic...Prasad Deshpande
 
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentsEMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentseceprinter6
 

Similar to Micro c lab3(ssd) (20)

Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
Customizable Microprocessor design on Nexys 3 Spartan FPGA BoardCustomizable Microprocessor design on Nexys 3 Spartan FPGA Board
Customizable Microprocessor design on Nexys 3 Spartan FPGA Board
 
Microprocessor lab manual
Microprocessor lab manualMicroprocessor lab manual
Microprocessor lab manual
 
EE2356 Microprocessor and Microcontroller Lab Manuel
EE2356 Microprocessor and Microcontroller Lab ManuelEE2356 Microprocessor and Microcontroller Lab Manuel
EE2356 Microprocessor and Microcontroller Lab Manuel
 
8085 (1)
8085 (1)8085 (1)
8085 (1)
 
8085 intro
8085 intro8085 intro
8085 intro
 
Mini Project- Stepper Motor Control
Mini Project- Stepper Motor ControlMini Project- Stepper Motor Control
Mini Project- Stepper Motor Control
 
Mpi lab manual eee
Mpi lab manual eeeMpi lab manual eee
Mpi lab manual eee
 
Introduction to pic
Introduction to picIntroduction to pic
Introduction to pic
 
8085.ppt
8085.ppt8085.ppt
8085.ppt
 
module-2.pptx
module-2.pptxmodule-2.pptx
module-2.pptx
 
8085 microprocessor Embedded system
8085 microprocessor  Embedded system8085 microprocessor  Embedded system
8085 microprocessor Embedded system
 
Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)
 
Micro c lab2(led patterns)
Micro c lab2(led patterns)Micro c lab2(led patterns)
Micro c lab2(led patterns)
 
8085 alp programs
8085 alp programs8085 alp programs
8085 alp programs
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051
 
8051 Microcontroller_module_4.1.pptx
8051 Microcontroller_module_4.1.pptx8051 Microcontroller_module_4.1.pptx
8051 Microcontroller_module_4.1.pptx
 
Microprocessor 8085 Chapter 3
Microprocessor 8085 Chapter 3Microprocessor 8085 Chapter 3
Microprocessor 8085 Chapter 3
 
An introduction to microprocessor architecture using INTEL 8085 as a classic...
An introduction to microprocessor  architecture using INTEL 8085 as a classic...An introduction to microprocessor  architecture using INTEL 8085 as a classic...
An introduction to microprocessor architecture using INTEL 8085 as a classic...
 
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering studentsEMBEDDED SYSTEMS AND IOT lab manual for enginnering students
EMBEDDED SYSTEMS AND IOT lab manual for enginnering students
 

More from Mashood

Patience (1).pptx
Patience (1).pptxPatience (1).pptx
Patience (1).pptxMashood
 
Micro c lab8(serial communication)
Micro c lab8(serial communication)Micro c lab8(serial communication)
Micro c lab8(serial communication)Mashood
 
Micro c lab7(timers)
Micro c lab7(timers)Micro c lab7(timers)
Micro c lab7(timers)Mashood
 
Micro c lab6(lcd)
Micro c lab6(lcd)Micro c lab6(lcd)
Micro c lab6(lcd)Mashood
 
Micro c lab5(stepper-motor)
Micro c lab5(stepper-motor)Micro c lab5(stepper-motor)
Micro c lab5(stepper-motor)Mashood
 
Micro c lab4(keypad)
Micro c lab4(keypad)Micro c lab4(keypad)
Micro c lab4(keypad)Mashood
 
Micro c lab1(intro to 8051)
Micro c lab1(intro to 8051)Micro c lab1(intro to 8051)
Micro c lab1(intro to 8051)Mashood
 
Amplifiers (analog electronics ii lab)
Amplifiers (analog electronics ii lab)Amplifiers (analog electronics ii lab)
Amplifiers (analog electronics ii lab)Mashood
 
Pcb design using proteus
Pcb design using proteusPcb design using proteus
Pcb design using proteusMashood
 
Function Generator
Function GeneratorFunction Generator
Function GeneratorMashood
 
Speed Measuring Circuit
Speed Measuring CircuitSpeed Measuring Circuit
Speed Measuring CircuitMashood
 

More from Mashood (11)

Patience (1).pptx
Patience (1).pptxPatience (1).pptx
Patience (1).pptx
 
Micro c lab8(serial communication)
Micro c lab8(serial communication)Micro c lab8(serial communication)
Micro c lab8(serial communication)
 
Micro c lab7(timers)
Micro c lab7(timers)Micro c lab7(timers)
Micro c lab7(timers)
 
Micro c lab6(lcd)
Micro c lab6(lcd)Micro c lab6(lcd)
Micro c lab6(lcd)
 
Micro c lab5(stepper-motor)
Micro c lab5(stepper-motor)Micro c lab5(stepper-motor)
Micro c lab5(stepper-motor)
 
Micro c lab4(keypad)
Micro c lab4(keypad)Micro c lab4(keypad)
Micro c lab4(keypad)
 
Micro c lab1(intro to 8051)
Micro c lab1(intro to 8051)Micro c lab1(intro to 8051)
Micro c lab1(intro to 8051)
 
Amplifiers (analog electronics ii lab)
Amplifiers (analog electronics ii lab)Amplifiers (analog electronics ii lab)
Amplifiers (analog electronics ii lab)
 
Pcb design using proteus
Pcb design using proteusPcb design using proteus
Pcb design using proteus
 
Function Generator
Function GeneratorFunction Generator
Function Generator
 
Speed Measuring Circuit
Speed Measuring CircuitSpeed Measuring Circuit
Speed Measuring Circuit
 

Recently uploaded

Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

Micro c lab3(ssd)

  • 1. DRIVING SSDs TO DISPLAY DATA USING 8051
  • 2. Objectives of the Lab  Getting Introduced to PSW Register and Addressing Modes  Displaying data on SSDs using 8051 output ports.  Getting Introduced to Look-up tables  Implementing up/down counter from 00-99  Programming 8051 using Smart-PRO Burner. (Review)
  • 3. Deciding Pins or Ports to use Use with caution If EA high *We shall use P2 and P3.
  • 4. Flags Register Carry PSW.7 Holds carry after addition or borrow after subtraction. Auxiliary PSW.6 Holds (half)carry after addition or borrow after subtraction b/w bit 3 &4. -- PSW.5 Available to the user for General Purpose. RS1 PSW.4 Register Bank Selector 1. RS0 PSW.3 Register Bank Selector 0. Overflow PSW.2 It is used to show if the result has exceeded the capacity of machine. Parity PSW.0 Even Parity: If no. of ones odd, P=1, if even, P=0. (Only Accumulator)
  • 5. Register Banks (Selected by Default) Use setb and clr instructions to Select register banks.
  • 6. Addressing Modes  Before learning to display data on SSD, it is required to know about the 5 addressing modes used in 8051. 1. Immediate Addressing: Move data directly to registers e.g. MOV A,#25h 2. Register Addressing: Move data in between registers e.g. MOV A,R0; MOV R2,A; MOV R4,R7 is invalid. 3. Direct Addressing: Move data from RAM locations e.g. MOV R0,40h; MOV R4,7Fh; note the missing ‘#’ sign. 4. Register Indirect Addressing: MOV A,@R0; move contents of RAM location, the location is stored in R0. 5. Indexed Addressing: Widely used to access data from look-up tables e.g. MOVC A,@A+DPTR
  • 7. Seven Segment Displays  First, we decide whether to use Common Anode or Common Cathode SSDs.  The decision is a simple one: Since, 8051 is better at sinking current than sourcing, we shall use CA SSDs.  To drive a SSD, the common terminal will be tied with 5V (CA) and the segment terminals will be joined to 8051 port pins via 470Ω resistors.  To turn on a segment, we will simply clear 8051 pin to ‘0’ and to turn off we will set 8051 pin to ‘1’.  LED displays are power hungry and pins hungry but are cheaper than LCD displays.
  • 8. Displaying Data on CA SSD Digit Hexa Px.7 Px.6 Px.5 Px.4 Px.3 Px.2 Px.1 Px.0 X g f e d c b a 0 C0 1 1 0 0 0 0 0 0 1 F9 1 1 1 1 1 0 0 1 2 A4 1 0 1 0 0 1 0 0 3 B0 1 0 1 1 0 0 0 0 4 99 1 0 0 1 1 0 0 1 5 92 1 0 0 1 0 0 1 0 6 82 1 0 0 0 0 0 1 0 7 F8 1 1 1 1 1 0 0 0 8 80 1 0 0 0 0 0 0 0 9 98 1 0 0 1 1 0 0 0 This table is for Common Anode. For Common Cathode, complement the values Clear pin to ‘0’ to turn on, set pin to ‘1’ to turn off.
  • 9. Algorithm for SSD Counting Start First Digit to Port Call Delay *Controller Programs tend to run forever i.e. in the infinite loop. mov a,#0C0h mov a,#98h call delay Call Delay Last Digit to Port call delay . . .
  • 10. Too Complicated!!  The above code looks simple but it creates a lot of complication when it is incorporated with other applications.  For Example, what if we have to write a code to count up to 00 to 99, then there is a lot of writing to do and memory to allot.  Take another example, what if we have to display a value e.g. temperature, then the process needs to be automated not manual.  But as we see there is no pattern between the data being sent to the port for even the adjacent numbers, e.g. the data for displaying ‘0’ is way different for displaying ‘1’.  Our Requirement: We need a code that would modify this non-pattern data into a pattern.
  • 11. Look Up Tables  The non-pattern data can be carved into a pattern using look up tables, which are more understood as arrays.  We can make look-up table (array) whose 1st entry contains the 1st non-pattern data element, 2nd entry contains the 2nd non-pattern data element and so on.  Now, on the first index of look-up data (array) is our first data, on 2nd index, we have the data we needed to come second and so on.  Remember the index starts from zero in µC.  So, the data to display ‘zero’ on SSD is in zero index, to display ‘one’ on SSD is in 1st index and so on.  What we need to know is how to make and access these look-up tables.
  • 12. Instructions used in this Lab  MOVC A,@A+DPTR (Explanation during example code)  CJNE REG,DATA,LABEL (See instruction set)  INC DPTR (dptr can’t be decremented)  INC  DEC  See instruction set for the details of above commands.
  • 13. Making and using Look-up Tables  There are two techniques to make look-up tables.  table: db 11000000b db 111111001b …  table: db 0C0h,0F9h,0A4h,0B0h,099h,092h,082h,0F8h, 080h,098h.  mov dptr,#table; label  mov a,#0  movc a,@a+dptr  inc a; then loop these 4 instructions till the last entry. Index 0 1 2 3 4 5 6 7 8 9 Data 0C0h 0F9h 0A4h 0B0h 099h 092h 082h 0F8h 080h 098h
  • 14. Review Program Structure (Directives) org 00h . . . call delay . . . delay: ;subroutine . . . ret end
  • 15. Example code (0-9)  mov dptr,#table  main: mov r1,#0  loop1:  mov a,r1  movc a,@a+dptr  mov p1,a  inc r1  call delay  cjne r1,#10,loop1  jmp main  table: db 0C0h,0F9h,0A4h,0B0h,099h,092h,082h,0F8h, 080h,098h. Index 0 1 2 3 4 5 6 7 8 9 Data 0C0h 0F9h 0A4h 0B0h 099h 092h 082h 0F8h 080h 098h
  • 16. Using Proteus to simulate 8051 codes 1. The ‘HEX’ file generated by ‘keil’ or any other software as such can be used to check the working of code on software using proteus. 2. Just search for ‘AT89c51’, place the controller, double click on it to edit properties 1. Change the clock frequency to 11.0592 MHz. 2. Click the ‘folder icon’ in front of Program files and locate the code hex file. 3. In advanced properties, select ‘Simulate Program Fetches’ and ‘Yes’. 3. Then, place other devices, interconnect with 8051 and simply play the simulation.
  • 17. How to program a µC using SmartPro 2008 (Programmer) 1. Connect your SmartPro 2008 Programmer to PC via USB port and turn the device on using its adapter. Also, place the µC carefully in the ZIF socket. 2. Locate and click ‘SmartPro 2008’ icon available on desktop. 3. If it asks for the Programmer Select ‘Smart PRO 5000u’ and click demo. *One must check, how to place different types of controller in the programmer.
  • 18. How to program a µC using SmartPro 2008 (Programmer) 4. Click ‘Select Device’ on the window or choose Device>Select or press Ctrl+S. 1. In ‘Type’, select ‘MCU’ 2. In ‘Manufacturer’, select ‘ATMEL’ , AT89Cxx. 3. In ‘Device’, select AT8951. 5. Now, select File>Open or press Ctrl+O, in ‘files of type’ select Intel Hex and locate the ‘HEX’ file you want to program. Also, see if buffer is loaded with the new ‘HEX’ file.
  • 19. How to program a µC using SmartPro 2008 (Programmer) 6. Now, there are a bunch of options that can be performed depending upon the users needs. 1. F4 or Click ‘Read’: Reads a previous program already burned in the µC. 2. F5 or ‘Erase’: Erases the previous program in µC. 3. F6 or ‘Blank Check’: Verification if program is erased. 4. F7 or ‘Program’: Loads the *current HEX file in µC. 5. F8 or ‘Verify’: Verification if the program is properly loaded. 6. ‘Batch’: This option is used in Industry. 7. Spacebar or ‘Auto’: Performs all the steps from 2 to 5 in sequence. 7. Shortcut: Open SmartPro, slect device, locate hex file & press spacebar.
  • 20. Debugging with µC 1. Unlike electronic circuits, the debugging with µC is different. Firstly, there is software debugging and then there is hardware debugging. 2. The software debugging includes the working of code. 3. The hardware debugging includes the working of code on hardware and the devices interfaced. 4. Always perform µC experiment in three stages, test the µC IC and generic board using led blinking, then verify the working of code on Proteus software, then finally test the program on hardware.
  • 21. Proteus Devices needed in this Lab 1. AT89c51 2. CA SSD
  • 22. Lab Tasks  Show counting on SSD’s in following patterns with delay of 500 milli-seconds.  Pattern 1: Show count from 0-9.  Pattern 2: Show count from 9-0.  Pattern 3: Show count from 00-99.  Pattern 4: Show count from 99-00. Quiz next week: (all material in LED and SSD slide + codes)