8051: Ports and Delay
Understand the classic 8051 port model using embedded C.
◷ 40 minParts and tools
- 8051 trainer board
- LED array
- Programmer
Lesson
Learning objective
Understand the classic 8051 port model using embedded C.
Procedure
- Review the circuit and confirm the board voltage.
- Build and inspect the wiring before applying power.
- Upload the example, observe the result and record your readings.
- Change one parameter, predict the result and test again.
Troubleshooting
Check power, ground, pin selection, polarity, compiler target and serial output. Use a multimeter or logic analyser where appropriate.
Example code
#include <reg51.h>
sbit LED=P1^0;
void main(){ LED=0; while(1){} }Knowledge check
P1 refers to what?
