Page 1 of 1

Problema con macro y pic 16F1829

Posted: Tue Sep 03, 2024 11:59 am
by Carmelo
I have a pcb and a program made with the pic 16F688 working correctly. Attached file.

Now I need to make a modification to the project and I have to change the pic model to the 16F1829. To do this I change the target model and adjust the configuration bits appropriately so that it works with an internal oscillator at 8MHz as with the 16F688. I also attach the file.

The pcb board remains the same.

The program must detect when 10 pulses occur at the input and at that moment an output is activated for a certain time. After this time, the output must return to 0. But during that time, if any more pulses occur at the input it must continue counting them.

The fact is that with the pic16F1829, being the same program, it does not work. So the pulses are counted correctly, the output is activated, but it never deactivates.

I have tested disabling the macro to read the pulses within the output activation time cycle (capture attached) and in this case the output is deactivated when the programmed time elapses. But of course, if any more pulses occur during the output activation time, the pulse is not counted and it needs to be able to be counted.

I don't understand why it doesn't work when the macro to read the pulses is activated using the pic 16F1829 and it does work with the 16F688, the program being exactly the same.

Can someone tell me why this could be happening?

P.S.: It doesn't work on the physical model pcb, but it is working in the simulation. Could it be a bad configuration of the internal oscillator frequency?

I have another project with the same pic 16F1829 and the same oscillator configuration and it works very well.

Thank you very much

Re: Problema con macro y pic 16F1829

Posted: Tue Sep 03, 2024 1:10 pm
by mnfisher
I would look at using at interrupt to count the pulses. Less chance of missing one..

Martin