MetkuMods

OLED Technology by 4D Systems


 
Author: Aki Korhonen
Published: 25.06.2009
Product manufacturer: 4D Systems
In English In English
Suomeksi Suomeksi

ĀµOLED-96-G1, 0.96" OLED module - Usage

The usage of the display module is quite straight forward; just plug the serial adapter to the display and upload your piece of software or send serial commands to control it.

There are two different firmwares for the module; the first one is a serial platform firmware (the module came with this loaded to it) and the second firmware is for running 4DGL programs in the module. Both of these firmwares can be found via the product page and they are changed with the PmmC Loader, which is very easy to use; just select the correct firmware file, choose your COM port and click Load.

 

Introcution to 4D Systems OLED Technology
PmmC Loader

 

4DGL Platform

4DGL is a graphics oriented programming language that is made for PICASO and GOLDELOX processors to be run on their own on the modules. 4DGL has a good library of different graphics, text and file system functions (and touch panel related functions for displays with Picaso and touch panel) for easy and fast code development. If you have some coding experience with C, Java, Basic, Pascal etc, you shouldn't have problems with 4DGL. For 4DGL development you'll need 4DGL Workshop from 4D System's website.

More in-depth info, downloads and manuals are available at 4DGL developers corner:

 

Introcution to 4D Systems OLED Technology
4DGL Workshop

 

Starfield effect made with 4DGL

Well, this doesn't really get everything out from the display, but it was mainly a coding practice for myself to learn a bit of 4DGL's syntax. The code is mostly a C to 4DGL conversion of the starfield code found from The Demo Effects Collection. For this example the 4DGL platform firmware has to be loaded to the module.

Get Flash to see this player.


The code:

#platform "uOLED-GOLDELOX"

/*************************************************
* MetkuMods - http://metku.net/
*
* Filename: goldelox_starfield.4dg
* Created: 2009/04/20
* Author: Aki Korhonen
* Description: Starfield for Goldelox
**************************************************/

#inherit "4DGL_16bitColours.fnc"

#constant NUMBER_OF_STARS 40
#constant STAR_ARRAY_SIZE 200 // NUMBER_OF_STARS * 5
#constant SCREEN_WIDTH 96
#constant SCREEN_HEIGHT 64

// 0 = xpos
// 1 = ypos
// 2 = zpos
// 3 = speed
var stars[STAR_ARRAY_SIZE];

func init_star(var i)
	stars[i*5+0] := RAND() % 20;
	stars[i*5+1] := RAND() % 20;
	
	stars[i*5+0] := stars[i*5+0] * 300;
	stars[i*5+1] := stars[i*5+1] * 300;
	
	stars[i*5+2] := i;
	stars[i*5+3] := 2 + ABS(RAND() % 3);
endfunc

func init()
	var i;
	
	i := 0;
	while(i++<NUMBER_OF_STARS)
		init_star(i);
	wend
endfunc

func main()
	var centerx, centery;
	var i, tempx, tempy;
	
	init();
	
	centerx := SCREEN_WIDTH >> 1;
	centery := SCREEN_HEIGHT >> 1;
	
	while(1)
		// Clear screen
		gfx_Cls();
		
		// Move and draw stars
		i := 0;
		while(i++<NUMBER_OF_STARS)
			stars[i*5+2] := stars[i*5+2] - stars[i*5+3];
			
			if(stars[i*5+2] <= 0)
				init_star(i);
			endif
			
			// Compute 3D position
			tempx := (stars[i*5+0] / stars[i*5+2]) + centerx;
			tempy := (stars[i*5+1] / stars[i*5+2]) + centery;
			
			// Check if a star leaves the screen
			if(tempx < 0 || tempx > SCREEN_WIDTH - 1 ||
			   tempy < 0 || tempy > SCREEN_HEIGHT - 1)
				init_star(i);
			endif
			
			gfx_PutPixel(tempx, tempy, WHITE);
		wend
        
        pause(2);
	wend
endfunc






Pages:  1 2 3 4 5 6 7 8 9 10 11 12 


 
  Content in english!
  Sisältö suomeksi!

 Google





 .:Back to top Bandwidth by Mpoli

Copyright © Metku.net, All Rights Reserved.
All content and graphics in MetkuMods are sole property of Jani Pönkkö and may not be reproduced or copied in any manner without written permission from him.
All brand names, trademarks and copyrights are the property of their respective owners.Privacy Policy