Finally had a chance to play with the 8051 and get back into programming it in assembly and C, using Keil software.
Got basic interrupts going, and managed to write up a simple PWM routine using Timer0 interrupt. The pictures show PWM 8-bit input and the output on logic probe outputs (green = 1, red =0). The routine is not perfect, or the LED’s don’t dim linearly, but it shows the basic workings of it.

High duty cycle, LED is bright!

Duty cycle somewhere around 30%
The dip switches set the value used for the PWM, the LEDs show the high and low of the signal. You can see that as more switches are set high, the brighter the green, and the darker the red LED.
Comments