by ober » Thu Oct 14, 2010 5:44 pm
Very good work, is still far from a working project, but you have taken the 1st step, to modify.
Besides the voltage regulator highlighted by kl84 which I agreed, there is another connection you need to take care.
Yes, Accelerometer's output can be connected directly to PIC analog input, but you will need to take care of analog pin mixing with digital pin.
As you can see from the schematic, AN0, AN1 and AN2 is use for digital input and you plan to use AN3, RA4 and AN4 for analog input.
1. RA4 is not analog input pin. Analog pin is label with "AN", there are RA0, RA1, RA2, RA3, RA5 for PIC16F876A. There are only 5 analog input for this model.
2. If you use higher number AN pin for analog input, the configuration in ADCON1 will make lower number AN pin become analog too. In other words, if AN4(RA5) is analog input, AN3(RA3), AN2(RA2)..... AN0 (RA0) will become analog input. Analog input cannot read digital logic in normal method.
Try to use other pin for push button or use AN0, AN1 and AN2 for accelerometer.