' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ' Blink_led.bas ' Program To blink the on board led ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 'available pin setup '------------------------------------------------------------- 'PB7 (Output Compare and PWM Output for Timer/Counter2 or Output Compare and PWM Output C for Timer/Counter1) 'PB6 (Output Compare and PWM Output B for Timer/Counter1) 'PB5 (Output Compare and PWM Output A for Timer/Counter1) 'PB4 (Output Compare and PWM Output for Timer/Counter0) 'PB3 (SPI Bus Master Input/Slave Output) 'PB2 (SPI Bus Master Output/Slave Input) 'PB1 (SPI Bus Serial Clock) 'PB0 (SPI Slave Select input) '------------------------------------------------------------- 'PD7 (Timer/Counter2 Clock Input) 'PD6 (Timer/Counter1 Clock Input) 'PD5 (USART1 External Clock Input/Output) 'PD4 (Timer/Counter1 Input Capture Trigger) 'PD3 (External Interrupt3 Input or UART1 Transmit Pin) 'PD2 (External Interrupt2 Input or UART1 Receive Pin) 'PD1 (External Interrupt1 Input or TWI Serial DAta) 'PD0 (External Interrupt0 Input or TWI Serial CLock) '------------------------------------------------------------- 'PE7 (External Interrupt 7 Input or Timer/Counter3 Input Capture Trigger) 'PE6 (External Interrupt 6 Input or Timer/Counter3 Clock Input) 'PE5 (External Interrupt 5 Input or Output Compare and PWM Output C for Timer/Counter3) 'PE4 (External Interrupt4 Input or Output Compare and PWM Output B for Timer/Counter3) 'PE3 (Analog Comparator Negative Input or Output Compare and PWM Output A for Timer/Counter3) 'PE2 (Analog Comparator Positive Input or USART0 external clock input/output) 'PE1 (Programming Data Output or UART0 Transmit Pin) 'PE0 (Programming Data Input or UART0 Receive Pin) 'current pin setup '------------------------------------------------------------- 'portB.7 'portB.6 'portB.5 'portB.4 'portB.3 'portB.2 'portB.1 'portB.0 LED '------------------------------------------------------------- 'portD.7 'portD.6 'portD.5 'portD.4 'portD.3 'portD.2 'portD.1 'portD.0 '------------------------------------------------------------- 'portE.7 'portE.6 'portE.5 'portE.4 'portE.3 'portE.2 'portE.1 'portE.0 '------------------------------------------------------------- 'A2D 'portF.7 'portF.6 'portF.5 'portF.4 'portF.3 'portF.2 'portF.1 'portF.0 '------------------------------------------------------------- $Crystal = 14745600 $Regfile = "m128def.dat" 'uncomment to simulate program with out time delays '$sim 'ALIAS Led Alias Portb.0 'enable interrupts Enable Interrupts 'set portb 0 pin as output config Pinb.0 = Output 'set portb pin 0 high Portb = 255 'program start delay Waitms 30 Do 'change the state of the LED pin toggle led 'wait 0.5 seconds Waitms 500 Loop End