hd44780 display debugger
This commit is contained in:
parent
63974b148c
commit
c833911cad
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.bin
|
||||
|
34
arduino/hd44780_debugger/hd44780_debugger.ino
Normal file
34
arduino/hd44780_debugger/hd44780_debugger.ino
Normal file
@ -0,0 +1,34 @@
|
||||
/* HD44780 Character display debugger */
|
||||
|
||||
#define EN 2
|
||||
#define RS 11
|
||||
const byte DATA_BUS[] = {10, 9, 8, 7, 6, 5, 4, 3};
|
||||
|
||||
void setup() {
|
||||
pinMode(RS, INPUT);
|
||||
pinMode(EN, INPUT);
|
||||
for(int pin=0; pin < 8; pin++) {
|
||||
pinMode(DATA_BUS[pin], INPUT);
|
||||
}
|
||||
|
||||
Serial.begin(57600);
|
||||
Serial.println("HD44780 debugger");
|
||||
Serial.println("DATA BUS HEX RS EN");
|
||||
|
||||
attachInterrupt(digitalPinToInterrupt(EN), onClk, CHANGE);
|
||||
}
|
||||
|
||||
void loop() {}
|
||||
|
||||
void onClk() {
|
||||
unsigned int data = 0;
|
||||
for(int pin=0; pin < 8; pin++) {
|
||||
byte b = digitalRead(DATA_BUS[pin]) ? 1 : 0;
|
||||
Serial.print(b);
|
||||
data = (data << 1) + b; // Shifta di 1 e aggiunge il bit corrente. Serve per ricostruire il numero da binario
|
||||
}
|
||||
|
||||
char output[30] = {};
|
||||
sprintf(output, " 0x%02x %c %c", data, digitalRead(RS) ? 'D' : 'I', digitalRead(EN) ? 'H' : 'L');
|
||||
Serial.println(output);
|
||||
}
|
@ -55,7 +55,8 @@ const byte MODE_ROM_EMULATOR = 1;
|
||||
const byte MODE_ROM_RAM_EMULATOR = 2;
|
||||
|
||||
const byte ADDR_BUS[] = {50, 52, A11, A9, A8, A12, A15, A14, 53, 51, 49, 47, 45, 43, 41, 39};
|
||||
const byte DATA_BUS[] = {34, 40, 42, 44, 46, 36, 30, 32};
|
||||
//const byte DATA_BUS[] = {34, 40, 42, 44, 46, 36, 30, 32};
|
||||
const byte DATA_BUS[] = {3, 4, 5, 6, 7, 8, 9,10};
|
||||
//const byte CTRL_BUS_RD = 20;
|
||||
const byte CTRL_BUS_RD = 3;
|
||||
const byte CTRL_BUS_WR = 23;
|
||||
@ -88,7 +89,7 @@ const byte PWR_VCC = 38;
|
||||
* MODE_ROM_EMULATOR = Emulates rom with the contents of ROM_DATA
|
||||
* MODE_ROM_RAM_EMULATOR = Emulates ram
|
||||
*/
|
||||
const byte MODE = MODE_ROM_EMULATOR;
|
||||
const byte MODE = MODE_DEBUGGER;
|
||||
|
||||
const byte ROM_DATA[] = {0x00, 0x00, 0x00, 0x00, 0xC3, 0x00, 0x00};
|
||||
//const byte ROM_DATA[] = {0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00};
|
7
assembly/README.txt
Normal file
7
assembly/README.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Compilare assembly:
|
||||
z80asm -i hd44780_lcd_test_procedure.asm -o rom.bin
|
||||
Portare binario alla dimensione dell eeprom:
|
||||
dd if=/dev/zero of=rom.bin bs=1 count=0 seek=8192
|
||||
Scrivere su EEPROM:
|
||||
minipro -w rom.bin -p "AT28C64B"
|
||||
|
BIN
assembly/a.bin
BIN
assembly/a.bin
Binary file not shown.
@ -1,40 +1,39 @@
|
||||
;hd44780 lcd test procedure
|
||||
|
||||
ld hl,$4000 ;address reg points to lcd instruction address
|
||||
LCD_INSTR_REG: EQU %00000000
|
||||
LCD_DATA_REG: EQU %00000001
|
||||
|
||||
;reset procedure
|
||||
ld a,%00111000
|
||||
ld (hl),a
|
||||
out (LCD_INSTR_REG),a
|
||||
ld a,%00001000
|
||||
ld (hl),a
|
||||
out (LCD_INSTR_REG),a
|
||||
ld a,%00000001
|
||||
ld (hl),a
|
||||
out (LCD_INSTR_REG),a
|
||||
|
||||
;init procedure
|
||||
ld a,%00111000
|
||||
ld (hl),a
|
||||
out (LCD_INSTR_REG),a
|
||||
ld a,%00001110
|
||||
ld (hl),a
|
||||
out (LCD_INSTR_REG),a
|
||||
|
||||
;write characters to display
|
||||
ld hl,$4001 ;address reg points to lcd data address
|
||||
|
||||
ld a,%01000100
|
||||
ld (hl),a
|
||||
out (LCD_DATA_REG),a
|
||||
ld a,%01100001
|
||||
ld (hl),a
|
||||
out (LCD_DATA_REG),a
|
||||
ld a,%01101110
|
||||
ld (hl),a
|
||||
out (LCD_DATA_REG),a
|
||||
ld a,%01101001
|
||||
ld (hl),a
|
||||
out (LCD_DATA_REG),a
|
||||
ld a,%01100101
|
||||
ld (hl),a
|
||||
out (LCD_DATA_REG),a
|
||||
ld a,%01101100
|
||||
ld (hl),a
|
||||
out (LCD_DATA_REG),a
|
||||
ld a,%01100101
|
||||
ld (hl),a
|
||||
out (LCD_DATA_REG),a
|
||||
ld a,%00100001
|
||||
ld (hl),a
|
||||
out (LCD_DATA_REG),a
|
||||
|
||||
halt
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user