.
;********************************************************************************
.MESSAGE "Rótulos criados."
;
;*******************************************************************************
.MESSAGE "*****************************************"
.MESSAGE "* Dato: " __DATE__ "/ Horo: " __TIME__".....*"
.MESSAGE "*****************************************"
.MESSAGE "* Versão: 1.1.6 *"
.MESSAGE "*****************************************"
.MESSAGE "* PLANISTO: UBIRATÃ UAATSIM ITZÁ I *"
.MESSAGE "*****************************************"
;********************************************************************************
;
;
;
;********************************************************************************
.MESSAGE "valores fixos dos rótulos fornecidos pelo fabricante."
.INCLUDE "m32def.inc" ; define o hardware *
;********************************************************************************
;* Esta é a configuração dos bits do hardware para este circuito. *
;********************************************************************************
;* PDIP - 40 *
;* *
;* PB 0 (XCK/T0) PB0 PA0 (ADC0) TRM *
;* PB 1 (T1) PB1 PA1 (ADC1) LDR *
;* PB 2 (INT2/AIN0) PB2 PA2 (ADC2) ELETR *
;* PB 3 (OC0/AIN1) PB3 PA3 (ADC3) PONTA *
;* PB 4 (SS) PB4 PA4 (ADC4) PA 4 *
;* PB 5 (MOSI) PB5 PA5 (ADC5) linha *
;* PB 6 (MISO) PB6 PA6 (ADC6) *
;* PB 7 (SCK) PB7 PA7 (ADC7) wp *
;* #RESET AREF # *
;* #VCC GND # *
;* #GND AVCC # *
;* #XTAL2 PC7 (TOSC2) X2-B *
;* #XTAL1 PC6 (TOSC1) X2-A *
;* RxD (RXD) PD0 PC5 (TDI) LCD_RS *
;* TxD (TXD) PD1 PC4 (TDO) LCD_EN *
;* PD 2 (INT0) PD2 PC3 (TMS) SER_dado *
;* int_tcl (INT1) PD3 PC2 (TCK) SER_clk *
;* PD 4 (OC1B) PD4 PC1 (SDA) sda *
;* PD 5 (OC1A) PD5 PC0 (SCL) scl *
;* PD 6 (ICP1) PD6 PD7 (OCR2) BUZZER *
;*----------------------------------------------------------------------------*
;* 1 = saída e 0 = entrada *
;********************************************************************************
;
;
;
;********************************************************************************
.MESSAGE "valores fixos dos endereços de inicialização."
.EQU VETOR_INT = 0x0000 ; posição zero da flash *
.EQU APLICATIVO_INI = SPMRaddr + 4 ; último vetor mais quatro *
;********************************************************************************
;
;
;
;********************************************************************************
.MESSAGE "valores fixos dos caracteres indicadores de final de linha e tabela."
.EQU f_EOT = 0x01 ; final da tabela
.EQU f_SOH = 0x02 ; era 0, final da cadeia
;********************************************************************************
.MESSAGE "Ativando os rótulos: 74164_CLK=PC2, 74164_DAD=PC3, LCD_EN=PC4 e LCD_RS=PC5"
.EQU ES_74164_CLK = PORTC
.EQU ES_74164_DAD = PORTC
.EQU ES_LCD_EN = PORTC
.EQU ES_LCD_RS = PORTC
;
.EQU SAIDA_A = PORTA ; *
.EQU SAIDA_B = PORTB ; *
;
.EQU BIT_74164_CLK = 0b00000100 ; PC2 4
.EQU BIT_74164_DAD = 0b00001000 ; PC3 8
.EQU BIT_LCD_EN = 0b00010000 ; PC4 16
.EQU BIT_LCD_RS = 0b00100000 ; PC5 32
.EQU f_CNFG_B = 0b11111111 ; tudo como saída
.EQU f_DADO_B = 0b00000000
.EQU f_CNFG_C = 0b11111111 ; tudo como saída
.EQU f_DADO_C = 0b00111110
.EQU f_GICR = 0b10000000 ; só INT 1 habilitada
.EQU f_CNFG_A = 0b11111111 ; tudo como entrada
.EQU f_DADO_A = 0b00000000
;********************************************************************************
;
;
;
;********************************************************************************
.MESSAGE "valores fixos dos IDs das mensagens."
.EQU f_padrao = f_SOH + 1 ; tem que ser no mímimo 4, 1 a mais que SOH.
;********************************************************************************
.IFDEF __tab_inicial__
.MESSAGE "A tabela TAB_INI."
.EQU MSG_empre = f_padrao + 0
.EQU MSG_autor = f_padrao + 1
.EQU MSG_ambie = f_padrao + 2
.EQU MSG_curso = f_padrao + 3
.ENDIF
;--------------------------------------------------------------------------------
.IFDEF __tab_opcao__
.MESSAGE "A tabela TAB_OPC."
.EQU MSG_opcopco = f_padrao + 0
.EQU MSG_opccada = f_padrao + 1
.EQU MSG_opcloga = f_padrao + 2
.EQU MSG_opcconf = f_padrao + 3
.EQU MSG_opcroti = f_padrao + 4
.EQU MSG_opcsobr = f_padrao + 5
.EQU MSG_opcajud = f_padrao + 6
.EQU MSG_opcsair = f_padrao + 7
.ENDIF
;******************************************************************************
;
;
;
;
;DEFINIÇÕES
;********************************************************************************
.MESSAGE "valores fixos dos retardos."
.MESSAGE "Ativando o RETARDO..."
.EQU f_RETARDO = 120 ; 4 = mínimo para não dar erro, erra: 155
.EQU f_HUMANA = 120
.EQU f_CONT = 60
.EQU f_LCD_RTD = 20
;********************************************************************************
;
;
;
;********************************************************************************
;* Descrição: uso geral
;* Quando faz-se E-lógico quer zerar o bit.
;* Quando faz-se Ou-lógico quer deixar em um o bit.
;* Nomenclatura: máscara_bits_operaçãoLógica
;*
;* Ekzemploj: masc_7_Ou = 0b0111 1111
;* masc_0_Ou = 0b1111 1110
;* masc_7_E = 0b1000 0000
;* masc_3_E = 0b0000 1000
;********************************************************************************
.EQU masc_E_2 = 0b11111011
.EQU masc_E_3 = 0b11110111
.EQU masc_E_4 = 0b11101111
.EQU masc_E_5 = 0b11011111
.EQU masc_E_23 = 0b11110011
.EQU masc_Ou_2 = 0b00000100
.EQU masc_Ou_3 = 0b00001000
.EQU masc_Ou_4 = 0b00010000
.EQU masc_Ou_5 = 0b00100000
.EQU masc_Ou_7 = 0b10000000
.EQU masc_Ou_23 = 0b00001100
.EQU masc_E_2345 = 0b11000011
.EQU masc_Ou_2345 = 0b00111100
;********************************************************************************
;
;
;
;********************************************************************************
;DDxn PORTxn PUD(in SFIOR) I/O Pull-up Comment
;0 0 X Input No Tri-state (Hi-Z)
;0 1 0 Input Yes Pxn will source current if ext. pulled low.
;0 1 1 Input No Tri-state (Hi-Z)
;1 0 X Output No Output Low (Sink)
;1 1 X Output No Output High (Source)
;********************************************************************************
.EQU SAIDA_C = PORTC
;********************************************************************************
;
;
;
;********************************************************************************
.EQU L1Cx = 0x80 ; *
.EQU L2Cx = 0xC0 ; *
;--------------------------------------------------------------------------------
.MESSAGE "valores fixos das Linhas e colunas do visor."
.EQU f_L1C1 = L1Cx + 0
.EQU f_L2C1 = L2Cx + 0
;********************************************************************************
;
;
;
;********************************************************************************
.MESSAGE "Instalado a macro PUSH."
.MACRO MACRO_push ; inicia a definição da macro
cli
push r0
in r0,SREG
push r0
push r1
push r2
push r3
push r4
push r5
push r6
push r7
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
;
push r16
push r17
push r18
push r19
push r20
push r21
push r22
push r23
push r24
push r25
push r26 ; X
push r27
push r28 ; Y
push r29
push r30 ; Z
push r31
.ENDMACRO
;********************************************************************************
;
;
;
;********************************************************************************
.MESSAGE "Instalado a macro POP."
.MACRO MACRO_pop ; inicia a definição da macro
pop r31 ; Z
pop r30
pop r29 ; Y
pop r28
pop r27 ; X
pop r26
pop r25
pop r24
pop r23
pop r22
pop r21
pop r20
pop r19
pop r18
pop r17
pop r16
;
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop r7
pop r6
pop r5
pop r4
pop r3
pop r2
pop r1
pop r0
out SREG,r0
pop r0
.ENDMACRO
;********************************************************************************
;
;
;
;************* Inserir no arquivo de definições (definicao.inc). ****************
;
;
;********************************************************************************
.IFDEF __CI_TIPO_P__ ; *
.MESSAGE "Definido o CI PCF8574 como tipo P (4X)" ; 0x70 não funciona no simulador *
;* *
.EQU f_dds_E = 0x40 ; 0100 0 0 0 r/-w rs -w/r en luz lcd - klvr beep
.EQU f_dds_L = 0x41 ; 0100 0 0 0 r/-w
.EQU f_vsr_E = 0x42 ; 0100 0 0 1 r/-w
.EQU f_vsr_L = 0x43 ; 0100 0 0 1 r/-w
.EQU f_lds_E = 0x44 ; 0100 0 1 0 r/-w
.EQU f_lds_L = 0x45 ; 0100 0 1 0 r/-w
.EQU f_klvr_E = 0x4E ; 0100 1 1 1 r/-w
.EQU f_klvr_L = 0x4F ; 0100 1 1 1 r/-w
;*
.ELSE
.MESSAGE "Definido os endereços do CI PCF8574 como tipo A (7x)." ; *
.EQU f_dds_E = 0x70 ; 0111 0 0 0 r/-w
.EQU f_dds_L = 0x71 ; 0111 0 0 0 r/-w
.EQU f_vsr_E = 0x72 ; 0111 0 0 1 r/-w
.EQU f_vsr_L = 0x73 ; 0111 0 0 1 r/-w
.EQU f_lds_E = 0x74 ; 0111 0 1 0 r/-w
.EQU f_lds_L = 0x75 ; 0111 0 1 0 r/-w
.EQU f_klvr_E = 0x7E ; 0111 1 1 1 r/-w
.EQU f_klvr_L = 0x7F ; 0111 1 1 1 r/-w
;* *
.ENDIF
;*;------------------------------------------------------------------------------
.IFDEF __CI_8574__
.MESSAGE "Ativando as máscaras do CI PCF8574."
;* *
.EQU f_mscr_s = 0x08
.EQU f_mscr_ack = 0x18
.EQU f_mscr_dado = 0x28
.EQU f_mscr_limpa = 0xF8
.EQU f_mscr_nack = 0xC0
;*
.EQU f_mscr_a1 = 0x40
.EQU f_mscr_a2 = 0x50
.EQU f_mscr_leNA = 0x58
;* *
;* ;.equ mscr_38 = 0x38 ; para 8 bits
;* ;.equ mscr_50 = 0x50 ; para 16 bits
.EQU f_mscr_sr = 0x10
.EQU f_twi_tempo = 32 ; *
;* *
.EQU f_desligados = 0
.EQU f_ligados = 0xFF
;* *
.ELSE
.MESSAGE "Sem o CI PCF8574."
.ENDIF
;******************************************************************************
;
;
;
;********************************************************************************
;* Disposição das teclas no CI 8574-x *
;* *
;* DADO KLAVO VALOR LIDO *
;* 0 Aceitar FE *
;* 1 Cancelar FD *
;* 2 Cima FB *
;* 3 Baixo F7 *
;* 4 Avança EF *
;* 5 Retroceda DF *
;* 6 Mais BF *
;* 7 Menos 7F *
;********************************************************************************
.IFDEF __klavaro_8574__ ; *
.MESSAGE "Definindo os fixos da klavaro" ; *
.EQU f_klvace_tst = 0b11111110
.EQU f_klvcan_tst = 0b11111101
.EQU f_klvcim_tst = 0b11111011
.EQU f_klvbai_tst = 0b11110111
.EQU f_klvava_tst = 0b11101111
.EQU f_klvret_tst = 0b11011111
.EQU f_klvmai_tst = 0b10111111
.EQU f_klvmen_tst = 0b01111111
.ENDIF
;********************************************************************************
.
Nenhum comentário:
Postar um comentário