C:\seminario\guiao_aluno\trab6\trab6.asm

Documentos relacionados
C:\seminario\guiao_aluno\trab9\trab9p2\trab9VoltUart.asm

Guia de Trabalhos Práticos do Professor

BANKSEL ADCON1 clrf ADCON1 bsf ADCON1,ADFM ; seta AD para VCC, GND e entradas analogicas, setando o bit ADFM configura como justificado a direita

INTRODUÇÃO AOS SISTEMAS EMBEBIDOS

Arquitetura de Computadores. Prof. João Bosco Jr.

Eder Terceiro. Programação C com o PIC16F628a. Eder Terceiro. 31 de Outubro de 2016

6. Estrutura do Programa em Assembly

Servo-Motor. por. Nuno Monteiro & Gabriel Dinis Eng. Electrotécnica, UTAD Junho de nuno_monteiro@portugalmail.com gabrieldinis@portugalmail.

OMPLAB é um programa para PC, que roda sobre a

Sequencial Supermáquina (TEMPORIZAÇÃO SIMPLES)

Marcelo Fernandes Valter Rodrigues de Jesus Junior. Thermal Control

MICROCONTROLADORES PIC PRIMEIROS PASSOS

Introdução ao PIC. Guilherme Luiz Moritz 1. 6 de novembro de DAELT - Universidade Tecnológica Federal do Paraná

01. Identifique o conjunto de portas de entrada A e o conjunto de portas B na figura abaixo.

Interrupção Externa. Capítulo 1. Noções básicas sobre interrupções em Microcontroladores PIC

ENGENHARIA ELECTROTÉCNICA. 2º Semestre 2015/2016 FUNDAMENTOS DE MICROPROCESSADORES (XX DIA/NOITE) 2ª FREQUÊNCIA - TIPO

Guia de Trabalhos Práticos do Aluno

1.1 Noções básicas sobre interrupções em Microcontroladores

PIC. PeripheralInterface Controller. Prof. EngºespLuiz Antonio Vargas Pinto Prof. Vargas

V1 5V +V. (14)Vdd (6)RB0 PIC 16F628A. (16) Clk-out. C1 33pF. C2 33pF. Figura 1 Circuito pisca-pisca.

Sistemas Microcontrolados. Período Aula 6. 1 Saulo O. D. Luiz

MICROCONTROLADORES E MICROPROCESSADORES APOSTILA 01

Microcontroladores. 1 Microprocessadores x Microcontroladores Microprocessadores: Microcontroladores: 2 Microcontrolador x DSP

Sistemas Microcontrolados

Sistemas Digitais e Microcontrolados

Utilize o programa fonte em linguagem assembly abaixo para responder as questões seguintes.

Placa McLab1 Upgrade PIC16F84A p/ PIC16F62x

Sistemas Digitais e Microcontrolados

Microcontrolador PIC 16F877

Microprocessadores. Cap. 4 Assembly

Hardware Parte I. Fábio Rodrigues de la Rocha

Sistemas Microcontrolados. Período Aula 4. 1 Saulo O. D. Luiz

Construção de Robôs Jogadores de Futebol (2ª Parte)

OMódulo Comparador Analógico consiste em um conjunto

MEC MINISTÉRIO DA EDUCAÇÃO SECRETARIA DE EDUCAÇÃO MÉDIA E TECNOLÓGICA CENTRO FEDERAL DE EDUCAÇÃO TECNOLÓGICA DO ESPÍRITO SANTO

Curso PIC 1 Desbravando o PIC. Eng. Diego Camilo Fernandes Labtools Mosaico Didactic Division

PIC16F628a. Pinagem do PIC16F628a:

PONTIFÍCIA UNIVERSIDADE CATÓLICA DO PARANÁ ESCOLA POLITÉCNICA ENGENHARIA DE COMPUTAÇÃO MICROPROCESSADORES PROJETO PARDAL DOCUMENTAÇÃO

Manual do Usuário. McMaster Desenvolvimento de Sistemas com Microcontroladores PIC

1.1. Microprocessadores e microcontroladores Sistemas genéricos e sistemas dedicados. 2. Microcontrolador PIC:

OMicrocontrolador PIC16F877A implementa um conversor

Fundamentos de Microprocessadores 2006/2007 1º Ano Eng. Electrotécnica (Bolonha) 1º Exame (14/07/2007)

INSTITUTO DE TECNOLOGIA EMERSON MARTINS

MICROCONTROLADORES O QUE É O PIC?

MICROCONTROLADORES - PIC 16F84/16F84A/16F628/16F628A

Introdução aos Microcontroladores PIC

ARQUITETURA DE PROCESSAMENTO

7. Técnicas de Programação

Curso de Microcontroladores PIC 16F84A

2 - Considere a seguinte figura que representa uma parte dos componentes básicos de um microprocessador:

Acetatos de apoio às aulas teóricas

Experiência. Montagem Kit Didático. 2. Turma: Nota: 5. MICRO-I Prof. Mauricio. Identificação dos Alunos:

Microcontrolador PIC 16F877

PROGRAMAÇÃO DE UM MICROPROCESSADOR

LBM-UMA PROPOSTA DE LINGUAGEM BÁSICA ESTRUTURADA PARA PROGRAMAÇÃO DE MICROCONTROLADORES NOS CURSOS DE ENGENHARIA.

SEMINÁRIO ASSEMBLY: Arquitetura PIC

Sistemas Microcontrolados

5. Conjunto de Instruções do MCU PIC

Kit Clp Pic 40B Manual do usuário. Manual do usuário - Kit Clp Pic 40B v2.0. Copyright VW Soluções

Plano de Trabalho Docente 2017 Ensino Técnico

DOUGLAS DAL POZZO DIEGO VITTI

PONTIFÍCIA UNIVERSIDADE CATÓLICA DO PARANÁ PUC-PR CCET CENTRO DE CIÊNCIAS EXATAS E DE TECNOLOGIA ENGENHARIA DE COMPUTAÇÃO. Luiz Renato Hey Schmidt

Sistemas Digitais e Microcontrolados

Programação em Linguagem Assembly

Transferência de dados via rede elétrica baseado no protocolo X-10

SISTEMA DE AUXÍLIO A DEFIFIENTES AUDIOVISUAIS

Solução por Software para Implementar PWM em qualquer Microcontrolador PIC

UNIVERSIDADE FEDERAL DE SÃO JOÃO DEL-REI - UFSJ DEPARTAMENTO DE ENGENHARIA ELÉTRICA - DEPEL INTRODUÇÃO AOS MICROCONTROLADORES PIC

Solução por Software para Implementar PWM em qualquer Microcontrolador PIC

Um projeto de robô bípede para o ensino de engenharia

Microcontrolador 16F84A

Copyright 2014 VW Soluções

Parte 9 PRÁTICAS DISPLAY DE 7 SEGMENTOS DISPLAY DE 7 SEGMENTOS DISPLAY DE 7 SEGMENTOS DISPLAY DE 7 SEGMENTOS DISPLAY DE 7 SEGMENTOS

Copyright 2013 VW Soluções

Programação Daniel Corteletti Aula 3 Parte III Página 1/7

Manual do usuário. - Kit Clp Pic 40 v4.0. Manual do usuário. Copyright VW Soluções

Palestra de Tecnologia. Assunto: Microcontroladores.

PONTIFÍCIA UNIVERSIDADE CATÓLICA DO PARANÁ CENTRO DE CIÊNCIAS EXATAS E DE TECNOLOGIA CURSO DE ENGENHARIA DE COMPUTAÇÃO MICROPROCESSADORES II

Parte 11 PROVAS ANTERIORES

Guia o MPLAB IDE (v8.92)

ENG-1450 Microcontroladores e Sistemas Embarcados. Lab03 Execução Experiência 01, Keypad, 7-seg, Exercícios

OMicrocontrolador PIC16F877A apresenta dois módulos

22:43. MIC29004 Microprocessadores. Microcontroladores. Microcontroladores. Microcontroladores. Microcontroladores

MICROCONTROLADORES. PIC16F87x

Guia o MPLAB IDE (v8.92)

Sistemas Microcontrolados. Período Aula 9. 1 Saulo O. D. Luiz

INTRODUÇÃO AO ARDUINO DUE, CANAL DIGITAL, FUNÇÃO DELAY

1. Microcontrolador PIC. 1.1 Introdução

Guia o MPLAB IDE (v8.92)

2 1. A área de programa e o registrador de arquivo

Copyright 2013 VW Soluções

Exemplos de Programas em C para o 8051 para o compilador crossware EEL Prof. Raimes Moraes

UM COMPILADOR PORTUGOL-ASSEMBLY PARA MICROCONTROLADOR

SEL0338 Tópicos Especiais em Sistemas Digitais

TEM VÁRIOS ESTADOS: 0V,0.1V,3V,3.3V,4V,5V,10V, ETC.

Estudo de Programação em PIC16F84

EEC2104 Microprocessadores

Cerne. Conhecimento para o Desenvolvimento (21) (11) MSN:

Programação em BASIC para o PIC Vitor Amadeu Souza

Parte 7 ASSEMBLER. ; Programa 2 Vazio end ;fim OP. LÓGICAS E ARITMÉTICAS OP. LÓGICAS E ARITMÉTICAS OPERAÇÕES LÓGICAS E ARITMÉTICAS

Transcrição:

Trabalho nº 6 Semáforo Rodoviário (automóveis & peões) ******************************************************************** NomeFicheiro: trab6.asm * Data: 3/Junho/2005 * Versão: 1.0 * Autores: José Miguel Gaspar * Olímpia Rodrigues * Orientador: Prof. José Luís Azevedo * Universidade de Aveiro * Seminário EEI 2004/2004 * ******************************************************************** Ficheiro necessário: P16F876.LKR * ******************************************************************** list p=16f876 list directive to define radix decimal processor #include "p16f876.inc" processor specific variable definitions errorlevel -302 Turn off banking message known tested (good) code Constantes RB0 EQU 0 RB1 EQU 1 RB2 EQU 2 RB3 EQU 3 RB4 EQU 4 RB5 EQU 5 RB6 EQU 6 RB7 EQU 7 RA0 EQU 0 RA1 EQU 1 RA2 EQU 2 RA3 EQU 3 RA4 EQU 4 RA5 EQU 5 RA6 EQU 6 RA7 EQU 7 TMR0_SFW_VAL EQU 50 Set Software timer0_count Value TMR0_HW_VAL EQU 60 Set Hardware timer0 Value Constantes de tempo de espera nos estados em unidades de 0,5 seg t_verd2amar_a EQU 3 tempo,s1 = 1,5s t_amar2verm_a EQU 2 tempo,s2 = 1s t_verde_p EQU 8 tempo,s3 = 4s t_verd_interm EQU 6 tempo,s4 = 3s t_verm_a_p EQU 3 tempo,s5 = 1,5s == Definicoes - PORTA == INPUTS SW1 EQU RA4 SW1 está ligado a RA4 Definicoes - PORTB OUTPUTS 1

LED_VERM_A EQU RB1 LED1 está ligado a RB1 LED_AMAR_A EQU RB2 LED2 está ligado a RB2 LED_VERD_A EQU RB3 LED3 está ligado a RB3 LED_VERM_P EQU RB4 LED4 está ligado a RB4 LED_VERD_P EQU RB5 LED5 está ligado a RB5 Variaveis variaveis UDATA 0x20 delay_mult RES 1 Variaveis de controlo dos loops delay_k50 RES 1 da rotina Delay delay_k200 RES 1 conta_verd2amar_a RES 1 conta_amar2verm_a RES 1 conta_verde_p RES 1 conta_verd_interm RES 1 conta_verm_a_p RES 1 estado RES 1 timer0_cnt RES 1 Macros to select the register Banks Bank0 MACRO Macro to select data RAM Bank 0 bcf STATUS,RP0 bcf STATUS,RP1 Bank1 MACRO Macro to select data RAM Bank 1 bsf STATUS,RP0 bcf STATUS,RP1 Bank2 MACRO Macro to select data RAM Bank 2 bcf STATUS,RP0 bsf STATUS,RP1 Bank3 MACRO Macro to select data RAM Bank 3 bsf STATUS,RP0 bsf STATUS,RP1 Macros to select the states macro_inicial MACRO Macro to select state 0 bsf PORTB,LED_VERD_A LED VERDE AUTOMOVEIS ON bcf PORTB,LED_AMAR_A LED AMARELO AUTOMOVEIS OFF bcf PORTB,LED_VERM_A LED VERMELHO AUTOMOVEIS OFF bcf PORTB,LED_VERD_P LED VERDE PEOES OFF bsf PORTB,LED_VERM_P LED VERMELHO PEOES ON macro_verd2amar_a MACRO Macro to select state 1 bsf PORTB,LED_AMAR_A LED AMARELO AUTOMOVEIS ON bcf PORTB,LED_VERM_A LED VERMELHO AUTOMOVEIS OFF bcf PORTB,LED_VERD_P LED VERDE PEOES OFF bsf PORTB,LED_VERM_P LED VERMELHO PEOES ON macro_amar2verm_a MACRO Macro to select state 2 bcf PORTB,LED_AMAR_A LED AMARELO AUTOMOVEIS OFF bsf PORTB,LED_VERM_A LED VERMELHO AUTOMOVEIS ON bcf PORTB,LED_VERD_P LED VERDE PEOES OFF bsf PORTB,LED_VERM_P LED VERMELHO PEOES ON macro_verde_p MACRO Macro to select state 3 bcf PORTB,LED_AMAR_A LED AMARELO AUTOMOVEIS OFF bsf PORTB,LED_VERM_A LED VERMELHO AUTOMOVEIS ON bsf PORTB,LED_VERD_P LED VERDE PEOES ON 2

bcf PORTB,LED_VERM_P LED VERMELHO PEOES OFF macro_verd_interm MACRO Macro to select state 4 bcf PORTB,LED_AMAR_A LED AMARELO AUTOMOVEIS OFF bsf PORTB,LED_VERM_A LED VERMELHO AUTOMOVEIS ON bsf PORTB,LED_VERD_P LED VERDE PEOES ON bcf PORTB,LED_VERM_P LED VERMELHO PEOES OFF macro_verm_a_p MACRO Macro to select state 4 bcf PORTB,LED_AMAR_A LED AMARELO AUTOMOVEIS OFF bsf PORTB,LED_VERM_A LED VERMELHO AUTOMOVEIS ON bcf PORTB,LED_VERD_P LED VERDE PEOES OFF bsf PORTB,LED_VERM_P LED VERMELHO PEOES ON ******************************************************************** ORG 0x0000 Processor reset vector clrf PCLATH Ensure page bits are cleared goto main Go to beginning of program -------------------------------------------------------------------- Rotina Main -------------------------------------------------------------------- ORG 0x0005 main Programa principal. call InitCfg loop do{ btfss INTCON,T0IF while(toif == 0){} goto $-1 bcf INTCON,T0IF T0IF = 0 movlw TMR0_HW_VAL Set Hardware timer0 Value movwf TMR0 Set TMR0 decfsz timer0_cnt,f if(timer0_cnt == 0) movlw d'50' movwf TMR0_SFW_VAL timer0_cnt = 100 while( timer0_cnt!=0 ) switch w = estado sublw 0x00 goto estado_inicial sublw 0x01 goto estado_verd2amar_a sublw 0x02 goto estado_amar2verm_a sublw 0x03 goto estado_verde_p sublw 0x04 goto estado_verd_interm sublw 0x05 nop goto estado_verm_a_p estado_inicial estado inicial macro_inicial btfsc PORTA,SW1 while(sw1 == 0) {} goto estado_inicial 3

estado_verd2amar_a estado_amar2verm_a C:\seminario\guiao_aluno\trab6\trab6.asm incf estado,f estado++ movlw t_verd2amar_a movwf conta_verd2amar_a movlw t_amar2verm_a movwf conta_amar2verm_a movlw t_verde_p movwf conta_verde_p movlw t_verd_interm movwf conta_verd_interm movlw t_verm_a_p movwf conta_verm_a_p goto loop break macro_verd2amar_a decfsz conta_verd2amar_a,f if (count_amar_a == 0) incf estado,f estado++: goto loop break macro_amar2verm_a decfsz conta_amar2verm_a,f if (count_verm_a == 0) incf estado,f estado++: goto loop break estado_verde_p macro_verde_p decfsz conta_verde_p,f if (count_verd_p == 0) incf estado,f estado++: goto loop break estado_verd_interm macro_verd_interm led verde peoes on btfss conta_verd_interm,0 goto off_led bsf PORTB,LED_VERD_P goto fim off_led bcf PORTB,LED_VERD_P fim decfsz conta_verd_interm,f if (count_inter_p == 0) goto loop incf estado,f goto loop estado_verm_a_p macro_verm_a_p decfsz conta_verm_a_p,f if (count_verd_p == 0) clrf estado estado=0 goto loop break =================================================================== InitCfg Configuração inicial dos registros associados ao programa principal Retorna em Bank0 =================================================================== InitCfg ----------------- Analog 2 Digital - InitCfg ---------------------- Bank1 DATA memory (RAM) Bank1 movlw 0x06 W = 0x06 movwf ADCON1 ADCON1 (PORTA I/O digital) ----------------- I/O - InitCfg ----------------------------------- movlw b'0001000' R4 inputs movwf TRISA movlw b'1100000' R[5:0] outputs movwf TRISB R[7:6] inputs ----------------- TRM0 - InitCfg ---------------------------------- clrf OPTION_REG clear OPTION_REG bsf OPTION_REG,PS2 bsf OPTION_REG,PS1 TMR0 Rate bsf OPTION_REG,PS0 1:256 4

Bank0 DATA memory (RAM) Bank0 clrf estado estado = 0 clrf PORTA Inicialização PORTA --------------------------------------------------------------------------- Programação do Timer0 --------------------------------------------------------------------------- movlw TMR0_HW_VAL Set Hardware timer0 Value movwf TMR0 Set TMR0 movlw TMR0_SFW_VAL Set Software timer0_count Value movwf timer0_cnt Save time0_count adjust return END 'end of program' 5