' ########### start ########### ' avr:mega1284 ' ########### end ########### ' ' ****************************************************************** ' EPROM Emulator with ATMega1284(p) ' 2016-08-23 (c) Paolo Iocco ' ****************************************************************** ' ' Circuit diagram ' ATmega 1284 Pin map ' +-\/-+ ' A08--PB0--1|o |40--PA0--A00 ' A09--PB1--2| |39--PA1--A01 ' A10--PB2--3| |38--PA2--A02 ' A11--PB3--4| |37--PA3--A03 ' A12--PB4--5| |36--PA4--A04 ' MOSI---(A13)-PB5--6| |35--PA5--A05 ' MISO---(A14)-PB6--7| |34--PA6--A06 ' SCK----(A15)-PB7--8| |33--PA7--A07 ' /Reset 9| |32 AREF ' VCC 10| |31 GND ' GND 11| |30 AVCC ' XTAL1 12| |29--PC7--D7 ' XTAL2 13| |28--PC6--D6 ' RXD0---------PD0-14| |27--PC5--D5 ' TXD0---------PD1-15| |26--PC4--D4 ' /E---PD2 16| |25--PC3--D3 ' /OE--PD3 17| |24--PC2--D2 ' CS2--PD4 18| |23--PC1--D1 ' /WE--PD5 19| |22--PC0--D0 ' GLCD_RESET---PD6 20| |21 PD7------GLCD_SCK ' +----+ ' ****************************************************************** ' 9.6MHz: ' LFuse: 0xxx; HFuse: 0xxx; ' AVRDude: -U lfuse:w:0xxx:m -U hfuse:w:0xxx:m ' ' ****************************************************************** #chip mega1284,16 '#option explicit #define GLCD_TYPE GLCD_TYPE_PCD8544 #include ' Pin mapping #define GLCD_DO portb.5 #define GLCD_SCK portd.7 #define GLCD_DC portb.6 #define GLCD_CS portb.7 #define GLCD_RESET portd.6 setup: Write_Command_PCD8544(0x21) 'Activate Chip and H=1. Write_Command_PCD8544(0xC2) 'Set LCD Voltage Write_Command_PCD8544(0x06) 'temperature correction Write_Command_PCD8544(0x13) 'set bias system Write_Command_PCD8544(0x20) 'set LCD mode:PDown=0, Vaddr=0, Hext=0 Write_Command_PCD8544(0x09) 'Activate all segments. Clear_RAM_PCD8544() 'Erase all pixel on the DDRAM. Write_Command_PCD8544(0x08) 'Blank the Display. Write_Command_PCD8544(0x0C) 'Display Normal. GLCDCLS GLCDPrint(0, 0, "Done.") loop: DO forever LOOP end