00001
00026 #include <16F628A.h>
00027
00028 #FUSES NOWDT // No Watch Dog Timer
00029 #FUSES HS // High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
00030 #FUSES PUT // Power Up Timer
00031 #FUSES NOPROTECT // Code not protected from reading
00032 #FUSES BROWNOUT // Reset when brownout detected
00033 #FUSES MCLR // Master Clear pin enabled
00034 #FUSES LVP // Low Voltage Programming on B3(PIC16) or B5(PIC18)
00035 #FUSES NOCPD // No EE protection
00036
00037 #use delay(clock=20000000) //**< Velocidad 4MHz.-
00038
00043 #define Display_BCD_A PIN_A0
00044 #define Display_BCD_B PIN_A1
00045 #define Display_BCD_C PIN_A2
00046 #define Display_BCD_D PIN_A3
00048 #define Display_Unidad PIN_B0
00049 #define Display_Decena PIN_B1
00056 void Display_nibble(int n)
00057 {
00058 output_bit(Display_BCD_A, (n & 1));
00059 output_bit(Display_BCD_B, (n & 2));
00060 output_bit(Display_BCD_C, (n & 4));
00061 output_bit(Display_BCD_D, (n & 8));
00062 }
00072 void Display_Visualizacion(int n)
00073 {
00074 int i;
00075 for(i=1;i<=30;++i){
00076 Display_nibble(n >> 4);
00077 output_high(Display_Decena);
00078 delay_ms(5);
00079 output_low(Display_Decena);
00080
00081 Display_nibble(n & 0xf);
00082 output_high(Display_Unidad);
00083 delay_ms(5);
00084 output_low(Display_Unidad);
00085 }
00086 }
00092 void main()
00093 {
00094
00095 setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
00096 setup_timer_1(T1_DISABLED);
00097 setup_timer_2(T2_DISABLED,0,1);
00098 setup_comparator(NC_NC_NC_NC);
00099 setup_vref(FALSE);
00100
00101 output_high(PIN_B4);
00102 delay_ms(500);
00103 output_low(PIN_B4);
00104
00105 while(1){
00106 Display_Visualizacion(0x27);
00107 }
00108
00109 }
00110