Hola:
Lo estoy siguiendo al detalle, el n3 el enlce por ahora no funciona.
Muchas gracias mi muy distinguido amigo.
Lo estoy siguiendo al detalle, el n3 el enlce por ahora no funciona.
Muchas gracias mi muy distinguido amigo.
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menúusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Leer_RAM
{
public partial class Form1 : Form
{
string Despedir;
public Form1()
{
InitializeComponent();
}
// Si pulsas el botón, empieza el contador.
private void button2_Click(object sender, EventArgs e)
{
timer1.Start();
Despedir = "START";
label3.Text = (Despedir);
}
private void timer1_Tick(object sender, EventArgs e)
{
int Valor = progressBar1.Value; // Guarda el valor actual.
progressBar1.Increment(1); // Incrementa a 1.
label1.Text = Valor.ToString(); // Muestra el valor del incremento del ProgressBar.
// Si el valor llega a 100.
if (Valor == 100)
{
progressBar1.Value = 0; // Empieza desde 0.
}
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Stop();
Despedir = "STOP";
label3.Text = (Despedir);
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Leer_RAM
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
// Si pulsas el botón, empieza el contador.
private void button2_Click(object sender, EventArgs e)
{
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
int Valor = progressBar1.Value; // Guarda el valor actual.
progressBar1.Increment(1); // Incrementa a 1.
label1.Text = Valor.ToString(); // Muestra el valor del incremento del ProgressBar.
// Si el valor llega a 100.
if (Valor == 100)
{
progressBar1.Value = 0; // Empieza desde 0.
}
}
}
}
Cita de: WINTX en 6 Marzo 2014, 22:38 PM
es el típico agarrado que te cobra por todo..
Cita de: Inter-ard en 5 Marzo 2014, 21:09 PM
Buenas tardes amigos, quisiera preguntarles sobre qué puedo aprender más en Arduino. Pues me interesa aprender cosas nuevas.
Saludos.
Cita de: noopynoob en 28 Febrero 2014, 02:46 AM
porque no abren un nuevo tema en vez de revivir uno de noviembre?
list P=16F88 ; Procesador.
include <p16F88.inc> ; Definición de las etiquetas del PIC.
__CONFIG _CONFIG1, _FOSC_INTOSCIO & _WDTE_OFF & _PWRTE_ON & _MCLRE_ON & _BOREN_ON & _LVP_OFF & _CPD_OFF & _WRT_OFF & _CCPMX_RB3 & _CP_OFF
__CONFIG _CONFIG2, _FCMEN_ON & _IESO_ON
;***************************************
;Declaracion de variables y constantes
;***************************************
#define p1 PORTA,4 ; Pulsador 1.
#define p2 PORTA,3 ; Pulsador 2.
#define p3 PORTA,2 ; Pulsador 3.
#define p4 PORTA,1 ; Pulsador 4.
#define motor PORTB,7 ; Motor DC.
#define led1 PORTB,6 ; Diodo Led 1.
#define led2 PORTB,5
#define led3 PORTB,4
#DEFINE Altavoz PORTB,3 ; Altavoz.
#DEFINE Zumbador PORTB,2 ; Zumbador piezoeléctrico.
ctte_5_min equ .5 ; constante para 5 minutos
ctte_10_min equ .10 ; constante para 10 minutos
ctte_20_min equ .20 ; constante para 20 minutos
ctte_min equ .60 ; para 1 minuto
ctte_timer equ .16 ; para 1 segundo
carga_timer equ .12 ;
variables udata 0x20
cont_timer RES 1
cont_seg RES 1 ; contador de segundos
cont_min RES 1 ; contador de minutos
tiempo_fijado RES 1
PDel0 RES 1
PDel1 RES 1
W_TEMP RES 1
STATUS_TEMP RES 1
PCLATH_TEMP RES 1
RAM RES 1
RAM_1 RES 1
RAM_2 RES 1
RAM_3 RES 1
RAM_4 RES 1
RAM_5 RES 1
RAM_6 RES 1
;**************************************
org 0x00
goto configuracion
org 0x04
;**********************************************************************
; Rutinas de interrupciones
;**********************************************************************
rutina_de_interrupcion
PUSH
MOVWF W_TEMP
SWAPF STATUS,W
CLRF STATUS
MOVWF STATUS_TEMP
MOVF PCLATH,W
MOVWF PCLATH_TEMP
CLRF PCLATH
btfss INTCON,TMR0IF ;verifica si es interrupción temporizada
goto salida_timer0 ;sale de la rutina de interrupción
movlw carga_timer ;
movwf TMR0 ;carga al timer0 para reiniciar cuenta
movfw cont_timer ;
xorlw ctte_timer ;compara si llego al segundo
btfss STATUS,Z
goto salida_timer0 ;sale de la rutina de interrupción si no es 1 segundo
clrf cont_timer ;
incf cont_seg ;se incrementa cada segundo
movfw cont_seg
xorlw ctte_min ;compara si es un minuto
btfss STATUS,Z
goto salida_timer0 ;sale de la rutina de interrupción
clrf cont_seg
incf cont_min ;se incrementa cada minuto
salida_timer0
incf cont_timer
bcf INTCON,TMR0IF
POP
MOVF PCLATH_TEMP,W
MOVWF PCLATH
SWAPF STATUS_TEMP,W
MOVWF STATUS
SWAPF W_TEMP,F
SWAPF W_TEMP,W
retfie
;***********************************************
;Subrutinas
;***********************************************
reiniciar_tiempo
movlw carga_timer
movwf TMR0
clrf cont_timer
clrf cont_seg
clrf cont_min
banksel OPTION_REG
bcf OPTION_REG,T0CS ; timer0 inicia la cuenta
banksel PORTA
bsf INTCON,GIE ; interrupciones habilitadas
bsf motor
return
;*************************************************************
pulsador1
call retardo_10ms
btfsc p1
return
;***********************************************************
btfss p1 ; espera hasta que se suelte el pulsador
goto $-1 ;
;***********************************************************
movlw ctte_5_min
movwf tiempo_fijado
clrf PORTB
call reiniciar_tiempo
call PitidoCorto
bsf led1
return
;*************************************************************
pulsador2
call retardo_10ms
btfsc p2
return
;***********************************************************
btfss p2 ; espera hasta que se suelte el pulsador
goto $-1 ;
;***********************************************************
movlw ctte_10_min
movwf tiempo_fijado
clrf PORTB
call reiniciar_tiempo
call PitidoCorto
bsf led2
return
;*************************************************************
pulsador3
call retardo_10ms
btfsc p3
return
;***********************************************************
btfss p3 ; espera hasta que se suelte el pulsador
goto $-1 ;
;***********************************************************
movlw ctte_20_min
movwf tiempo_fijado
clrf PORTB
call reiniciar_tiempo
call PitidoCorto
bsf led3
return
;*************************************************************
pulsador4
call retardo_10ms
btfsc p4
return
;***********************************************************
btfss p4 ; espera hasta que se suelte el pulsador
goto $-1 ;
;***********************************************************
call detener_tiempo
call Pitido
return
;*************************************************************
detener_tiempo
clrf PORTB
banksel OPTION_REG
bsf OPTION_REG,T0CS ; timer0 detenido
banksel PORTA
bcf INTCON,GIE ; interrupciones desactivadas
;*************************************************************
retardo_10ms
movlw .8
movwf PDel0
PLoop1
movlw .249
movwf PDel1
PLoop2
clrwdt
clrwdt
decfsz PDel1,1
goto PLoop2
decfsz PDel0,1
goto PLoop1
PDelL1
goto PDelL2
PDelL2
clrwdt
return
;******************************************************
; Subrutinas "PitidoLargo", "Pitido" y "PitidoCorto"
;*******************************************************
PitidoLargo
bsf Altavoz
bsf Zumbador
call Retardo_500ms
;******************************************************
Pitido
bsf Altavoz
bsf Zumbador
call Retardo_200ms
;******************************************************
PitidoCorto
bsf Altavoz
bsf Zumbador
call Retardo_20ms
bcf Altavoz
bcf Zumbador
return
;**************************************************
Retardo_500ms
movlw 0x03
movwf RAM
movlw 0x18
movwf RAM_1
movlw 0x02
movwf RAM_2
Retardo_500ms_0
decfsz RAM, f
goto $+2
decfsz RAM_1, f
goto $+2
decfsz RAM_2, f
goto Retardo_500ms_0
goto $+1
return
;******************************************************
Retardo_200ms
movlw 0x3E
movwf RAM_3
movlw 0x9D
movwf RAM_4
Retardo_200ms_0
decfsz RAM_3, f
goto $+2
decfsz RAM_4, f
goto Retardo_200ms_0
goto $+1
nop
return
;******************************************************
Retardo_20ms
movlw 0x9E
movwf RAM_5
movlw 0x10
movwf RAM_6
Retardo_20ms_0
decfsz RAM_5, f
goto $+2
decfsz RAM_6, f
goto Retardo_20ms_0
goto $+1
nop
return
;**********************************************
configuracion
;**********************************************
; configuracion del oscilador interno
;**********************************************
banksel OSCCON ;bank 1
movfw OSCCON
iorlw 0x60 ;oscilador interno a 4Mhz
movwf OSCCON
banksel PORTA ;bank 0
;**********************************************
; Configuración de puertos de entrada y salida
;**********************************************
clrf PORTA ;porta=0
clrf PORTB ;portb=0
banksel ANSEL ;bank 1
clrf ANSEL ;puertos i/o digitales
movlw 0xff ;w=255
movwf TRISA ;porta como entradas
clrf TRISB ;portb como salidas
;***********************************************
;Configuraciond de las interrupcion temporizada
;***********************************************
movlw b'11110111' ;prescaler asignado a timer0, prescaler=256
movwf OPTION_REG
banksel INTCON
movlw b'00100000' ;
movwf INTCON ;interrupciones globales desactivados e interrupción timer0 activado
clrf TMR0
;**********************************************
clrf cont_min
movlw 0xff
movwf tiempo_fijado
bucle
btfss p1
call pulsador1
btfss p2
call pulsador2
btfss p3
call pulsador3
btfss p4
call pulsador4
movfw cont_min
xorwf tiempo_fijado,W
btfss STATUS,Z
goto bucle
incf cont_min
call detener_tiempo
call PitidoLargo ;************************************
goto bucle
;***********************************************************
end