Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

LCD with USB Toolstick c8051

0.00/5 (No votes)
22 Mar 2009 2  
LCD with USB Toolstick c8051

Introduction

This is a LCD (MC20E2D-SYL) 8-bit 2x20 LCD module with Silabs 'toolstick dauther (F330)' updated with new firmware (in 'timer.zip' - LCD controller) and 'debug adapter(F321)' (also known as 'toolstick EK') made unit.

IMG005s.JPG

Prototype

usbio.JPG

With that, you can send text to display connected through USB debug adapter.

Prototype board:
To use 'usbhidio' you must update firmware for 'debug adapter'.
Toolstick --really is named 'Debug adapter' firmware in download section at the top
(to update use 'toolstick base adapter').
On desktop, run usbhidio2.exe (VB6) and type text on screen. Make sure that baud is 9600 and you are ready.

Software can be modified and run independently by supplying power.
Connections are seen on this page: http://www.8051projects.net/lcd-interfacing/introduction.php.

lcdpins.jpg

I made it like this:

<------------------ 'Toolstick F330'-----------------> <---Display--->
P1.0 to P1.7 P0.6 P0.7 P0.4(TX) P0.5(RX) VDD(3V) GRD&RW 5V
^ ^ ^ ^ ? ^ ^ ^ ^
DB0 to DB7 EN RS RX(25) TX(26) PIN6 GRD USB

<--------Display-------> <------------- 'Debug adapter F321'------------>

To adjust background, replace resistor 1,5K between GRD and VEE(PIN3) on LCD.
Also on LCD input RW(PIN5) is tied to GRD.
See the image below for connections:

Click to enlarge image

This is a very small and accurate job - thus that can't solder- don't bother to.

Background

Take a look at the previous article Counter based c8051 and this CodeProject article LCD with parallel port.
Take a look at the next article USB IR with c8051.

Using the Code

On desktop application, just press enter on textbox to display data on LCD - For those that are interested in the code - here is the main routine:

void main (void)
{
    uchar i;
    uchar j;
    uchar dummy;
    PCA0MD &= ~0x40; 		// Clear watchdog timer enable
    Timer0_Init (); 		// Initialize the Timer0
    Port_Init (); 			// Init Ports
    //SYSCLK_Init (); 		// Initialize Oscillator
    UART0_Init();
    EA = TRUE; 			// Enable global interrupts
    LED=0;
    LCD_RS = 0;
    LCD_RW = 0;
    TimerStart( SYS_TIMER, 500 ); 	// wait for display to wake up
    while( !TimerReady( SYS_TIMER ));
    LCD_init();
    LCD_Home();
    LCD_sendstring("Start");
    /*
    move_to_specific(2, 1);
    LCD_sendstring("LCD second string");
    TimerStart( SYS_TIMER, 1000 ); 	// wait for display to wake up
    while( !TimerReady( SYS_TIMER ));
    LCD_Home();
    LCD_sendstring("UART");
    */
    while(1)
    {
        if(TX_Ready == 1 && UART_Buffer_Size != 0 && Byte == 13)
        {
            LCD_Clear();
            j=0;
           //--------------
           for(i = 0; i < (UART_Buffer_Size - 1); i++ ){ // Initialize software timers.
               if(j>19)
               {    //line full 
                    move_to_specific(2, 1);
                    j -= 20; } LCD_senddata(UART_Buffer[i]); j++;
               }
               //--------------
               TX_Ready = 0; 	// Set the flag to zero
               TI0 = 1; 		// Set transmit flag to 1
         }
    } 				// Loop forever
} 

Points of Interest

There are a lot of samples on the internet, but it is hard to find an article about displaying text through USB and using 8-bit LCD like MC20E2D-SYL.

History

  • 27th February, 2009: Initial post
  • 19th March, 2009: Article updated

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here