57 lines
1.5 KiB
Plaintext
57 lines
1.5 KiB
Plaintext
' ########### start ###########
|
|
' avr:mega48
|
|
' ########### end ###########
|
|
'
|
|
' ******************************************************************
|
|
' A program to flash LED on PORTB.0
|
|
' 2018-03-07 (c) Paolo Iocco
|
|
' ******************************************************************
|
|
'
|
|
' Circuit diagram
|
|
' ---------------
|
|
' ATtiny 48 / 88 / Mega 168 / Mega 328 Pin map
|
|
' +-\/-+
|
|
' +5V---| 100K |--->1|o |28 PC5 ADC5
|
|
' RXD PD0 2| |27 PC4 ADC4
|
|
' TXD PD1 3| |26 PC3 ADC3
|
|
' PD2 4| |25 PC2 ADC2
|
|
' PD3--5| |24 PC1 ADC1
|
|
' PD4--6| |23 PC0 ADC0
|
|
' VCC 7| |22 GND
|
|
' GND 8| |21 AREF
|
|
' OSC1------------->9| |20 VCC
|
|
' OSC2------------>10| |19 PB5 SCK
|
|
' PD5-11| |18 PB4 MISO
|
|
' PD6-12| |17 PB3 OC2A MOSI
|
|
' PD7-13| |16 PB2 OC1B
|
|
' LED<----PB0 14| |15 PB1 OC1A
|
|
' +----+
|
|
' -------------------------------------------------------------
|
|
' 8MHz internal: (http://www.engbedded.com/fusecalc/)
|
|
' LFuse: 0xe2; HFuse: 0xdf;
|
|
' avrdude -B 10 -c USBasp -p ATmega48 -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m
|
|
'
|
|
' ******************************************************************
|
|
|
|
#chip mega48,8
|
|
|
|
#define led PORTD.0
|
|
dir led out
|
|
|
|
'Startup routine
|
|
Startup:
|
|
|
|
'Main routine
|
|
Loop:
|
|
'Turn one LED on, the other off
|
|
SET led ON
|
|
Wait 500 ms
|
|
'Now toggle the LEDs
|
|
|
|
SET led OFF
|
|
Wait 500 ms
|
|
'Jump back to the start of the program
|
|
goto Loop
|
|
|
|
end
|