SlideShare a Scribd company logo
1 of 9
;*****************************************************************************
***********
;*
;*
; AUTORES: CAMILA ANDREA DURÁN
;* MICRO: PIC 16F877A *
;* OSCILADOR: 4 MHz *
;*
;*****************************************************************************
***********
;
;
LIST p=16F877A
#INCLUDE "p16F877A.inc" ; Se cargan instrucciones del microcontrolador a utilizar;
;
__CONFIG _CP_OFF&_PWRTE_ON&_WDT_OFF&_XT_OSC ; Configuracion
de fuses y frecuencia del cristal.
;
;
; ************* DECLARACIÓN DE VARIABLES
*******************************
;
CBLOCK 20
d0
d1
d2
d3
ENDC
;
;
; ******************** DEFINICIONES GENERALES
******************************
;
;
#DEFINE PA PORTB,0
#DEFINE PB PORTB,1
#DEFINE L1 PORTC,0
#DEFINE L2 PORTC,1
#DEFINE L3 PORTC,2
;#DEFINE
;-----------------------------------------------------------------------------------------
;
ORG 00 ; VECTOR DE RESET
GOTO INI_PUERTOS ;; Ir a programa Principal
;
;
;
______________________________________________________________________________
__________
;| |
;| Macros Y Etiquetas
;|_____________________________________________________________________________
___________|
; PROCESAR
; LEER
; EJECUTAR
;___________________
;; Terminacion Macros y etiquetas
;_____________________
;
;
;*****************************************************************************
*************
;* *
;* PROGRAMA PRINCIPAL *
;* *
;*****************************************************************************
*************
;
;
;;
______________________________________________________________________________
__________
;| |
;|Declaracion de puertos I/O
;|_____________________________________________________________________________
___________|
INI_PUERTOS
BCF STATUS, RP1
BSF STATUS, RP0 ; BANCO 1
BSF PA ; IN/OUT
BSF PB
BCF L1
BCFL2
BCFL3
BCFSTATUS, RP1
BCF STATUS, RP0 ; BANCO 0,
BCF L1
BCF L2
BCF L3
;
;
;
______________________________________________________________________________
__________
;|
CARGA
movlw b'10'
movwf d0
GOTO START
INICIO
BTFSSPA
GOTO START
DELAY
;1999996 cycles
movlw 0x11
movwf d1
movlw 0x5D
movwf d2
movlw 0x05
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;4 cycles
goto $+1
goto $+1
; -------------------------------------------------------------------------------------------
; TESTEO ON_OFF
BTFSS PA
GOTO INICIO
BTFSC L1
GOTO LED_OFF
BTFSC L2
GOTO LED_OFF
BTFSC L3
GOTO LED_OFF
BSF L1
GOTO INICIO
; -------------------------------------------------------------------------------------------
LED_OFF
BCF L1
BCF L2
BCF L3
GOTO INICIO
; -------------------------------------------------------------------------------------------
START ;Evaluo el pulsador B
BTFSSPB
GOTO INICIO
DELAY_L1
;9998 cycles
movlw 0xCF
movwf d1
movlw 0x08
movwf d2
Delay_1
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay_1
;2 cycles
goto $+1
; -------------------------------------------------------------------------------------------
; DOBLE CLICK
BTFSC PB
GOTO START
DECFSZ d0 ; Si es 0 significa que ya oprimio 2 veces el
pulsador.(En este punto d0 ya no tiene valor).
GOTO START
; -------------------------------------------------------------------------------------------
BTFSSL1
GOTO L1_L3
GOTO ON_L2
L1_L3
BTFSSL2
GOTO ON_L1
GOTO ON_L3
ON_L1
BTFSSL3
GOTO CARGA ; Esta condición me impide que el Pulsador B me
encienda el primer Led.(¡Linea esencial!)
BSF L1
BCF L2
BCF L3
GOTO CARGA
ON_L2
BSF L2
BCF L1
BCF L3 ; Esta linea es opcional, es para garantizar que
solo haya un led encendido al mismo tiempo.
GOTO CARGA
ON_L3
BSF L3
BCF L1
BCF L2
GOTO CARGA
; -------------------------------------------------------------------------------------------
;|
;|_______________________________________________________________________
_________________|
;
;
;
END

More Related Content

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Codigo para encender tres leds con dos pulsadores

  • 1. ;***************************************************************************** *********** ;* ;* ; AUTORES: CAMILA ANDREA DURÁN ;* MICRO: PIC 16F877A * ;* OSCILADOR: 4 MHz * ;* ;***************************************************************************** *********** ; ; LIST p=16F877A #INCLUDE "p16F877A.inc" ; Se cargan instrucciones del microcontrolador a utilizar; ; __CONFIG _CP_OFF&_PWRTE_ON&_WDT_OFF&_XT_OSC ; Configuracion de fuses y frecuencia del cristal. ; ; ; ************* DECLARACIÓN DE VARIABLES ******************************* ; CBLOCK 20 d0 d1 d2 d3 ENDC ; ;
  • 2. ; ******************** DEFINICIONES GENERALES ****************************** ; ; #DEFINE PA PORTB,0 #DEFINE PB PORTB,1 #DEFINE L1 PORTC,0 #DEFINE L2 PORTC,1 #DEFINE L3 PORTC,2 ;#DEFINE ;----------------------------------------------------------------------------------------- ; ORG 00 ; VECTOR DE RESET GOTO INI_PUERTOS ;; Ir a programa Principal ; ; ; ______________________________________________________________________________ __________ ;| | ;| Macros Y Etiquetas ;|_____________________________________________________________________________ ___________| ; PROCESAR ; LEER ; EJECUTAR
  • 3. ;___________________ ;; Terminacion Macros y etiquetas ;_____________________ ; ; ;***************************************************************************** ************* ;* * ;* PROGRAMA PRINCIPAL * ;* * ;***************************************************************************** ************* ; ; ;; ______________________________________________________________________________ __________ ;| | ;|Declaracion de puertos I/O ;|_____________________________________________________________________________ ___________| INI_PUERTOS BCF STATUS, RP1 BSF STATUS, RP0 ; BANCO 1 BSF PA ; IN/OUT BSF PB BCF L1 BCFL2
  • 4. BCFL3 BCFSTATUS, RP1 BCF STATUS, RP0 ; BANCO 0, BCF L1 BCF L2 BCF L3 ; ; ; ______________________________________________________________________________ __________ ;| CARGA movlw b'10' movwf d0 GOTO START INICIO BTFSSPA GOTO START DELAY ;1999996 cycles movlw 0x11 movwf d1
  • 5. movlw 0x5D movwf d2 movlw 0x05 movwf d3 Delay_0 decfsz d1, f goto $+2 decfsz d2, f goto $+2 decfsz d3, f goto Delay_0 ;4 cycles goto $+1 goto $+1 ; ------------------------------------------------------------------------------------------- ; TESTEO ON_OFF BTFSS PA GOTO INICIO BTFSC L1 GOTO LED_OFF BTFSC L2 GOTO LED_OFF BTFSC L3
  • 6. GOTO LED_OFF BSF L1 GOTO INICIO ; ------------------------------------------------------------------------------------------- LED_OFF BCF L1 BCF L2 BCF L3 GOTO INICIO ; ------------------------------------------------------------------------------------------- START ;Evaluo el pulsador B BTFSSPB GOTO INICIO DELAY_L1 ;9998 cycles movlw 0xCF movwf d1 movlw 0x08 movwf d2 Delay_1 decfsz d1, f
  • 7. goto $+2 decfsz d2, f goto Delay_1 ;2 cycles goto $+1 ; ------------------------------------------------------------------------------------------- ; DOBLE CLICK BTFSC PB GOTO START DECFSZ d0 ; Si es 0 significa que ya oprimio 2 veces el pulsador.(En este punto d0 ya no tiene valor). GOTO START ; ------------------------------------------------------------------------------------------- BTFSSL1 GOTO L1_L3 GOTO ON_L2 L1_L3 BTFSSL2 GOTO ON_L1 GOTO ON_L3 ON_L1
  • 8. BTFSSL3 GOTO CARGA ; Esta condición me impide que el Pulsador B me encienda el primer Led.(¡Linea esencial!) BSF L1 BCF L2 BCF L3 GOTO CARGA ON_L2 BSF L2 BCF L1 BCF L3 ; Esta linea es opcional, es para garantizar que solo haya un led encendido al mismo tiempo. GOTO CARGA ON_L3 BSF L3 BCF L1 BCF L2 GOTO CARGA ; ------------------------------------------------------------------------------------------- ;| ;|_______________________________________________________________________ _________________| ; ;