• AVR Freaks

OLed driver

Page: < 12 Showing page 2 of 2
Author
UpSpin
Starting Member
  • Total Posts : 26
  • Reward points : 0
  • Joined: 2012/02/15 07:34:17
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/03/26 08:32:35 (permalink)
0
Tedward

@UpSpin,

Did you ever get something working for the SSD1325 using a PIC24?  If so I'd be inetrested in leveraging whatever you got :D

Indeed. I connected it to the PMP in order to be able to read from it, which is quite useful. One byte in the graphics ram contains 2 Pixels. If you want to modify a single pixel you have to know the value of the pixel next to it, too. I didn't want to 'waste' RAM with a buffer, so I read the byte containing two pixels from the display, modified one of those two pixels and sent the byte back. That's simple, and with this I was able to implement the PutPixel function and use the Microchip graphic routines to output text and images.
I only implemented the most basic functions to test it. With it I was able to do everything, but not at the best efficiency. It was a test to see how the display looks like, in the end I used a different OLED using the SSD1322, so I haven't improved my code further.
For example images can be put out much faster if you don't use the PutPixel, which reads and writes a single pixel, but just send the whole byte containing two pixels. I seem to have implemented this for a 4bpp Bitmap, but nothing more.
 
If you plan to connect it via SPI you won't be able to read from the Display, thus, in order to modify a single pixel, you'll have to know the value of the second pixel next to it, which, in my opinion, requires a further display buffer in your microcontroller.
 
Below are the driver files. You also need to add the display related definitions to the hardwareprofile.h file, for which I attached an example snippet. You have to modify for your connections.
It's possible some includes aren't necessary, as I said, it was more a test than a perfectly written driver wink
 
I hope you get it working.
 
SSD1325.c:
/*****************************************************************************
*
* Module for Microchip Graphics Library
* Solomon Systech SSD1325 LCD controller driver
*
*****************************************************************************
* FileName: SSD1325.c
* Processor: PIC24FJ256GB108
* Compiler: C30 v3.23
*
* Author: Frank Maier
* Date: 07.07.2012
*
* Optimized for Solomon Systech SSD1325 LCD controller and
* Densitron DD-12864YO-7A OLED Display:
* 128x64 Dots, Passive Matrix (2.70")
* Monochrome Yellow
*
*****************************************************************************

Date Comments
--------------------------------------------------------------------------------
07-Jul-2012 Release
09-Jul-2012 Basic functions implemented, working
*/


/* TODO
- Implement faster 4BPP Image routine (write two pixels, don't read, use autoincrement and custom regions)
- Implement Hardware Accelerators (copy rectangle, ...)
- Allow Different orientations (Remap)
- Shut-Down procedure
*/

#include "HardwareProfile.h"

#if defined(USE_GFX_DISPLAY_CONTROLLER_SSD1325)

#include "Compiler.h"
#include "TimeDelay.h"
#include "DisplayDriver.h"
#include "SSD1325.h"
#include "Graphics.h"

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#if defined (USE_GFX_PMP)
#include "gfxpmp.h"
#elif defined (USE_GFX_PMP)
#include "gfxepmp.h"
#endif

// Color
GFX_COLOR _color;
#ifdef USE_TRANSPARENT_COLOR
GFX_COLOR _colorTransparent;
SHORT _colorTransparentEnable;
#endif

// Clipping region control
SHORT _clipRgn;

// Clipping region borders
SHORT _clipLeft;
SHORT _clipTop;
SHORT _clipRight;
SHORT _clipBottom;


/*********************************************************************
* Macros: SetAddress(lowerAddr,higherAddr)
* Overview: Sets the page and the lower and higher address pointer
* of the display buffer. All parameters should be pre-calculated.
* Input: page - Page value for the address.
* lowerAddr - Lower column address.
* higherAddr - Higher column address.
* Output: none
********************************************************************/
#define SetAddress(page, lowerAddr, higherAddr) \
DisplaySetCommand(); \
DeviceWrite(page); \
DeviceWrite(lowerAddr); \
DeviceWrite(higherAddr); \
DisplaySetData();



/*********************************************************************
* Function: void ResetDevice()
* Overview: resets LCD, initializes PMP
* Input: none
* Output: none
********************************************************************/
void ResetDevice(void)
{
// Initialize the device
// RES=0, Delay, RES=1 and init of PMP
DriverInterfaceInit();

DisplayEnable(); // Pull CS# LOW
DisplaySetCommand();

// Setup Display
DeviceWrite(0xAE); // turn off the display (AF=ON, AE=OFF)

// Set Display Clock Divide Ratio/Oscillator Frequency
DeviceWrite(0xB3);
DeviceWrite(0x91); // Set Clock as 135 Frames/Sec

//Set Multiplex Ratio
DeviceWrite(0xA8);
DeviceWrite(0x3F); // 1/64 Duty (0x0F~0x5F)

// Set Display Offset
DeviceWrite(0xA2);
DeviceWrite(0x44);
//DeviceWrite(0x4C);

// Set Display Start Line
DeviceWrite(0xA1);
DeviceWrite(0x00); // Set Mapping RAM Display Start Line (0x00~0x5F)

// Set Re-Map
DeviceWrite(0xA0);
DeviceWrite(0b11100011);
//DeviceWrite(0x50);
// Enable COM Split Odd Even
// Enable Nibble Re-map
// Enable Column Address Re-map

// Set Master Configuration
DeviceWrite(0xAD);
DeviceWrite(0x02); // Select external VCC supply

//Set Biasing Current for DC/DC converter
DeviceWrite(0xCF);
DeviceWrite(0xF0); // Not documented

//Set Current Range
DeviceWrite(0x86); // Set full Current Range

// Set Pulse Width for Gray Scale Table
// Set_Gray_Scale_Table_12864();

// Set Contrast Current
DeviceWrite(0x81);
DeviceWrite(0x7F); // full

// Set Row Period / Frame Frequency
DeviceWrite(0xB2);
DeviceWrite(0x46);

// Set Phase Length
DeviceWrite(0xB1);
DeviceWrite(0x22);

// Set Pre-charge Voltage
DeviceWrite(0xBC);
DeviceWrite(0x10);

// Set Pre-Charge Compensation
DeviceWrite(0xB4); // Set Pre-Charge Compensation Level
DeviceWrite(0x02); // Default => 0x00 (No Compensation)
DeviceWrite(0xB0); // Set Pre-Charge Compensation Enable
DeviceWrite(0x28); // Enable

// Set VCOMH Voltage
DeviceWrite(0xBE);
DeviceWrite(0x02);

// Set VSL
DeviceWrite(0xBF);
DeviceWrite(0x0D);

// Set Display Mode
DeviceWrite(0xA4); // Normal Display

// Clear Screen
DisplaySetData();
ClearDevice();
DisplayEnable();
DisplaySetCommand();

// Power Up Vcc
LATGbits.LATG1 = 1; // OLED DC pump on
DelayMs(100);

// Set Display On
DeviceWrite(0xAF);


DisplayDisable();
DisplaySetData();
}



#ifdef USE_TRANSPARENT_COLOR
/*********************************************************************
* Function: void TransparentColorEnable(GFX_COLOR color)
* Overview: Sets current transparent color.
* Input: color - Color value chosen.
* Output: none
********************************************************************/
void TransparentColorEnable(GFX_COLOR color)
{
_colorTransparent = color;
_colorTransparentEnable = TRANSPARENT_COLOR_ENABLE;

}
#endif



/*********************************************************************
* Function: void PutPixel(SHORT x, SHORT y)
* Overview: puts pixel
* Input: x,y - pixel coordinates
* Output: none
********************************************************************/
void PutPixel(SHORT x, SHORT y)
{
BYTE display;
BYTE x_dis;

// check if point is in clipping region
if(_clipRgn)
{
if(x < _clipLeft)
return;
if(x > _clipRight)
return;
if(y < _clipTop)
return;
if(y > _clipBottom)
return;
}


DisplayEnable();

x_dis = x >> 1; // divide by 2, because 1 Byte contains two pixels

SetAddress(0x15,x_dis,x_dis); // Set_Column_Address
SetAddress(0x75,y,y); // Set_Row_Address


// read current value of the two relevant pixels
display = SingleDeviceRead(); // Read to initiate Read transaction on PMP and dummy read
// (requirement for data synchronization in the controller)
display = SingleDeviceRead(); // Read again as a requirement for data synchronization in the display controller
display = SingleDeviceRead(); // Read actual data from from display buffer

// if x is odd we want to change the high part of the byte, first pixel
if(x & 1){
display &= 0xF;
display |= _color << 4;
}
// if x is even, change low part, second pixel
else {
display &= 0xF0;
display |= _color;
}

// write Byte containing changed and old pixel to display
DeviceWrite(display);

DisplayDisable();

}



/*********************************************************************
* Function: BYTE GetPixel(SHORT x, SHORT y)
* Overview: return pixel color at x,y position
* Input: x,y - pixel coordinates
* Output: pixel color
********************************************************************/
BYTE GetPixel(SHORT x, SHORT y)
{
BYTE display;
BYTE x_dis;

// check if point is in clipping region
if(_clipRgn)
{
if(x < _clipLeft)
return (0);
if(x > _clipRight)
return (0);
if(y < _clipTop)
return (0);
if(y > _clipBottom)
return (0);
}


DisplayEnable();

x_dis = x >> 1; // divide by 2, because 1 Byte contains two pixels

SetAddress(0x15,x_dis,x_dis); // Set_Column_Address
SetAddress(0x75,y,y); // Set_Row_Address


// read current value of the two relevant pixels
display = SingleDeviceRead(); // Read to initiate Read transaction on PMP and dummy read
// (requirement for data synchronization in the controller)
display = SingleDeviceRead(); // Read again as a requirement for data synchronization in the display controller
display = SingleDeviceRead(); // Read actual data from from display buffer

// if x is odd we want the high part of the byte, first pixel
if(x & 1){
display >>= 4;
}
// if x is even, low part, second pixel
else {
display &= 0xF;
}

DisplayDisable();

return (display); // return the result
}



/*********************************************************************
* Function: SetClipRgn(left, top, right, bottom)
* Overview: Sets clipping region.
* Input: left - Defines the left clipping region border.
* top - Defines the top clipping region border.
* right - Defines the right clipping region border.
* bottom - Defines the bottom clipping region border.
* Output: none
********************************************************************/
void SetClipRgn(SHORT left, SHORT top, SHORT right, SHORT bottom)
{
_clipLeft=left;
_clipTop=top;
_clipRight=right;
_clipBottom=bottom;

}



/*********************************************************************
* Function: SetClip(control)
* Overview: Enables/disables clipping.
* Input: control - Enables or disables the clipping.
* - 0: Disable clipping
* - 1: Enable clipping
* Output: none
********************************************************************/
void SetClip(BYTE control)
{
_clipRgn=control;
}



/*********************************************************************
* Function: IsDeviceBusy()
* Overview: Returns non-zero if LCD controller is busy
* (previous drawing operation is not completed).
* Input: none
* Output: Busy status.
********************************************************************/
WORD IsDeviceBusy(void)
{
return (0);
}



/*********************************************************************
* Function: void ClearDevice(void)
* Overview: clears screen with current color
* Input: none
* Output: none
********************************************************************/
void ClearDevice(void)
{
int i;
BYTE color;

DisplayEnable();

SetAddress(0x15,0x00,0x3F); // Set_Column_Address
SetAddress(0x75,0x00,0x4F); // Set_Row_Address

color = _color<<4;
color |= _color;

// Clear the device (64x128=8192, on byte = 2 pixel-->4096)
for (i=0;i<4096;i++){
DeviceWrite(color);
}

DisplayDisable();
}



/*********************************************************************
* Function: void PutImage4BPP(SHORT left, SHORT top, FLASH_BYTE* image, BYTE stretch)
* Overview: outputs 16 color image starting from left,top coordinates
* High Speed implementation.
* No stretching
* No pixel precise overlay
* No color palette
* No transparent color
* Input: left,top - left top image corner, image - image pointer,
* stretch - image stretch factor (not implemented)
* Output: none
* Note: image must be located in flash
********************************************************************/
void PutImage4BPP(SHORT left, SHORT top, FLASH_BYTE *image, BYTE stretch)
{
register FLASH_BYTE *flashAddress;
//register FLASH_BYTE *tempFlashAddress;
WORD sizeX, sizeY;
BYTE temp;
BYTE palette[16];
WORD counter;
//BYTE display;
WORD pixels;

// Move pointer to size information
flashAddress = image + 2;

// Read image size
sizeY = *((FLASH_WORD *)flashAddress);
flashAddress += 2;
sizeX = *((FLASH_WORD *)flashAddress);
flashAddress += 2;

// Read palette
for(counter = 0; counter < 16; counter++) {
palette[counter] = (BYTE) * (flashAddress + 1);
palette[counter] >>= 3;
palette[counter] &= 0x03;
flashAddress += 2;
}

DisplayEnable();

// Start at x half
// End at x half + size half - odd or even pixel width
SetAddress(0x15,left >> 1,(left >>1 ) + (sizeX >> 1) - !(sizeX & 0x01)); // Set_Column_Address
SetAddress(0x75,top,top + sizeY); // Set_Row_Address


pixels = sizeY * (sizeX >> 1);
for(counter = 0; counter < pixels; counter++) {

//SetColor(palette[temp >> 4]);
//SetColor(palette[temp & 0x0f]);

temp = *flashAddress;
flashAddress++;

//display = palette[temp & 0x0F] | palette[temp >> 4];

DeviceWrite(temp);
}

DisplayDisable();
}

#endif // #if defined(USE_GFX_DISPLAY_CONTROLLER_SSD1325)


 
SSD1325.h:
/*****************************************************************************
*
* Module for Microchip Graphics Library
* Solomon Systech SSD1325 LCD controller driver
*
*****************************************************************************
* FileName: SSD1325.h
* Processor: PIC24FJ256GB108
* Compiler: C30 v3.23
*
* Author: Frank Maier
* Date: 07.07.2012
*
* Optimized for Solomon Systech SSD1325 LCD controller and
* Densitron DD-12864YO-7A OLED Display:
* 128x64 Dots, Passive Matrix (2.70")
* Monochrome Yellow
*
*****************************************************************************/


#if defined(USE_GFX_DISPLAY_CONTROLLER_SSD1325)

#include "HardwareProfile.h"
#include "GenericTypeDefs.h"
#include "GraphicsConfig.h"
#include "Graphics.h"

#if defined (USE_GFX_PMP)
#include "gfxpmp.h"
#elif defined (USE_GFX_PMP)
#include "gfxepmp.h"
#endif

void PutImage4BPP(SHORT left, SHORT top, FLASH_BYTE *image, BYTE stretch);


#ifdef USE_16BIT_PMP
#error This driver doesn't support 16-bit PMP (remove USE_16BIT_PMP option from HardwareProfile.h)
#endif
#ifndef DISP_HOR_RESOLUTION
#error DISP_HOR_RESOLUTION must be defined in HardwareProfile.h
#endif
#ifndef DISP_VER_RESOLUTION
#error DISP_VER_RESOLUTION must be defined in HardwareProfile.h
#endif
#ifndef COLOR_DEPTH
#error COLOR_DEPTH must be defined in GraphicsConfig.h
#endif
#if (COLOR_DEPTH != 4)
#error Defined COLOR_DEPTH value is not suppported. Valid values are: 4"
#endif
#ifndef DISP_ORIENTATION
#error DISP_ORIENTATION must be defined in HardwareProfile.h
#endif

/*********************************************************************
* Overview: Horizontal and vertical screen size.
*********************************************************************/
#if (DISP_HOR_RESOLUTION != 128)
#error This driver doesn't supports this resolution. Horisontal resolution must be 128 pixels.
#endif
#if (DISP_VER_RESOLUTION != 64)
#error This driver doesn't supports this resolution. Vertical resolution must be 64 pixels.
#endif

/*********************************************************************
* Overview: Display orientation.
*********************************************************************/
#if (DISP_ORIENTATION != 0)
#error This driver doesn't support this orientation.
#endif

/*********************************************************************
* Overview: Defines the display offset in x direction. Dependent on the display
* used and how it is connected.
*********************************************************************/
#define OFFSET 2

/*********************************************************************
* Overview: Clipping region control codes to be used with SetClip(...)
* function.
*********************************************************************/
#define CLIP_DISABLE 0 // Disables clipping.
#define CLIP_ENABLE 1 // Enables clipping.

/*********************************************************************
* Overview: Screen Saver parameters.
* - SSON - Means that screen saver will be enabled when
* ScreenSaver(SSON) function is called with SSON as
* parameter.
* - SSOFF - Means that screen saver will be disbled when
* ScreenSaver(SSOFF) function is called with SSOFF as
* parameter.
*
*********************************************************************/
#define SSON 1 // screen saver is turned on
#define SSOFF 0 // screen saver is turned off

// Memory pitch for line
#define LINE_MEM_PITCH 0x100

/*********************************************************************
* Macros: SetPalette(colorNum, color)
*
* Overview: Sets palette register.
*
* PreCondition: none
*
* Input: colorNum - Register number.
* color - Color.
*
* Output: none
*
* Side Effects: none
*
********************************************************************/
#define SetPalette(colorNum, color)


#endif // _SH1101A_SSD1303_OLED_H

 
hardwareconfig.h:
#define USE_GFX_PMP
#define USE_8BIT_PMP

/*********************************************************************
* Overview: Display controller selection.
*
********************************************************************/
#define USE_GFX_DISPLAY_CONTROLLER_SSD1325
#define DISP_HOR_RESOLUTION 128
#define DISP_VER_RESOLUTION 64

/*********************************************************************
* Overview: Image orientation (can be 0, 90, 180, 270 degrees).
*********************************************************************/
#define DISP_ORIENTATION 0


/*********************************************************************
* BACKLIGHT CONTROL (these are dummy macros to satisfy common file gfxpmp.h)
*********************************************************************/
#define DisplayBacklightConfig()
#define DisplayBacklightOn()
#define DisplayBacklightOff()

/*********************************************************************
* EPMP TIMING PARAMETERS
*********************************************************************/
#define PMP_DATA_SETUP_TIME (0)
#define PMP_DATA_WAIT_TIME (45) // minimum pulse width requirement of CS controlled RD/WR access in SH1101A is 100 ns
// but since we have one cycle in setup and one cycle hold (minimum) we can estimate
// the wait time.
#define PMP_DATA_HOLD_TIME (20) // based on SH1101A data hold requirement

/*********************************************************************
* I/O FOR THE DISPLAY CONTROLLER
*********************************************************************/
// Definitions for reset pin (reset signal input)
// LOW = intitialization is executed. Keep HIGH during normal operation
#define DisplayResetConfig() TRISFbits.TRISF0 = OUTPUT_PIN
#define DisplayResetEnable() LATFbits.LATF0 = 0
#define DisplayResetDisable() LATFbits.LATF0 = 1

// Definitions for D/C# pin (Data/Command control pin)
// HIGH=Data at D[7:0] is treated as data. LOW=Data at D[7:0] is command
#define DisplayCmdDataConfig() TRISBbits.TRISB15 = OUTPUT_PIN
#define DisplaySetCommand() LATBbits.LATB15 = 0
#define DisplaySetData() LATBbits.LATB15 = 1

// Definitions for CS# pin (Chip Select Input)
// Chip is enabled for MCU communication only when CS# is pulled LOW
#define DisplayConfig() TRISDbits.TRISD11 = OUTPUT_PIN
#define DisplayEnable() LATDbits.LATD11 = 0
#define DisplayDisable() LATDbits.LATD11 = 1

#21
Tedward
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2013/03/13 08:44:08
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/03/26 08:54:54 (permalink)
0
Awesome! I'll give it a try.  Thanks for pointing out that connecting with SPI won't allow reading from the display, I'll go the PMP route as you suggest.
 
Thanks again :D
#22
Tedward
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2013/03/13 08:44:08
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/04/14 08:22:24 (permalink)
0
I'm getting ready to move ahead on this with my own PCB, I'm using a dsPIC33E256MU806 processor that I've used before and connecting the Newhaven NHD-2.7-12864UCY3 128x64 OLED Graphic Display using PMP.   I've looked at USpin's code (Thanks :D) and can see that I could create a graphics RAM buffer onboard the PIC and then use the buffer to write out pixels without having to read from the OLED to see what the adjacent pixel is set to.  I could also store a font as a table in program memory and use this to translate text to pixels written out to the display.  I have been studying the various stuff that uChip provides like GDD but I'm:
A) Getting confused and
B) Starting to think that I must be re-inventing the wheel.
 
All I want to do is to be able to write text to the display.  I have read that there is a way to download a font and turn it into a .c or .h file and then use it to look up the pixels needed.
 
Can someone give me a map of what I need to read / study in order to meet my aim without ending up with a million files and a bloatware result?
 
[EDIT]
I've managed to open the .chm help files now, in Windows 7 you have to right click the chm file, select properties, and click the [unblock] button (lower right).  There is a lot of stuff in there that shows that a whole lot of what I need has already been done like the OutText function that is part of the Graphics Primitives - this is where I'm struggling, WHERE is the starting point for all this stuff?  Alternatively, can someone point me to an example project that I could open that would be doing something similar to what I want so that I can decide which bits to pick from it.  Also, how do I get a font file?
post edited by Tedward - 2013/04/14 09:07:18
#23
UpSpin
Starting Member
  • Total Posts : 26
  • Reward points : 0
  • Joined: 2012/02/15 07:34:17
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/04/15 07:47:12 (permalink)
0
I did everything by stealing the code from the MPLAB Starter Kit for PIC24F
Its code is quite complex, because it creates a full GUI, but at least it contained what I needed to know and I was able to extract the necessary informations of what files I need and whatever.
Also take a look at AN1182.
 
Else I agree, I also haven't found a good guide to use the graphics library, because they all go to full GUI with buttons etc. (the whole GOL), which I don't need.
In the end, I used some sort of mix, I just included the necessary files and tried to get it working ^^
This means:
c-files: 
YourDisplayDriver.c
ACustomFont.c (created with the microchip tool)
Primitive.c
 
h-files: 
DisplayDriver.h
YourDisplayDriver.h 
ACustomfont.h
gfxcolors.h
gfxpmp.h
Graphics.h
GraphicsConfig.h
Primitve.h
 
To output some centered text/image:

InitGraph();
 
int height, width;

SetColor(BLACK); // set color to BLACK
ClearDevice(); // set screen to all BLACK

SetColor(WHITE);

SetFont((void *) &Verdana_12);
height = _fontHeight;

 width = GetTextWidth((XCHAR *)"Welcome", (void *) &Verdana_12);
 OutTextXY((GetMaxX() - width) >> 1, 0, (XCHAR *)"Welcome");

 width = GetTextWidth((XCHAR *)"to", (void *) &Volter__28Goldfish_29_9);
 OutTextXY((GetMaxX() - width) >> 1, height, (XCHAR *)"to");

SetFont((void *) &Font25);
 width = GetTextWidth((XCHAR *)"Microchip", (void *) &Font25);
 OutTextXY((GetMaxX() - width) >> 1, height+height, (XCHAR *)"Microchip");

 PutImage(20, 0, (void *) &yourimage, 1);

SetFont((void *) &Verdana_12);

MoveTo(0, 0);

 
whereas I created a file containing the font and image with the Microchip tool and included those files, too.
 
 
 
#24
Tedward
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2013/03/13 08:44:08
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/04/18 09:19:35 (permalink)
0
I'm getting somewhere but I have a load of unrecognized data types like BYTE, SHORT, WORD, DWORD
 
Are you using some kind of macro in a file that translates these?
 
[EDIT] I found them in GenericTypeDefs.h  
 
Now I have a problem  in SSD1325.c where DisplayEnable(); is causing a problem.  Onward, onward...
 
Going to be at Design West next week :D
post edited by Tedward - 2013/04/18 09:38:46
#25
Tedward
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2013/03/13 08:44:08
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/04/18 10:04:56 (permalink)
0
This is weird, I get the full compile run with just a couple of warnings.
 
Then I get a list of all the memory usage in blue.
 
Then there's an 2 line message as follows...
 
SSD1325.o(.text+0xc0): In function `ResetDevice':
C:\MP Projects\TacNet1\SSD1325.c:391: undefined reference to `Delay10us'
 
But SSD1325.c contains a "#include TimeDelay.h" and there's actually nothing on line 391 of the source code...
 
385    void ClearDevice(void)
386    { 
387       int i;
388       SHORT color;
389
390       DisplayEnable();
391      
392       SetAddress(0x15,0x00,0x3F);    // Set_Column_Address 
393       SetAddress(0x75,0x00,0x4F);    // Set_Row_Address
 
Any ideas anyone?
 
#26
UpSpin
Starting Member
  • Total Posts : 26
  • Reward points : 0
  • Joined: 2012/02/15 07:34:17
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/04/18 11:17:53 (permalink)
0
have you included the TimeDelay.c and TimeDelay.h files to your project tree?
 
DisplayEnable(); is a macro defined in HardwareProfile.h (I called it HardwareConfig.h by accident in my post above).
 
Always make sure you save your files before you compile or check the line number for error. It's possible that the error line number refers to the an old position which got changed by you while debugging.
#27
Tedward
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2013/03/13 08:44:08
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/04/18 12:09:27 (permalink)
0
You were right, I missed adding TimeDelay.c although the error messages were weirdly misleading.
 
I already figured out your misnaming of HardwareProfile.
 
Now it all compiles without errors :D
 
Next I need to figure out what it all does and expand upon it.
 
I see that the SSD1325 does have some hardware acceleration features, any hints on how I add that?  The stuff I read on the MCHP Graphics library suggests that hardware acceleration is a separate driver file.
#28
UpSpin
Starting Member
  • Total Posts : 26
  • Reward points : 0
  • Joined: 2012/02/15 07:34:17
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/04/18 13:04:32 (permalink)
0
I wouldn't waste any time with the hardware acceleration in the beginning. The display controller supports a specific set of commands which improves specific tasks, like drawing a rectangle or moving content around. You barely have a use for this, especially not in the beginning.
 
For implementation, I haven't done it, but if you extend the display driver with further commands like draw a rectangle or bar you can use the graphic acceleration commands instead of drawing every single pixel.
If you implement a graph you might have a use for the horizontal scrolling.
#29
Tedward
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2013/03/13 08:44:08
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/04/19 04:07:49 (permalink)
0
10-4 Uspin, thanks for all your help so far :D
#30
JA
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2013/10/16 14:18:53
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/10/16 14:23:24 (permalink)
0
Hi UpSpin,
Did you ever get a driver written for the SSD1322? If so, would you be willing to share it? I am completely new to OLEDs and need a driver to verify a hardware design. Thanks!
#31
UpSpin
Starting Member
  • Total Posts : 26
  • Reward points : 0
  • Joined: 2012/02/15 07:34:17
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/10/16 23:00:11 (permalink)
+1 (1)
I've attached the driver for the SSD1322.
I haven't cleaned it, so it may contain a few includes and functions you don't need in the beginning (like BitmapDecoder). Make sure to remove the ones.
 
Just report how it's working :-)
 
 
#32
JA
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2013/10/16 14:18:53
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/10/17 17:55:18 (permalink)
0
Hi UpSpin,
Thanks a lot for posting! I got everything to compile and run, however, when I call ResetDevice() and then TestDisplay(), I get nothing. 
I noticed that towards the end of ResetDevice(), under "Power up Vcc" you set RG1 high, which indicates to me that you implemented some sort of switch for Vcc. I have Vcc permanently tied to 14.5V. I also have CS# permanently tied low (see attached  chematic (Untitled.gif) showing how I connected the OLED). This was according to the datasheet for the OLED (USMP-P21302-A01) - see Untitled2.gif. This is also similar to what is shown in the SSD1322 spec on page 53:
http://www.displayfuture.com/Display/datasheet/controller/SSD1322.pdf

OLED_RD and OLED_WR are connected to PMRD and PMWR, respectively. OLED[D7:D0] are connected to PMD[7:0]. OLED_DC and OLED_RES are connected to RB10 and RA7, respectively whereas yours appear to be connected to RB15 and RA7 - I made the appropriate changes in HardwareProfile.h.
The other thing that I noticed in RestDevice() is that you are Enabling External VSL by writing to 0xB4 - there is no mention of this register in the Command Table (table 9.1) in the SSD1322 document. Im not even exactly sure what/how VSL works, however I apparently am using external VSL according to my schematic.
 
Any ideas on what I could be missing?
Thanks again!
 
 
 
 
 

Attached Image(s)

#33
UpSpin
Starting Member
  • Total Posts : 26
  • Reward points : 0
  • Joined: 2012/02/15 07:34:17
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/10/18 00:33:39 (permalink)
0
Mhh, I don't know what PIC you use and also don't know what  RB10 and RA7 are connected to.
Make sure that the analog functions of this pins are deactivated!
 
OLED_DC is connected to  RB15, which must be PMA0 of your PMP as far as I remember.
The way CS# is connected just means, that the Display is always active and no other devices are allowed to be connected to the PMP. That shouldn't be the problem.
OLED_RES can be any normal pin.
 
And yes, I turn the DC/DC converter on by a dedicated pin. However, while it's recommended in the datasheet, it's not necessary, because many ready to use OLED modules with a DC/DC converter on their PCB also keep the DC pump on all the time, without doing any harm.
 
You seem to have an older datasheet. I have a newer one (http://www.densitron.com/.../Support/SSD1322.pdf), which contains this information, and also the datasheet for my display had this command in its turn on sequence.
 
An even simpler test than the TestDisplay() routine is to send instead of the A6 command the A5 command which turns on the whole display, and then of course skip the ClearScreen but don't forget to set the display on. (so just change the ResetDevice function appropriately) That way you can check if the commands get accepted properly and maybe just some different address remapping is required for your display.
#34
JA
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2013/10/16 14:18:53
  • Location: 0
  • Status: offline
Re: RE: OLed driver 2013/10/18 17:14:51 (permalink)
0
Thanks again UpSpin,
I didn't have a lot of time to look at this today, but I think that one of my problems is that I do NOT have PMA0 connected to the DC pin, I have it connected to the RES (reset) pin.  It does look like, by setting PMAEN bits 1:0 = 0, I can make PMA0 function like an I/O pin. I am using a PIC32MX795F512L and, like I mentioned above connected just a random I/O pin (RB10) to DC on the OLED. Hopefully I can modify your routines to toggle RB10 to specify data/command. Ill keep ya posted. 
Thanks again
#35
Page: < 12 Showing page 2 of 2
Jump to:
© 2021 APG vNext Commercial Version 4.5