Forum Discussion
Altera_Forum
Honored Contributor
12 years agoHi,
I want to give you some hints to get it running. it's not very difficult to get it running on a baremetal system. You can still use the hwlib. There is a headerfile called alt_i2c.h. This file contains a lot of definitions, needed to implement an i2c driver for your application. To write something to the LCD you have to do the following steps: first step: you need to write an init-function for the i2c interface. here you have to do the following steps:- Disable the i2c controller by clearing the enabled bit in the alt_i2c_en register
- set the controller to master mode (register alt_i2c_con_mst_mod)
- set the speed to standard (the newheaven display only supports 100khz clock rate) (register alt_i2c_con_speed)
- enable the i2c controller (set enabled bit in the alt_i2c_en register)
- write the address of the slave to the alt_i2c_tar register
- to send data you have to set the ALT_i2c_data_cmd_cmd Register to WRITE
- write the data to the alt_i2c_data_cmd_dat Register
- Slave address is 0x28 (and not 0x50)
- between the commands you send, you need a delay (normally 100µs).
- A full list of special commands for the display you can find in the newheaven specification. (Download it from the newheaven website. The LCD is the NHD-0216K3Z)