[GRIPE] Why is the PIC16F1xxxx simulator so awful?
This post is just me venting my frustration with the MPLABX v5.25 simulation tools.
What I am trying to do is try out some of the new features of the enhanced mid-range 8-bit controllers that Microchip added to the PIC16F1xxxx family of controllers.
My first step was to check the MPLABX IDE and simulator release notes for a list of known issues so I can select a target controller to write some test code for.
The PIC16F18877 seems like something useful. A DIP-40 package, PPS for GPIO reconfiguration and a bunch of timers with simulation models.
Task 1: create code to assert an interrupt once per second from a 32MHz system oscillator.
TIMER1 is a 16-bit timer that can be reset on match with a compare using the CCP1 function block.
We need to divide the system oscillator frequency (FOSC) by 32,000,000.
The instruction clock is FOSC/4 (8MHz), the maximum TIMER1 prescale value is 1:8 so we can get a TIMER1 input clock of FOSC/32 (1MHz). This is a 16-bit timer so a maximum divisor of 62,500 will yield a output of FOSC/2,000,000. This is 16 times faster that I want.
According to the data sheet TIMER0 output can be selected as an input clock for TIMER1 so we setup TIMER0 for a FOSC/4 clock in and use TIMRE0 in 8-bit mode for a divide by 16. This yields a FOSC/64.
Select TIMER0 out as a clock source for TIMER1 and nothing! TIMER1 does not count in simulator.
Well I happen to have a few old demo boards like the DM163022-1 (PICDEM2Plus)
that the PIC16F18877 will work in. So I try the code in real hardware and it works just the way the data sheet describes.
So I dig around with the timer clock source selections and come to find that the only selection that simulates correctly is when the FOSC/4 is the clock source selected for TIMER1. Selecting the FOSC clock source clocks 4 times SLOWER that the FOSC/4 clock source. Other selections do not seem to cause TIMER1 to count at all.
The MPLABX simulator release notes do not mention that FOSC/4 is the only working clock source for TIMER1. The MPLABx v5.25 IDE says the TIMER0 to TIMER5 have simulation models but I can find no mention that they are incomplete.
It is perhaps understandable that a complex function may lack a complete simulation model. Microchip can only get one clock source to work? Come on! It's the 21st century. This is only a 16-bit timer with 16 selectable clock sources. How hard can this be?
I tried the PIC16F15323 in the simulator TIMER1 fails to clock from TIMER0 as well.
Is there any part in the PIC16F1xxxx family of controllers where the MPLABx v5.25 IDE timer simulation models are complete or the documentation is correct?
I challenge Microchip to come out and say that the simulation tools are a waste of time or fix the timer simulation models.
post edited by dan1138 - 2019/08/17 14:02:23