;------------------------------------------------- ;Program: MODTest.asm ;Update: 17 August 2002 ;Initial: 01 December 1990 ; ;By: Dr. Marcus O. Durham, PhD, PE ; Tulsa, OK, USA ; mod@superb.org ; www.ThewayCorp.com ;Copyright (c)1990, 2002. All rights reserved ; ;Purpose: ; The program should be downloaded from the PC. ; The LED on P3.4 will come on. ; The LED on P3.5 will go off. ; The LEDs will change state if P3.3 is at ground. ; The program is very simple. Nevertheless, ; structured programming is used for illustration. ; ;Processor: 8051 family ;PROM: 8k (2000H) onboard ;Crystal: 11.059 MHz ;Baud: 9600 ;Handshake: not used at this speed ;Assembler: Intel ASM51.exe ; ASM51 MODTest.asm ; ; ;################################################# ; ; ASSIGNMENTS ; ;################################################# ;PORT USE P33 EQU 0B4H ;Port3.3, switch input P34 EQU 0B5H ;Port3.4, LED P35 EQU 0B6H ;Port3.5, LED flashing ;################################################# ; ; PROGRAM ; ;################################################# START: ;------------------------------------------------- ; When processor is reset, program control comes ; here. Jump to the first executable address ; after all interrupts reserved locations, etc. ORG 00H LJMP INITIAL ;------------------------------------------------- ORG 80H INITIAL: ;------------------------------------------------- ; ; Set the initial conditions. Output to LEDs and ; make P33 an input. SETB P34 ;turn on LED P34 CLR P35 ;turn off LED P35 SETB P33 ;make bit an input ;------------------------------------------------- MAIN: ;------------------------------------------------- ; ; The main process loop will test limit. ; If switch open, flash LED. ; If closed, change states. ; Since there is no delay & no debounce, ; the output is sensitive to when the switch is ; released. JB P33,MAIN9 ;skip if off CPL P34 CPL P35 MAIN9: SJMP MAIN ;play it again, Sam ;************************************************* END ;Program end