;********************************************************* ;* BUT1.ASM Allows you to control one i/o with ;* a pushbutton (on/off function) ;* input at PORTD, output at PORTB ;* ;* Copyright ©2002 Rob's ElectroSoft ;* ;* RES can be reached by email: electro1@wanadoo.nl ;* Internet: http://Gheos.com/avr ;* ;* Version :1.0 ;* Target MCU :AT90S1200-12PI@4MHz ;* Date :11-06-2002 ;********************************************************* .device AT90S1200 .include "1200def.inc" rjmp RESET ;reset vector ;* Main program - Command LED (on/off) RESET: cbi DDRD, 2 ;input sbi PORTD, 2 ;pull-up On sbi DDRB, 2 ;output cbi PORTB, 2 ;LED Off nop ;settle R=10k of reset ;* Code wait: cbi PORTB, 2 ;LED Off sbis PIND, 2 ;if lo -> LED On rjmp ledon rjmp wait ;else wait ledon: sbi PORTB, 2 ;LED On sbic PIND, 2 ;if hi -> LED Off rjmp wait rjmp ledon ;else keep LED On