Hi, I want to make a program in Matlab (simulink) which will display a data on the lcd display HD444780 attached to F28335.
I'm using Matlab with CCstudio 3.3 with TMS320F28335 Experimenter Kit.
I make the program in CCStudio which I use to interface with LCD and it works fine. I used 4-bit interface and connected to the pins:
| LCD | F28335 |
|
D7 D6 D5 D4 E RS |
- GPIO34 - GPIO32 - GPIO30 - GPIO28 - GPIO87 - GPIO22 |
and for example here is the part of the code, the function for the init LCD display:
| void Gpio_init_lcd(void) { short j; Gpio_select(); // ---------------------------------------------------- for(j=0; j<100; j++) DELAY_US(500); // -------- Function set --------------------------- GpioDataRegs.GPASET.bit.DB5 = 0x1;//Set DB5 f_send(); f_send(); GpioDataRegs.GPACLEAR.bit.DB5 = 0x1;//Clear DB5 GpioDataRegs.GPBSET.bit.DB7 = 0x1;//Set DB7 f_send(); // --------- Delay more than 39 uS------- DELAY_US(500); // -------- Display on/off control -------- GpioDataRegs.GPBCLEAR.bit.DB7 = 0x1;//Clear DB7 GpioDataRegs.GPACLEAR.bit.DB5 = 0x1;//Clear DB5 f_send(); GpioDataRegs.GPBSET.bit.DB7 = 0x1;//Set DB7 GpioDataRegs.GPBSET.bit.DB6 = 0x1;//Set DB6 GpioDataRegs.GPASET.bit.DB5 = 0x1;//Set DB5 GpioDataRegs.GPASET.bit.DB4 = 0x1;//Set DB4 f_send(); // --------- Delay more than 39 uS------- DELAY_US(50); // --------- Display clear ----------------- GpioDataRegs.GPBCLEAR.bit.DB7 = 0x1;//Clear DB7 GpioDataRegs.GPBCLEAR.bit.DB6 = 0x1;//Clear DB6 GpioDataRegs.GPACLEAR.bit.DB5 = 0x1;//Clear DB5 GpioDataRegs.GPACLEAR.bit.DB4 = 0x1;//Clear DB4 f_send(); GpioDataRegs.GPASET.bit.DB4 = 0x1;//Set DB4 f_send(); // --------- Delay more than 1.53 mS------- for(j=0; j<20; j++) DELAY_US(100); // --------- Entry mode set ----------------- GpioDataRegs.GPACLEAR.bit.DB4 = 0x1;//Clear DB4 f_send(); GpioDataRegs.GPBSET.bit.DB6 = 0x1;//Set DB6 GpioDataRegs.GPASET.bit.DB5 = 0x1;//Set DB5 f_send(); f_string("Testing LCD"); } |
Now, I have no idea how to implement this with the simulink?
I want to make the block in the simulink which I will use when I need to interface with LCD, but have no idea how and where to start?
I was thinking to make interface via SPI interface and connection LCD with 74HC595 ,but first I would like to know how to implement the above code with the simulink.
Btw I know how to implement all blocks in the simulink library "Target support package" for C2000/F28335.
