E

MikroC pic- VGA_Pal kütüphanesi

Başlatan Erata, 08 Kasım 2012, 07:31:45

Erata


video composit giris olan Herhangi bir  tv ye  pic ile  bilgi yollamak icin mukemmel bir kütüphane

acık kaynak dosyaları ve örnek mevcut









PROJECT DOWNLOAD

You can use this software as you wish, if you accept to do it at your own risks.

Download PIC PAL Library with demo example for mikroC : zipped file, 29.64 Ko
http://www.micro-examples.com/pics/089-PIC-PAL-TV-mikroc_project.zip

content of the archive :

    PAL_library.c, 37 Ko : library C source code
    PAL_library.h, 2 Ko : library C definitions
    PALdemo.c, 15 Ko : demo example C source code
    PALdemo.eed, 1 Ko : PIC EEPROM definition
    PALdemo.hex, 46 Ko : demo example HEX file for PIC18F4620
    PALdemo.ppc, 2 Ko : mikroC project file
    pictures.h, 9 Ko : demo example picture bitmap

You can get mikroC from here : http://www.mikroe.com/en/compilers/mikroc/pic/






Kaynak : http://www.micro-examples.com/public/microex-navig/doc/089-pic-pal-tv#1

Erata

INITIALIZATION

PROTOTYPE    void    PAL_init(unsigned char y)
PARAMETERS    

y : number of vertical lines, up to 128
RETURNS    nothing
DESCRIPTION    

prepare the PIC PAL video library
the more vertical lines you want, the less memory & MPU power you have

Warnings :

    this library takes control of TIMER 0 and associated interrupts !
    this library takes control of the PORTD !

REQUIRES    

the file PAL_library.h must be included in user's source code.

specified hardware with 2 resistors, see schematic
the device must be clocked at 32 Mhz
EXAMPLE    PAL_init(128) ;

Video control

PROTOTYPE    void    PAL_control(unsigned char st, unsigned char rd)
PARAMETERS    

st : PAL synchronization control
PAL_CNTL_START : start PAL synchro
PAL_CNTL_STOP : stop PAL synchro (free all MCU power)

rd : rendering control
PAL_CNTL_BLANK : only borders are displayed (free a part of MCU power)
PAL_CNTL_RENDER : full video is rendered, with borders and picture (most of MCU power is required)
RETURNS    nothing
DESCRIPTION    

control the video generation

when the PAL synchro is started, the unsigned long global variable PAL_frameCtr is incremented 25 times per second.
REQUIRES    

PAL_init() must have been called
EXAMPLE    PAL_control(PAL_CNTL_START, PAL_CNTL_RENDER) ;

FILL SCREEN

PROTOTYPE    void    PAL_fill(unsigned char c)
PARAMETERS    

c : filling pattern
RETURNS    nothing
DESCRIPTION    

fill screen with pattern c
use 0 to clear the screen, 0xff to paint the screen in white
REQUIRES    

PAL_init() must have been called
EXAMPLE    PALL_fill(0) ;

SET SCREEN BORDER COLOR

PROTOTYPE    void    PAL_setBorder(unsigned char border)
PARAMETERS    

border : either PAL_COLOR_BLACK or PAL_COLOR_WHITE
RETURNS    nothing
DESCRIPTION    

change the screen border color surrounding the picture
REQUIRES    

PAL_init() must have been called
EXAMPLE    PAL_border(PAL_COLOR_BLACK) ;

SET PIXEL

PROTOTYPE    void    PAL_setPixel(char x, char y, unsigned char mode)
PARAMETERS    

x : pixel column, from 0 to 127
y : pixel row, from 0 to the number of lines - 1
mode : pixel color, either PAL_COLOR_BLACK,  PAL_COLOR_WHITE or PAL_COLOR_REVERSE
RETURNS    nothing
DESCRIPTION    

set the color of the pixel located a column x, row y
REQUIRES    

PAL_init() must have been called
EXAMPLE    PAL_setPixel(10, 20, PAL_COLOR_REVERSE) ;

draw a line

PROTOTYPE    void PAL_line(char x0, char y0, char x1, char y1, unsigned char mode)
PARAMETERS    

x0, y0 : column and row of the start of the line
x1, y1 : column and row of the end of the line
mode : pixel color, either PAL_COLOR_BLACK,  PAL_COLOR_WHITE or PAL_COLOR_REVERSE
RETURNS    nothing
DESCRIPTION    

draw a line from (x0, y0) to (x1, y1)
REQUIRES    

PAL_init() must have been called
EXAMPLE    PAL_line(0, 0, 127, 127, PAL_COLOR_WHITE) ;

DRAW A CIRCLE

PROTOTYPE    void PAL_circle(char x, char y, char r, unsigned char mode)
PARAMETERS    

x : column of the center of the circle
y : row of the center of the circle
r : radius of the circle
mode : pixel color, either PAL_COLOR_BLACK,  PAL_COLOR_WHITE or PAL_COLOR_REVERSE
RETURNS    nothing
DESCRIPTION    

draw a circle of radius r centered at (x, y)
REQUIRES    

PAL_init() must have been called
EXAMPLE    PAL_circle(30, 30, 5, PAL_COLOR_WHITE) ;

DRAW A SOLID BOX

PROTOTYPE    void PAL_box(char x0, char y0, char x1, char y1, unsigned char mode)
PARAMETERS    

x0, y0 : top left of the box
x1, y1 : bottom right of the box
mode : pixel color, either PAL_COLOR_BLACK,  PAL_COLOR_WHITE or PAL_COLOR_REVERSE
RETURNS    nothing
DESCRIPTION    

fill a rectangle from corner (x0, y0) to corner (x1, y1)
REQUIRES    

PAL_init() must have been called
EXAMPLE    PAL_box(10, 10, 30, 30, PAL_COLOR_WHITE) ;

draw a rectangle

PROTOTYPE    void PAL_rectangle(char x0, char y0, char x1, char y1, unsigned char pcolor)
PARAMETERS    

x0, y0 : top left of the rectangle
x1, y1 : bottom right of the rectangle
mode : pixel color, either PAL_COLOR_BLACK,  PAL_COLOR_WHITE or PAL_COLOR_REVERSE
RETURNS    nothing
DESCRIPTION    

draw a rectangle from corner (x0, y0) to corner (x1, y1)
REQUIRES    

PAL_init() must have been called
EXAMPLE    PAL_rectangle(10, 10, 30, 30, PAL_COLOR_WHITE) ;

draw a character

PROTOTYPE    void  PAL_char(unsigned char x, unsigned char y, unsigned char c, unsigned char size)
PARAMETERS    

x : pixel column of the top left position of the character, from 0 to 127
y : pixel row of the character, from 0 to number of vertical pixels
c : ASCII code of the char
size : high nibble is height multiplier, low nibble is width multiplier
predefined sizes : PAL_CHAR_STANDARD, PAL_CHAR_DWIDTH, PAL_CHAR_DHEIGHT, PAL_CHAR_DSIZE
RETURNS    nothing
DESCRIPTION    

draw char c at (x, y), always in white on black (use PAL_box() to reverse video)
REQUIRES    

PAL_init() must have been called
EXAMPLE    PAL_char(3, 5, 'A', PAL_CHAR_DSIZE) ;

DRAW A STRING

PROTOTYPE    void  PAL_write(unsigned char lig, unsigned char col, unsigned char *s, unsigned char size)
PARAMETERS    

lig : text line of the string
col : text column of the string
s : pointer to the string (NULL terminated)
size : high nibble is height multiplier, low nibble is width multiplier
predefined sizes : PAL_CHAR_STANDARD, PAL_CHAR_DWIDTH, PAL_CHAR_DHEIGHT, PAL_CHAR_DSIZE
RETURNS    nothing
DESCRIPTION    

write string s at position (lig, col)
REQUIRES    

PAL_init() must have been called
EXAMPLE    

PAL_write(0, 5, myString, PAL_CHAR_STANDARD) ;

DRAW a CONSTANT STRING

PROTOTYPE    void  PAL_constWrite(unsigned char lig, unsigned char col, const unsigned char *s, unsigned char size)
PARAMETERS    

lig : text line of the string
col : text column of the string
s : pointer to the constant string (NULL terminated)
size : high nibble is height multiplier, low nibble is width multiplier
predefined sizes : PAL_CHAR_STANDARD, PAL_CHAR_DWIDTH, PAL_CHAR_DHEIGHT, PAL_CHAR_DSIZE
RETURNS    nothing
DESCRIPTION    

same as PAL_write(), but s is a string located in ROM
REQUIRES    

PAL_init() must have been called
EXAMPLE    PAL_write(0, 5, myConstantString, PAL_CHAR_STANDARD) ;

DRAW A PICTURE

PROTOTYPE    void    PAL_picture(unsigned char x, unsigned char y, const unsigned char *bm, unsigned char sx, unsigned char sy)
PARAMETERS    

x : top left pixel column of the picture
y : top left pixel row of the picture
bm : pointer to a bitmap picture in ROM
sx : width of the picture
sy : height of the picture
RETURNS    nothing
DESCRIPTION    

draw the picture pointed to by bm at position (x, y)
bitmap is arranged as a monochrome bitmap, use mikroElektronika GLCD bitmap editor and select T6963 to convert bitmap into source code
REQUIRES    

PAL_init() must have been called
EXAMPLE    

PAL_picture(0, 0, pict, 128, 128) ;

VIDEO ROUTINE

PROTOTYPE    void    PAL_ISR()
PARAMETERS    

none
RETURNS    nothing
DESCRIPTION    

this function must not be called directly by user, but must be placed within the interrupt() function.

Warning : other interrupts may cause bad video synchronization if they are enabled.
REQUIRES    

PAL_init() must have been called
EXAMPLE    

void    interrupt(void)
        {
        PAL_ISR() ;
        }

Powered by EzPortal