To write to a single pin, we can make use of an sbit variable in the
Keil (C51) compiler to provide a finer level of control.
Here’s a clean way of doing this:
#define LED_PORT P3
#define LED_ON 0 /* Easy to change the logic here */
#define LED_OFF 1
...
sbit Warning_led = LED_PORT^0; /* LED is connected to pin 3.0 */
...
Warning_led = LED_ON;
... /* delay */
Warning_led = LED_OFF;
... /* delay */
Warning_led = LED_ON;
... /* etc */