commit 526dbbf4ee665293440d3f8cf48b2b475e14781a Author: Olaf Rempel Date: Fri Mar 12 20:36:58 2010 +0100 at90s2313 test version diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6d36148 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.o +*.elf +*.bin +*.hex +*.lst +*.map diff --git a/5x7test.c b/5x7test.c new file mode 100644 index 0000000..99f58d2 --- /dev/null +++ b/5x7test.c @@ -0,0 +1,129 @@ +/*************************************************************************** + * Copyright (C) 02/2010 by Olaf Rempel * + * razzor@kopf-tisch.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License, * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include +#include +#include + +#define F_CPU 3686400 +#include + +#include "6x8_vertikal_LSB_1.h" + +/* + * at90s2313 pinout: + * PB0-4 => LED C1-5 + * PB5-7 => free/ISP + * PD0-6 => LED R1-7 (with 100R resistors) + */ + +/* for TC12-11 */ +//#define COL_SEL(x) PORTB = ~(x) +//#define COL_DATA(x) PORTD = (x) + +/* for TA12-11 */ +#define COL_SEL(x) PORTB = (x) +#define COL_DATA(x) PORTD = ~(x) + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) + +static const char text[] = " <<>>"; + +/* scrollbuffer */ +static volatile uint8_t data[5 + 1 + 5]; +static volatile uint8_t offset; + +ISR(SIG_OVERFLOW0) +{ + static uint8_t col; + /* ~2,8ms */ + TCNT0 = 0xFF - 40; + + COL_DATA(0x00); + COL_SEL(1 << col); + COL_DATA(data[offset + col]); + + col = (col == 5) ? 0 : col + 1; +} + +int main(void) +{ + uint8_t mode = 0; + uint8_t pos = 0; + uint8_t delay = 0; + + DDRB = 0x1F; + DDRD = 0x7F; + + /* Timer0: FCPU/256 */ + TCCR0 = (1< $@ + +text: hex bin + +hex: $(PRG).hex +bin: $(PRG).bin + +%.hex: %.elf + $(OBJCOPY) -j .text -j .data -O ihex $< $@ + +%.bin: %.elf + $(OBJCOPY) -j .text -j .data -O binary $< $@ + +install: all + avrdude -p 2313 -c avr910 -b 115200 -P /dev/ttyUSB0 -e -V -U flash:w:$(PRG).hex +# avrdude -c dragon_isp -P usb -p 2313 -B 2 -e -V -U flash:w:$(PRG).hex