Hi all,
I’m playing around with the de2-2c35 fpga board. I’ve discovered this article https://publications.lib.chalmers.se/records/fulltext/146808.pdf
about the LCD driver for this board, there is a apblcd.vhd file inside the leon3 repo.
However I can’t find the apblcd.c, apblcd.h files, does anyone know where I could find those?
Thanks a lot and have a nice day!
Your fellow programmer Ewout
I managed to fix it myself. Just in case somebody else also runs into this problem, here is my solution.
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
unsigned int *lcd_base = (int *)0x80000400;
void delay_ms(uint32_t ms) {
for (uint32_t cnt = 0; cnt < ms * 5000; cnt++)
;
}
void lcd_init() {
delay_ms(15);
*lcd_base = 0x000000030;
delay_ms(5);
*lcd_base = 0x000000030;
delay_ms(2);
*lcd_base = 0x000000030;
delay_ms(2);
*lcd_base = 0x000000038; // Function set
delay_ms(2);
*lcd_base = 0x00000000E; // Display on/off controll
delay_ms(2);
*lcd_base = 0x000000001; // Display clear
delay_ms(2);
*lcd_base = 0x000000006; // Entry mode set
}
void char_lcd(uint8_t character) {
delay_ms(1);
*lcd_base = *lcd_base + character;
}
void str_lcd(uint8_t str[], uint8_t len) {
for (uint8_t i = 0; i < len; i++) {
if (i == 12) {
delay_ms(2);
*lcd_base = 0x0000000C0;
}
char_lcd(str[i]);
}
}
int main(void) {
uint8_t str[27] = "Leonidas histhird softcore";
lcd_init();
str_lcd(str, sizeof(str));
return 0;
}