Olimex Support Forum

Microcontrollers => PIC => Topic started by: alone666 on June 28, 2014, 01:46:52 pm

Title: PIC-LCD Display in Assembly
Post by: alone666 on June 28, 2014, 01:46:52 pm
I purchased the PIC-LCD and I'm supposed to program it in assembly (required for an accurate count of the time).

I noticed that in the page of the device
is linked an example with libraries written in C for the LCD (LCD449STK) .
LCD demo (C source and HEX) -> lcd.c and lcd.h

Could I use these libraries in my assembly code using mplab ide + c18 ? or  I still have to write an assembly driver for the display (lot of time lost)?

I have found this post in the forum and it has been useful to understand how I should do it eventually.
Quote from: LubOlimex on January 16, 2013, 01:28:02 pm
Hey R0cket,

As Tsvetan said for PIC-LCD, check the PIC datasheet. The registers would depend on the controller! The explanation below is for PIC18F8490 only. I think this is the easier way to explain it.

Download this datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/39629c.pdf (http://ww1.microchip.com/downloads/en/DeviceDoc/39629c.pdf) and the PIC-LCD's schematic: https://www.olimex.com/Products/PIC/Development/PIC-LCD/resources/PIC-LCD-SCH-REV-D.pdf (https://www.olimex.com/Products/PIC/Development/PIC-LCD/resources/PIC-LCD-SCH-REV-D.pdf) and finally the example to run in MPLAB: https://www.olimex.com/Products/PIC/Development/PIC-LCD/resources/PIC-LCD_LCD.zip (https://www.olimex.com/Products/PIC/Development/PIC-LCD/resources/PIC-LCD_LCD.zip). Now you open the datasheet and go to page 257, PART22: LIQUID CRYSTAL DISPLAY (LCD) DRIVER MODULE. There are a lot of good tables and registers you might want to check but we will head for the table on page 279 (table 22-6). Now you have also to open the schematic of the PIC-LCD and zoom at the LCD part and also have the schematic of the display open. The rows of display table are pins of the processor with names S45 to S0 (and some extra names), that is why you need to check which pin is exactly representing your chosen symbol in the board's schematic(they are not shown in display's datasheet since you might use other video controller - not the mentioned PIC). After that you should see which of the four COMs it represents - depending on the row(being in second row means COM2, being in third row means COM3, etc). Then in PIC18F8490's datasheet (Table 22-6) you find the box which contains the Sxx (the number from the schematic for example S45 or S32) concatenated with Cx (COM number) - this will give you the register and the bit you need to set.

Please also check page 278 (22.11 Configuring the LCD Module). These are things to consider before setting any part of the module. Remember the above is true only for PIC18F8490, if you use MSP processor you have to do approximately the same but using the respective processor datasheet.

Here some explanation of the above visually: http://i.imgur.com/QNshu.png (http://i.imgur.com/QNshu.png)

I don't know if I explained it very well but this is the best explanation I can pull on the subject. The single page about the display is sufficient enough for the display, the rest depends on the video controller's datasheet.

Best regards,

sorry for my poor english !

Best regards