Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Library for LCD19264 with UC1609C display (Oshosoft)

DogFlu66

Member

UC1609C Driver

  • Developed using Pic18 Basic with the Oshonsoft v5.73 compiler.
  • Implements communication with the UC1609C graphical display controller via SPI.
  • Defines essential control pins (Reset, Chip Select, Command/Data, Clock, Data).
  • Provides functions for initialization, command transmission, and data writing.
  • Includes cursor control functions to set the display position.
  • Supports text rendering through character and string printing functions.
  • Implements pixel manipulation for basic graphics like lines and individual pixels.
  • Optimized for monochrome 128x64 display operation.

Implemented Functions

UC1609C_Locate

  • Positions the cursor to a specified row and column.
  • Translates text coordinates into display pixel locations.

UC1609C_Send_XY

  • Sets the internal cursor position using x (column) and y (page) coordinates.
  • Splits x into lower and upper nibbles and sends commands accordingly.

UC1609C_Print

  • Prints a string of characters on the display.
  • Iterates through each character and calls UC1609C_PutC.

UC1609C_PutC

  • Displays a single character on the screen.
  • Retrieves the font bitmap and sends data column by column.

UC1609C_PrintP

  • Prints a string of characters at a specific x, y position.
  • Allows custom character width and height.

UC1609C_PutCP

  • Displays a single character at a given x, y position.
  • Retrieves the font data and applies scaling for size adjustment.

UC1609C_Clear_Display

  • Clears the entire display by writing zeros to memory.
  • Iterates through all pages and columns.

UC1609C_Init

  • Initializes the UC1609C display.
  • Configures I/O pins, resets the display, and sends initialization commands.

UC1609C_Power_Down

  • Powers down the UC1609C display.
  • Executes the reset sequence to enter low-power mode.

UC1609C_Pixel

  • Draws a single pixel at an (x, y) coordinate.
  • Uses the vertical line function for precise control.

UC1609C_Line_H

  • Draws a horizontal line from (x, y) to (x2, y).
  • Calls the vertical line function for each pixel.

UC1609C_Line_V

  • Draws a vertical line from (x, y) downward.
  • Uses bitwise operations to set pixels within memory pages.
UC1906C_192x64.jpg
 

Attachments

  • UC1609C.bas
    17 KB · Views: 51
  • Tabla ASCII.bas
    10.9 KB · Views: 51
  • _Pic18F46K22Lib.bas
    43.4 KB · Views: 48
  • Test LCD UC1609C.bas
    2.2 KB · Views: 48
Last edited:
Will your PIC do 32MHz SPI?, the 18F27K42 I'm using will, with 32MHz or 64MHz Fosc, while the 16F18857 will only do 8MHz, at 32MHz Fosc.
According to the datasheet, the maximum SPI speed for the PIC18F46K22 is 16MHz (Fosc/4), with 64MHz being the maximum speed for the Fosc.
To run tests with higher speeds, I'd have to find a PIC with an equivalent pin size to mount on the same PCB.

Working with Fosc = 32Mhz and a clk for 8Mhz spi the erase function takes 7ms.
 
Last edited:
According to the datasheet, the maximum SPI speed for the PIC18F46K22 is 16MHz (Fosc/4), with 64MHz being the maximum speed for the Fosc.
To run tests with higher speeds, I'd have to find a PIC with an equivalent pin size to mount on the same PCB.

Working with Fosc = 32Mhz and a clk for 8Mhz spi the erase function takes 7ms.

The 18F27K42 series appears to operate differently to most other devices, and allows higher SPI speeds, perhaps there's an internal PLL for the SPI?.
 
I never got on with the k42 series.. I have oodles of pic18f46k42's on the shelf I bought them during Covid as a "just in case" as the k22 was getting harder to get.

I will probably sit down one day a figure out what to do with them
 
I never got on with the k42 series.. I have oodles of pic18f46k42's on the shelf I bought them during Covid as a "just in case" as the k22 was getting harder to get.

I will probably sit down one day a figure out what to do with them
Rather annoyingly, the flags and registers etc. often have different names, so there's a fair amount of editing required moving to the K42 series.


Such as the SPI Exchange Function:


C:
// 16F18857
uint8_t SPI1_ExchangeByte(uint8_t data)
{
    SSP1BUF = data;
    while(!PIR3bits.SSP1IF);
    PIR3bits.SSP1IF = 0;
    return SSP1BUF;
}

// 18F27K42
uint8_t SPI1_ExchangeByte(uint8_t data)
{
    SPI1TCNTL = 1;
    SPI1TXB = data;
    while(!PIR2bits.SPI1RXIF);
    return SPI1RXB;
}
 

Latest threads

New Articles From Microcontroller Tips

Back
Top