navegante 420
la nave nodriza
Pues si, la deteccion es otra cosa, Ayer tras varias pruebas, forzar la desabilitacion y habilitacion de las interrepciones, poner un delay para los rebotes, ponerle imanes a los coches mas bajo de lo normal para augmentar el campograbitatorio, para mejorar la captacion, poner un condensador de 200nf en paralelo al captador. Conseguimos, sobre todo con el concensador, que la captacion fuera como un clavo, con un coche, ha la que volvemos a poner los dos, mierda, si solo fuera al pasar por meta estaria claro que la respuesta no es lo suficientemente rapida, pero en ocasiones el coche uno me activa el paso 2 o sin pasar ninguno por meta, se me activa el paso 2.
Así que decidimos mirar hoy con un oscilo que es lo que pasa, y que señal hay. Así que esta tarde os lo digo.
Os dejo el codigo con el que estado trasteando ayer.
YA no hay delays largos, jejejejeje
Así que decidimos mirar hoy con un oscilo que es lo que pasa, y que señal hay. Así que esta tarde os lo digo.
Os dejo el codigo con el que estado trasteando ayer.
YA no hay delays largos, jejejejeje
PHP:
#include <18F4550.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV20 //Brownout reset at 2.0V
#FUSES NOPUT //No Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES PBADEN //PORTB pins are configured as analog input channels on RESET
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOCPB //No Boot Block code protection
#FUSES MCLR //Master Clear pin enabled
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES PLL12 //Divide By 12(48MHz oscillator input)
#FUSES CPUDIV4 //System Clock by 4
#FUSES USBDIV //USB clock source comes from PLL divide by 2
#FUSES VREGEN //USB voltage regulator enabled
#FUSES ICPRT //ICPRT enabled
#use delay(clock=8000000)
#use i2c(Master,Fast,sda=PIN_B0,scl=PIN_B2)
#use fast_io (A)
#use fast_io (B)
#use fast_io (C)
#use fast_io (D)
#int_RB
void RB_isr(void)
{
disable_interrupts(GLOBAL) ;
if(input(pin_B4)==0)
{
output_bit(PIN_d0,~input(pin_d0));
}
if(input(pin_B5)==0)
{
output_bit(PIN_d1,(~input(pin_d1)));
}
if(input(pin_B6)==0)
{
output_bit(PIN_d2,(~input(pin_d2)));
}
if(input(pin_B7)==0)
{
output_bit(PIN_d3,(~input(pin_d3)));
}
delay_ms(20);
enable_interrupts(GLOBAL);
}
/*#int_COMP
void COMP_isr(void)
{
if(C1OUT==1)output_high (pin_D4);
else output_low (pin_D4);
if(C2OUT==1)output_high (pin_D5);
else output_low (pin_D5);
}*/
void main()
{
set_tris_D (0b11000000);
set_tris_A (0b11111111);
set_tris_B (0b11111100);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
//setup_vref(VREF_LOW|15);
//setup_comparator(A0_VR_A1_VR);
enable_interrupts(GLOBAL);
enable_interrupts(INT_RB);
//enable_interrupts(INT_COMP);
setup_oscillator(OSC_8MHZ|OSC_TIMER1|OSC_31250|OSC_PLL_OFF);
output_D(0);
// TODO: USER CODE!!
while(1);
}