Guardar Datos en 8 Bit S/ Trans. OUT VAR portb.1 IN VAR portb.2 PULSE VAR portb.3 APOGEO VAR portb.4 DESPEGUE VAR portb.5 CONECT VAR porta.7 'VARIABLES H0 VAR BYTE Temp0 VAR BYTE Temp1 VAR WORD DaTO VAR WORD[16] Lowtemp VAR Temp1.LowByte Cont VAR BYTE Index VAR BYTE A VAR BYTE Aux VAR BYTE Frec VAR WORD INCLUDE "modedefs.bas" DEFINE OSC 8 ; Configuracion de Medicion Analogica DEFINE ADC_BITS 8 ' Set number of bits in result DEFINE ADC_CLOCK 3 ' Set clock source (rc = 3) DEFINE ADC_SAMPLEUS 50 ' Set sampling time in microseconds TRISA = 255 ' Set PORTA TO all input ADCON1 = 2 ' PORTA is analog @ device pic16F819, INTRC_OSC_NOCLKOUT, WDT_OFF, PWRT_ON, MCLR_OFF, BOD_OFF, LVP_OFF, CPD_OFF, WRT_OFF , DEBUG_OFF, CCPMX_ON , PROTECT_OFF ASM bsf status.5; Se mueve al banco del OSCCON movlw 0x74 ; El Acc en el códiGO que setea el OSCCON a 8MHz movwf osccon; Se pasa el Acc al OSSCON (Queda seteado) bcf status.5; Se vuelve al banco 0 ENDASM PAUSE 1000 HIGH porta.6 Index=0 PAUSE 1000 IF DESPEGUE==1 AND CONECT==1 THEN ADCIN 0, H0 FOR A=0 TO 255 WRITE A,0
NEXT A WHILE DESPEGUE==1 PAUSE 50 WEND GOTO Vuelo ELSE SEROUT OUT,N2400,["Obtener Datos de la EEPROM presione D(MAYUS!!)",10,13] SERIN IN,N2400,["D"] FOR A=0 TO 255 READ A,Aux PAUSE 5 SEROUT OUT,N2400,[#Aux,10,13] NEXT A SEROUT OUT,N2400,["Fin Datos",10,13] GOTO Termine ENDIF Vuelo: FOR A=0 TO 255 ADCIN 0,Temp0 Temp0=Temp0-H0 WRITE Index,Temp0 Index=Index+1 PAUSE 100 NEXT A GOTO Termine Termine: WHILE (1==1) PAUSE 1 WEND
HPWM8 OUT VAR portb.1 IN VAR portb.2 PULSE VAR portb.3 APOGEO VAR portb.4 DESPEGUE VAR portb.5 CONECT VAR porta.7 'VARIABLES H0 VAR BYTE Temp0 VAR BYTE Temp1 VAR WORD DaTO VAR WORD[16] Lowtemp VAR Temp1.LowByte Cont VAR BYTE Index VAR BYTE A VAR BYTE Aux VAR BYTE Frec VAR WORD INCLUDE "modedefs.bas" DEFINE OSC 8 ; Configuracion de Medicion Analogica DEFINE ADC_BITS 8 ' Set number of bits in result DEFINE ADC_CLOCK 3 ' Set clock source (rc = 3) DEFINE ADC_SAMPLEUS 50 ' Set sampling time in microseconds TRISA = 255 ' Set PORTA TO all input ADCON1 = 2 ' PORTA is analog @ device pic16F819, INTRC_OSC_NOCLKOUT, WDT_OFF, PWRT_ON, MCLR_OFF, BOD_OFF, LVP_OFF, CPD_OFF, WRT_OFF , DEBUG_OFF, CCPMX_ON , PROTECT_OFF ASM bsf status.5; Se mueve al banco del OSCCON movlw 0x74 ; El Acc en el códiGO que setea el OSCCON a 8MHz movwf osccon; Se pasa el Acc al OSSCON (Queda seteado) bcf status.5; Se vuelve al banco 0 ENDASM PAUSE 1000 HIGH porta.6 Index=0 PAUSE 1000 IF DESPEGUE==1 AND CONECT==1 THEN ADCIN 0, H0 HPWM 2,64,1000 FOR A=0 TO 255 WRITE A,0
NEXT A WHILE DESPEGUE==1 PAUSE 50 WEND GOTO Vuelo ELSE SEROUT OUT,N2400,["Obtener Datos de la EEPROM presione D(MAYUS!!)",10,13] SERIN IN,N2400,["D"] FOR A=0 TO 255 READ A,Aux PAUSE 5 SEROUT OUT,N2400,[#Aux,10,13] NEXT A SEROUT OUT,N2400,["Fin Datos",10,13] GOTO Termine ENDIF Vuelo: FOR A=0 TO 255 ADCIN 0,Temp0 Temp0=Temp0-H0 HPWM 2,191,(Temp0+Temp0+Temp0+Temp0+1000) WRITE Index,Temp0 Index=Index+1 PAUSE 100 NEXT A GOTO Termine Termine: HPWM 2,127,1500 WHILE (1==1) PAUSE 1 WEND
HPWM10 OUT VAR portb.1 IN VAR portb.2 PULSE VAR portb.3 APOGEO VAR portb.4 DESPEGUE VAR portb.5 CONECT VAR porta.7 'VARIABLES H0 VAR WORD LowH0 VAR H0.LowByte Temp0 VAR BYTE Temp1 VAR WORD Dato VAR WORD[16] Lowtemp VAR Temp1.LowByte Cont VAR BYTE Index VAR BYTE A VAR BYTE Aux VAR BYTE Frec VAR WORD INCLUDE "modedefs.bas" DEFINE OSC 8 ; Configuracion de Medicion Analogica DEFINE ADC_BITS 10 ' Set number of bits in result DEFINE ADC_CLOCK 3 ' Set clock source (rc = 3) DEFINE ADC_SAMPLEUS 50 ' Set sampling time in microseconds TRISA = 255 ' Set PORTA TO all input ADCON1 = 2 ' PORTA is analog @ device pic16F819, INTRC_OSC_NOCLKOUT, WDT_OFF, PWRT_ON, MCLR_OFF, BOD_OFF, LVP_OFF, CPD_OFF, WRT_OFF , DEBUG_OFF, CCPMX_ON , PROTECT_OFF ASM bsf status.5; Se mueve al banco del OSCCON movlw 0x74 ; El Acc en el códiGO que setea el OSCCON a 8MHz movwf osccon; Se pasa el Acc al OSSCON (Queda seteado) bcf status.5; Se vuelve al banco 0 ENDASM PAUSE 1000 HIGH porta.6 Index=0 PAUSE 1000 IF DESPEGUE==1 AND CONECT==1 THEN ADCIN 0, H0 HPWM 2,64,1000 FOR A=0 TO 255
WRITE A,0 NEXT A WHILE DESPEGUE==1 PAUSE 50 WEND GOTO Vuelo ELSE SEROUT OUT,N2400,["Obtener Datos de la EEPROM presione D(MAYUS!!)",10,13] SERIN IN,N2400,["D"] FOR A=0 TO A=255 READ A,Aux PAUSE 5 SEROUT OUT,N2400,[#Aux,10,13] NEXT A SEROUT OUT,N2400,["Fin Datos",10,13] GOTO Termine ENDIF Vuelo: FOR A=0 TO 255 ADCIN 0,Temp0 Temp0=Temp0-H0 HPWM 2,191,(Temp0+1000) Temp0=Temp0/4 WRITE Index,Temp0 Index=Index+1 PAUSE 100 NEXT A GOTO Termine Termine: HPWM 2,127,1500 WHILE (1==1) PAUSE 1 WEND