SlideShare una empresa de Scribd logo
1 de 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]

Más contenido relacionado

La actualidad más candente

La actualidad más candente (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
 

Similar a 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
 
adcanddac hai kya bhayy me know if-01.pptx
adcanddac hai kya bhayy me know if-01.pptxadcanddac hai kya bhayy me know if-01.pptx
adcanddac hai kya bhayy me know if-01.pptxshivraj3252
 
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 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
 
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
 

Similar a 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)
 
adcanddac hai kya bhayy me know if-01.pptx
adcanddac hai kya bhayy me know if-01.pptxadcanddac hai kya bhayy me know if-01.pptx
adcanddac hai kya bhayy me know if-01.pptx
 
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
 

Más de Hattori Sidek

Más de 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
 

Último

JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 

Último (20)

JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 

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.