In my experience PIC microcontrollers have been more robust, flexible, and forgiving than a lot of people realize. Even so, there are several places where folks who are unfamiliar with microcontrollers commonly make mistakes. Let me give you a punch list of things to check, as well as my guesses about what is NOT a problem for you.
... with a suply of 5.10 volts (6V taken down by diodes). I read that the 16f628A needed from 3.0 to 5.5 V. ... I'm using alkaline bateries filtred by a diode ( can I ?).
This is probably OK for what you're doing but isn't a design to be especially proud of. Three-terminal regulators are only a few cents more expensive than your diodes, and offer far superior performance. Until you can get a low-dropout linear regulator, you might get better results using a string of only 3 alkaline cells, leaving off the diodes. This should give you a supply rail between 3.5V and 5.0V depending on the batteries' state of discharge.
1. On the microcontroller side of your dropping diodes you need a decent quality electrolytic capacitor. Any value from about 10 uF to 470 uF should work. The capacitor voltage rating should be at least 10V; 16V or 25V are OK. Make sure you get the polarity correct when you install it!
2. There MUST be a supply bypass capacitor, typically 0.1uF ceramic, connected from the chip's Vdd pin to Vss pin, very close to the chip. If the chip has multiple supply pins every Vdd pin needs a bypass capacitor. If you have any doubts whether you've done this correctly, you can carefully tack-solder bypass capacitors directly to the pins of a DIP package.
3. The MCLR pin must be at a logic HI level unless your Configuration Word specifies the internal power-ON RESET option. It is not a good idea to connect MCLR directly to Vdd - use a pullup resistor. This MCLR level can be verified with a voltmeter or oscilloscope. (Using the internal RESET option permits the pin normally assigned to MCLR to be used as a general-purpose logic input pin.)
4. There must be a clock oscillator signal. Most PIC's have several options for creating this. An oscilloscope is the quickest and easiest way to identify an oscillator problem, unless you are using the internal oscillator. Many people who think they have oscillator problems really do NOT have oscillator problems. Oscillator questions can be easily avoided in many cases by using the internal oscillator.
5. Unused pins should NOT be left floating (electrically unconnected). Set them to either logic HI level or logic LO level with pullup or pulldown resistors (instead of direct connections to Vdd or Vss). Do this even if you intend to program the pins as outputs or use internal pullups - the external terminations are the most fail-safe, idiot resistant approach. In most cases it doesn't matter whether you choose HI or LO. One exception is when the level you choose causes a constant INTERRUPT condition; another is that the PGM (low-voltage ICSP enable) pin must be kept LO. These logic levels can be easily verified with a 'scope or voltmeter.
6. Disable the low-voltage ICSP option in the CONFIGURATION word, unless there is a REAL need for this feature.
7. Disable the watchdog timer (WDT) in the CONFIGURATION word, at least until you know the system is operating.
8. Other options in the CONFIGURATION word(s) should be carefully chosen and correctly programmed. This condition cannot be readily verified by direct measurement or observation. If you have any doubts, get a programmer that can read back the CONFIGURATION word(s) and compare to what you expect the values to be.
I always explicitly enable or disable every CONFIGURATION option in my code. This helps me keep my feces amalgamated by forcing me to think about what I'm doing and avoids surprises caused by default values that I hadn't thought about. It looks something like this:
__config _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _CPD_OFF & _PGM_CP & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _OSC_SRC
; _FCMEN_OFF Fail-safe clock monitor disabled
; _IESO_OFF Clock switchover disabled
; (locked on Internal clock).
; _BOR_OFF Brown-out detection NOT used
; _CPD_OFF Data EEPROM can be written
; _PGM_CP Code protection as specified by the
; '_PGM_CP' variable (defined in Wheel_Ph1Vars.inc)
; _MCLRE_OFF Internal MCLR. RA3 is digital input.
; _PWRTE_ON Enable power-up delay timer. Probably
; not necessary, but it can't hurt.
; _WDT_OFF Watchdog Timer disabled. Need to come
; come back & add code to support a WDT
; _OSC_SRC Clock source as specified by the _OSC_SRC
; variable (defined in Wheel_Ph1Vars.inc)