SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Chapter 5 PIC Interfacing
[object Object],[object Object],[object Object],Analog to digital conversion
Analog to digital conversion (cont..) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Analog to digital conversion (cont..) ,[object Object], C X Thermistor 22k 5 V 0 V
Analog to digital conversion (cont..) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analog to digital conversion (cont..) ,[object Object]
Analog to digital conversion (cont..) 16C7X device specifications
Analog to digital conversion (cont..) ,[object Object],[object Object],[object Object]
Analog to digital conversion (cont..) Memory map of PIC 16C711 BANK0 BANK1
[object Object],[object Object],[object Object],[object Object],Analog to digital conversion (cont..)
Analog to digital conversion (cont..) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analog to digital conversion (cont..) ,[object Object],[object Object],[object Object],[object Object]
Analog to digital conversion (cont..) ADCON0 register ADCS1 ADCS0 - CHS1 CHS0 GO/DONE - ADON Bit 7 Bit 0 1 = A/D on 2 = A/D off 1 = A/D in progress 0 = A/D finished Analog channel select 00 = channel 0, AN0 01 = channel 1, AN1 10 = channel 2, AN2 11 = channel 3, AN3
Analog to digital conversion (cont..) ,[object Object],[object Object],[object Object],[object Object]
Analog to digital conversion (cont..) Bit 7 Bit 0 A/D Port Configuration bits ADCON1 Register ADCON1 Port configuration - - - - -  - PCFG1 PCFG0 Vdd D D D D 11 Vdd D D A A 10 A3 Vref A A A 01 Vdd A A A A 00 Ref A3 A2 A1 A0 PCFG
[object Object],Analog to digital conversion (cont..) bsf ADCON0, ADON ;A/D converter is on bsf ADCON0, GO ;Start A/D conversion ADLoop btfsc ADCON0, GO ;has conversion finished? goto ADLoop ;no, so keep looping etc
. ;yes, so exits loop
Analog to digital conversion (cont..) ,[object Object]
Serial Communication ,[object Object]
Serial Communication (cont..) ,[object Object],[object Object],[object Object],[object Object]
Serial Communication (cont..) Pin designations on RS232 connector (Ring Indicator) 9. RI (Clear To Send) 8. CTS (Request To Send) 7. RTS (Data Set Ready) 6. DSR (Ground) 5. GND (Data terminal Ready) 4. DTR (Transmit Data) 3. TXD (Receive Data) 2. RXD (Carrier Detect) 1. CD
Serial Communication (cont..) ,[object Object],[object Object],[object Object]
Serial Communication (cont..) Connecting a microcontroller to a PC via a MAX232 line interface chip   Program Example
Serial Communication (cont..) ,[object Object],rs232init   Macro for initializing the pin for transmitting data (TX-pin).    Example:  RS232init  Sendw   Sending ASCII value of data found in W register.  Example:  movlw 't'  call Sendw  rs232text   Sending ASCII value of a specified text  Example:  rs232 “HELLO WORLD"  rs232byte Sending ASCII value of decimal digits of 8-bit variable  Example:  movlw .123 movwf TXdata rs232byte TXdata   ;Send '1', '2', '3'
Serial Communication (cont..) ,[object Object],[object Object],[object Object]
Pulse Width Modulation (PWM) ,[object Object],[object Object],[object Object]
Pulse Width Modulation (PWM) – (Cont..) Figure 1
Pulse Width Modulation (PWM) – (Cont..) list p= 16f84 ;************************************************************* PORTB   EQU   0x06  ; port b equate  duty   EQU   0x0c   ; length of duty cycle  temp  EQU   0x0d   ; length of duty cycle  ;************************************************************* c   EQU   0  ; status bit to check after subtraction   ;*************************************************************  ORG   0x000  The only equate of signifficance here is PWM. This register will be used  to store the length of the PWM signal to be generated.
Pulse Width Modulation (PWM) – (Cont..) The next portion of code contains the actual instructions that tell  the PIC what to do.   start   MOVLW   0x00  ;load W with 0x00 make port B output   TRIS   PORTB   ;copy W tristate to port B outputs   MOVLW   0x00  ;fill w with zeroes   MOVWF   PORTB   ;set port b outputs to low These lines   ;set up port B as outputs.   ;All outputs are then set to low.   rstrt MOVLW   d'0'  MOVWF   PORTB   MOVLW   d'157'  ;Duty cycle length movwf duty   After setting up the ports, the main loop is begun. At the beginning of the main  loop, all port b pins are set to low just incase they are high when they shouldn't  be. The duty cycle is then set to 157 (a 50% duty cycle. 255 corresponds to  100% and 0 corresponds to 0%).
Pulse Width Modulation (PWM) – (Cont..) b0loop   MOVF   duty,w   MOVWF   temp   BSF   PORTB ,0  pwma   NOP   NOP   NOP   NOP  NOP  NOP  NOP  NOP  NOP  NOP NOP  NOP   DECFSZ   temp   GOTO   pwma
Pulse Width Modulation (PWM) – (Cont..) The next bit of code is the loop for the PWM signal generated at pin B0.  The pwm1a loop generates the high portion of the PWM signal. The duty  cycle is stored in temp and then the pin is set high. after a pause,  temp is decremented and so long as it doesnt reach zero the pause is  repeated and temp is decremented again. After temp reaches zero, the  code continues.
Pulse Width Modulation (PWM) – (Cont..) MOVLW   d'255 '  MOVWF   temp   MOVF   duty,w   SUBWF   temp,f   BCF   PORTB ,0  pwmb   NOP  NOP  NOP  NOP  NOP  NOP  NOP  NOP  NOP  NOP  NOP  NOP
Pulse Width Modulation (PWM) – (Cont..) DECFSZ   temp   GOTO   pwmb   GOTO   rstrt END The next portion of code generates the low part of the PWM signal.  The value 255 is stored in temp, and the duty cycle is subtracted from this.  This gives the remaining length of signal to be generated. Temp is then  decremented in the same manner as above, this time with B0 set to low.  Once the entire PWM signal has been generated, the code repeats.  This code causes a PWM signal to be generated with a duty cycle  proportional to the value set. The frequency of the signal can also be  adjusted by varying the delay (the number of nop's used).
Pulse Width Modulation (PWM) – (Cont..) - Application ,[object Object],[object Object],[object Object],[object Object],[object Object]
Pulse Width Modulation (PWM) – (Cont..) - Application ,[object Object],[object Object]

Weitere Àhnliche Inhalte

Was ist angesagt?

Pic microcontroller [autosaved] [autosaved]
Pic microcontroller [autosaved] [autosaved]Pic microcontroller [autosaved] [autosaved]
Pic microcontroller [autosaved] [autosaved]gauravholani
 
Programming pic microcontrollers
Programming pic microcontrollersProgramming pic microcontrollers
Programming pic microcontrollersMAIYO JOSPHAT
 
Programming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontrollerProgramming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontrollerCorrado Santoro
 
Microcontroller lec 2
Microcontroller  lec 2Microcontroller  lec 2
Microcontroller lec 2Ibrahim Reda
 
Introduction to MPLAB IDE
Introduction to MPLAB IDEIntroduction to MPLAB IDE
Introduction to MPLAB IDEKarim El-Rayes
 
Analog I/O in PIC16F877A
Analog I/O in PIC16F877AAnalog I/O in PIC16F877A
Analog I/O in PIC16F877AMohamed Bedair
 
174085193 pic-prgm-manual
174085193 pic-prgm-manual174085193 pic-prgm-manual
174085193 pic-prgm-manualArun Shan
 
Introduction to pic microcontroller
Introduction to pic microcontrollerIntroduction to pic microcontroller
Introduction to pic microcontrollerSiva Kumar
 
PIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarPIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarGauravRaikar3
 
Programming with PIC microcontroller
Programming with PIC microcontroller Programming with PIC microcontroller
Programming with PIC microcontroller Raghav Shetty
 
PIC CONTROLLERS
PIC CONTROLLERSPIC CONTROLLERS
PIC CONTROLLERSTanmay Bakshi
 
Arm7 Interfacing examples
Arm7   Interfacing examples Arm7   Interfacing examples
Arm7 Interfacing examples Dr.YNM
 
Pic 18 microcontroller
Pic 18 microcontrollerPic 18 microcontroller
Pic 18 microcontrollerAshish Ranjan
 
Arm7 document
Arm7  documentArm7  document
Arm7 documentN Harisha
 

Was ist angesagt? (19)

Pic microcontroller [autosaved] [autosaved]
Pic microcontroller [autosaved] [autosaved]Pic microcontroller [autosaved] [autosaved]
Pic microcontroller [autosaved] [autosaved]
 
Programming pic microcontrollers
Programming pic microcontrollersProgramming pic microcontrollers
Programming pic microcontrollers
 
Programming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontrollerProgramming the Digital I/O Interface of a PIC microcontroller
Programming the Digital I/O Interface of a PIC microcontroller
 
Microcontroller lec 2
Microcontroller  lec 2Microcontroller  lec 2
Microcontroller lec 2
 
Introduction to MPLAB IDE
Introduction to MPLAB IDEIntroduction to MPLAB IDE
Introduction to MPLAB IDE
 
Analog I/O in PIC16F877A
Analog I/O in PIC16F877AAnalog I/O in PIC16F877A
Analog I/O in PIC16F877A
 
174085193 pic-prgm-manual
174085193 pic-prgm-manual174085193 pic-prgm-manual
174085193 pic-prgm-manual
 
Digital i o
Digital i oDigital i o
Digital i o
 
Getting started with pic microcontrollers
Getting started with pic microcontrollersGetting started with pic microcontrollers
Getting started with pic microcontrollers
 
PIC Microcontrollers
PIC MicrocontrollersPIC Microcontrollers
PIC Microcontrollers
 
Presentation
PresentationPresentation
Presentation
 
Introduction to pic microcontroller
Introduction to pic microcontrollerIntroduction to pic microcontroller
Introduction to pic microcontroller
 
PIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikarPIC 16F877 micro controller by Gaurav raikar
PIC 16F877 micro controller by Gaurav raikar
 
Programming with PIC microcontroller
Programming with PIC microcontroller Programming with PIC microcontroller
Programming with PIC microcontroller
 
PIC CONTROLLERS
PIC CONTROLLERSPIC CONTROLLERS
PIC CONTROLLERS
 
Arm7 Interfacing examples
Arm7   Interfacing examples Arm7   Interfacing examples
Arm7 Interfacing examples
 
Pic microcontroller step by step your complete guide
Pic microcontroller step by step your complete guidePic microcontroller step by step your complete guide
Pic microcontroller step by step your complete guide
 
Pic 18 microcontroller
Pic 18 microcontrollerPic 18 microcontroller
Pic 18 microcontroller
 
Arm7 document
Arm7  documentArm7  document
Arm7 document
 

Ähnlich wie Chapter5 dek3133

analog to digital converter and dac final
analog to digital converter and dac finalanalog to digital converter and dac final
analog to digital converter and dac finalDrVikasMahor
 
Interfacing technique with 8085- ADC[0808]
Interfacing technique with 8085- ADC[0808]Interfacing technique with 8085- ADC[0808]
Interfacing technique with 8085- ADC[0808]Guhan k
 
Analog to Digital Converters
Analog to Digital ConvertersAnalog to Digital Converters
Analog to Digital ConvertersAmitabh Shukla
 
Pic ppt 13104022(4th_year)
Pic ppt 13104022(4th_year)Pic ppt 13104022(4th_year)
Pic ppt 13104022(4th_year)Daman Singh
 
Unit iv microcontrollers final
Unit iv microcontrollers finalUnit iv microcontrollers final
Unit iv microcontrollers finalSARITHA REDDY
 
UNIT 4 & 5 - I nterfacing_Lecture7.pptx
UNIT 4 & 5 - I         nterfacing_Lecture7.pptxUNIT 4 & 5 - I         nterfacing_Lecture7.pptx
UNIT 4 & 5 - I nterfacing_Lecture7.pptxnaveen088888
 
Fundamental of MSD Module-III Part-a.ppt
Fundamental of MSD Module-III Part-a.pptFundamental of MSD Module-III Part-a.ppt
Fundamental of MSD Module-III Part-a.pptBEVARAVASUDEVAAP1813
 
Adc interfacing
Adc interfacingAdc interfacing
Adc interfacingMonica Gunjal
 
ADC and DAC interfacing.pdf
ADC and DAC interfacing.pdfADC and DAC interfacing.pdf
ADC and DAC interfacing.pdfVikasMahor3
 
Unit iii microcontrollers final1
Unit iii microcontrollers final1Unit iii microcontrollers final1
Unit iii microcontrollers final1Saritha Reddy
 
Analog To Digital Conversion (ADC) Programming in LPC2148
Analog To Digital Conversion (ADC) Programming in LPC2148Analog To Digital Conversion (ADC) Programming in LPC2148
Analog To Digital Conversion (ADC) Programming in LPC2148Omkar Rane
 
DIGITAL VOLTMETER USING 8051 MICROCONTROLLER
DIGITAL VOLTMETER USING 8051 MICROCONTROLLERDIGITAL VOLTMETER USING 8051 MICROCONTROLLER
DIGITAL VOLTMETER USING 8051 MICROCONTROLLERChirag Lakhani
 
digitalvoltmeterusing805112b2-170214173216 (1).pdf
digitalvoltmeterusing805112b2-170214173216 (1).pdfdigitalvoltmeterusing805112b2-170214173216 (1).pdf
digitalvoltmeterusing805112b2-170214173216 (1).pdfsatyamsinha37
 
05 analog control_sp15
05 analog control_sp1505 analog control_sp15
05 analog control_sp15John Todora
 
Adc dac converter
Adc dac converterAdc dac converter
Adc dac converterparmarurvashi
 
Chp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copyChp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copymkazree
 
Construction of digital voltmeter by Bapi Kumar Das
Construction of digital voltmeter by Bapi Kumar DasConstruction of digital voltmeter by Bapi Kumar Das
Construction of digital voltmeter by Bapi Kumar DasB.k. Das
 
adc dac converter
adc dac converteradc dac converter
adc dac converterGaurav Rai
 

Ähnlich wie Chapter5 dek3133 (20)

analog to digital converter and dac final
analog to digital converter and dac finalanalog to digital converter and dac final
analog to digital converter and dac final
 
Interfacing technique with 8085- ADC[0808]
Interfacing technique with 8085- ADC[0808]Interfacing technique with 8085- ADC[0808]
Interfacing technique with 8085- ADC[0808]
 
Analog to Digital Converters
Analog to Digital ConvertersAnalog to Digital Converters
Analog to Digital Converters
 
Pic ppt 13104022(4th_year)
Pic ppt 13104022(4th_year)Pic ppt 13104022(4th_year)
Pic ppt 13104022(4th_year)
 
8051 FINIAL
8051 FINIAL8051 FINIAL
8051 FINIAL
 
Unit iv microcontrollers final
Unit iv microcontrollers finalUnit iv microcontrollers final
Unit iv microcontrollers final
 
UNIT 4 & 5 - I nterfacing_Lecture7.pptx
UNIT 4 & 5 - I         nterfacing_Lecture7.pptxUNIT 4 & 5 - I         nterfacing_Lecture7.pptx
UNIT 4 & 5 - I nterfacing_Lecture7.pptx
 
Fundamental of MSD Module-III Part-a.ppt
Fundamental of MSD Module-III Part-a.pptFundamental of MSD Module-III Part-a.ppt
Fundamental of MSD Module-III Part-a.ppt
 
Adc interfacing
Adc interfacingAdc interfacing
Adc interfacing
 
ADC and DAC interfacing.pdf
ADC and DAC interfacing.pdfADC and DAC interfacing.pdf
ADC and DAC interfacing.pdf
 
Unit iii microcontrollers final1
Unit iii microcontrollers final1Unit iii microcontrollers final1
Unit iii microcontrollers final1
 
8255
82558255
8255
 
Analog To Digital Conversion (ADC) Programming in LPC2148
Analog To Digital Conversion (ADC) Programming in LPC2148Analog To Digital Conversion (ADC) Programming in LPC2148
Analog To Digital Conversion (ADC) Programming in LPC2148
 
DIGITAL VOLTMETER USING 8051 MICROCONTROLLER
DIGITAL VOLTMETER USING 8051 MICROCONTROLLERDIGITAL VOLTMETER USING 8051 MICROCONTROLLER
DIGITAL VOLTMETER USING 8051 MICROCONTROLLER
 
digitalvoltmeterusing805112b2-170214173216 (1).pdf
digitalvoltmeterusing805112b2-170214173216 (1).pdfdigitalvoltmeterusing805112b2-170214173216 (1).pdf
digitalvoltmeterusing805112b2-170214173216 (1).pdf
 
05 analog control_sp15
05 analog control_sp1505 analog control_sp15
05 analog control_sp15
 
Adc dac converter
Adc dac converterAdc dac converter
Adc dac converter
 
Chp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copyChp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copy
 
Construction of digital voltmeter by Bapi Kumar Das
Construction of digital voltmeter by Bapi Kumar DasConstruction of digital voltmeter by Bapi Kumar Das
Construction of digital voltmeter by Bapi Kumar Das
 
adc dac converter
adc dac converteradc dac converter
adc dac converter
 

Mehr von Hattori Sidek

Chapter 4 frequency modulation
Chapter 4 frequency modulationChapter 4 frequency modulation
Chapter 4 frequency modulationHattori Sidek
 
Chapter 3 am receivers
Chapter 3 am receiversChapter 3 am receivers
Chapter 3 am receiversHattori Sidek
 
Ch8 file processing
Ch8 file processingCh8 file processing
Ch8 file processingHattori Sidek
 
Ch6 pointers (latest)
Ch6 pointers (latest)Ch6 pointers (latest)
Ch6 pointers (latest)Hattori Sidek
 
Ch5 array nota
Ch5 array notaCh5 array nota
Ch5 array notaHattori Sidek
 
Ch3 repetition
Ch3 repetitionCh3 repetition
Ch3 repetitionHattori Sidek
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to cHattori Sidek
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software developmentHattori Sidek
 
Ch7 structures
Ch7 structuresCh7 structures
Ch7 structuresHattori Sidek
 
12 wireless la-ns
12 wireless la-ns12 wireless la-ns
12 wireless la-nsHattori Sidek
 
11 circuit-packet
11 circuit-packet11 circuit-packet
11 circuit-packetHattori Sidek
 
10 high speedla-ns
10 high speedla-ns10 high speedla-ns
10 high speedla-nsHattori Sidek
 
8 spread spectrum
8 spread spectrum8 spread spectrum
8 spread spectrumHattori Sidek
 
7 multiplexing
7 multiplexing7 multiplexing
7 multiplexingHattori Sidek
 
6 data linkcontrol
6  data linkcontrol6  data linkcontrol
6 data linkcontrolHattori Sidek
 
5 digital datacomm
5 digital datacomm5 digital datacomm
5 digital datacommHattori Sidek
 

Mehr von Hattori Sidek (20)

Chapter 4 frequency modulation
Chapter 4 frequency modulationChapter 4 frequency modulation
Chapter 4 frequency modulation
 
Chapter 3 am receivers
Chapter 3 am receiversChapter 3 am receivers
Chapter 3 am receivers
 
Ch8 file processing
Ch8 file processingCh8 file processing
Ch8 file processing
 
Ch6 pointers (latest)
Ch6 pointers (latest)Ch6 pointers (latest)
Ch6 pointers (latest)
 
Ch5 array nota
Ch5 array notaCh5 array nota
Ch5 array nota
 
Ch4 functions
Ch4 functionsCh4 functions
Ch4 functions
 
Ch3 selection
Ch3 selectionCh3 selection
Ch3 selection
 
Ch3 repetition
Ch3 repetitionCh3 repetition
Ch3 repetition
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software development
 
Ch7 structures
Ch7 structuresCh7 structures
Ch7 structures
 
13 atm
13 atm13 atm
13 atm
 
12 wireless la-ns
12 wireless la-ns12 wireless la-ns
12 wireless la-ns
 
11 circuit-packet
11 circuit-packet11 circuit-packet
11 circuit-packet
 
10 high speedla-ns
10 high speedla-ns10 high speedla-ns
10 high speedla-ns
 
9 lan
9 lan9 lan
9 lan
 
8 spread spectrum
8 spread spectrum8 spread spectrum
8 spread spectrum
 
7 multiplexing
7 multiplexing7 multiplexing
7 multiplexing
 
6 data linkcontrol
6  data linkcontrol6  data linkcontrol
6 data linkcontrol
 
5 digital datacomm
5 digital datacomm5 digital datacomm
5 digital datacomm
 

KĂŒrzlich hochgeladen

Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
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
 
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
 
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
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
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
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
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
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
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
 
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
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 

KĂŒrzlich hochgeladen (20)

Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
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
 
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)
 
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
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
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
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.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
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
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
 
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
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
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
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 

Chapter5 dek3133

  • 1. Chapter 5 PIC Interfacing
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. Analog to digital conversion (cont..) 16C7X device specifications
  • 8.
  • 9. Analog to digital conversion (cont..) Memory map of PIC 16C711 BANK0 BANK1
  • 10.
  • 11.
  • 12.
  • 13. Analog to digital conversion (cont..) ADCON0 register ADCS1 ADCS0 - CHS1 CHS0 GO/DONE - ADON Bit 7 Bit 0 1 = A/D on 2 = A/D off 1 = A/D in progress 0 = A/D finished Analog channel select 00 = channel 0, AN0 01 = channel 1, AN1 10 = channel 2, AN2 11 = channel 3, AN3
  • 14.
  • 15. Analog to digital conversion (cont..) Bit 7 Bit 0 A/D Port Configuration bits ADCON1 Register ADCON1 Port configuration - - - - - - PCFG1 PCFG0 Vdd D D D D 11 Vdd D D A A 10 A3 Vref A A A 01 Vdd A A A A 00 Ref A3 A2 A1 A0 PCFG
  • 16.
  • 17.
  • 18.
  • 19.
  • 20. Serial Communication (cont..) Pin designations on RS232 connector (Ring Indicator) 9. RI (Clear To Send) 8. CTS (Request To Send) 7. RTS (Data Set Ready) 6. DSR (Ground) 5. GND (Data terminal Ready) 4. DTR (Transmit Data) 3. TXD (Receive Data) 2. RXD (Carrier Detect) 1. CD
  • 21.
  • 22. Serial Communication (cont..) Connecting a microcontroller to a PC via a MAX232 line interface chip Program Example
  • 23.
  • 24.
  • 25.
  • 26. Pulse Width Modulation (PWM) – (Cont..) Figure 1
  • 27. Pulse Width Modulation (PWM) – (Cont..) list p= 16f84 ;************************************************************* PORTB EQU 0x06 ; port b equate duty EQU 0x0c ; length of duty cycle temp EQU 0x0d ; length of duty cycle ;************************************************************* c EQU 0 ; status bit to check after subtraction ;************************************************************* ORG 0x000 The only equate of signifficance here is PWM. This register will be used to store the length of the PWM signal to be generated.
  • 28. Pulse Width Modulation (PWM) – (Cont..) The next portion of code contains the actual instructions that tell the PIC what to do. start MOVLW 0x00 ;load W with 0x00 make port B output TRIS PORTB ;copy W tristate to port B outputs MOVLW 0x00 ;fill w with zeroes MOVWF PORTB ;set port b outputs to low These lines ;set up port B as outputs. ;All outputs are then set to low. rstrt MOVLW d'0' MOVWF PORTB MOVLW d'157' ;Duty cycle length movwf duty After setting up the ports, the main loop is begun. At the beginning of the main loop, all port b pins are set to low just incase they are high when they shouldn't be. The duty cycle is then set to 157 (a 50% duty cycle. 255 corresponds to 100% and 0 corresponds to 0%).
  • 29. Pulse Width Modulation (PWM) – (Cont..) b0loop MOVF duty,w MOVWF temp BSF PORTB ,0 pwma NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP DECFSZ temp GOTO pwma
  • 30. Pulse Width Modulation (PWM) – (Cont..) The next bit of code is the loop for the PWM signal generated at pin B0. The pwm1a loop generates the high portion of the PWM signal. The duty cycle is stored in temp and then the pin is set high. after a pause, temp is decremented and so long as it doesnt reach zero the pause is repeated and temp is decremented again. After temp reaches zero, the code continues.
  • 31. Pulse Width Modulation (PWM) – (Cont..) MOVLW d'255 ' MOVWF temp MOVF duty,w SUBWF temp,f BCF PORTB ,0 pwmb NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP
  • 32. Pulse Width Modulation (PWM) – (Cont..) DECFSZ temp GOTO pwmb GOTO rstrt END The next portion of code generates the low part of the PWM signal. The value 255 is stored in temp, and the duty cycle is subtracted from this. This gives the remaining length of signal to be generated. Temp is then decremented in the same manner as above, this time with B0 set to low. Once the entire PWM signal has been generated, the code repeats. This code causes a PWM signal to be generated with a duty cycle proportional to the value set. The frequency of the signal can also be adjusted by varying the delay (the number of nop's used).
  • 33.
  • 34.