Hi,
i use the latest demo version of Keil v9.02a for 8051. When i simulate a very simple pwm (timer0/1 mode 6) testprogram for a P89LPC935 the behavior of the simulator seems to be wrong. The datasheet says on page 53 the following:
- The low period of the TFn is in THn, and should be between 1 and 254 - The high period of the TFn is always 256-THn - Loading THn with 00h will force the Tx pin high, loading THn with FFh will force the Tx pin low
This is what i see when running the testprogram on the board, so it is correct.
In the simulation the Tn pin is constant 0 when i load THn=0 and 1 when i load THn=0xFF. And with higher TFn values the high phase of the pwm gets larger.
But in reality the Tn pin is constant 1 when i load THn=0 and 0 when i load THn=0xFF. And with higher TFn values the low phase of the pwm gets larger. Like described in the datasheet.
I know that i could invert the pwm output of the ccu timer, but for timer0/1 i don't know anything which could do that. So is there any setting which i missed that could invert the output of the pwm for timer0/1 or is this a bug in the smulation?
Ciao, Rainer
Additionally to the inverted display in the logic analyzer i also noted that the behaviour at one border is incorrect. When loading THn=0 it shows a constant 0 but when loading THn=0xFF it does not show a constant 1 but instead still a little 0 peak which should not occur.