源程序清单1?File TURNON.ASM 2?Assembly code for PIC16F84 microcontroller 3?Turns on an LED connected to B0 4?Uses RC oscillator,about 100kHz 5?CPU configuration 6?(it‘s a 16F84,RC oscillator?7?watchdog timer off,power-up timer on)
8?processor 16F84 9?include 10?_config_RC_OSC&_WDT_OFF&_PWRTE_ON 11?Program 12?org 0;start at address 0 13?At startup,all ports are inputs?14?Set Port B to all outputs 15?movlw B‘00000000’;w=binary 00000000 16?tris Portb ;copy w to port B control reg 17?Put a 1 in the lowest bit of port B?18?movlw B‘00000001’;w=binary 00000001 19?movwf portb ;copy w to port B itself 20?Stop by going into an endless loop 21?fin:goto fin 22?end ;program ends here现对源程序清单逐行加以说明。