HÅLLOKALISERING - Örebro universitet
HÅLLOKALISERING - Örebro universitet
HÅLLOKALISERING - Örebro universitet
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Atlas Copco Rock Drills AB<br />
ÖREBRO<br />
Dokument - Document<br />
Examensarbete - Hållokalisering<br />
Uppgjord tjst, namn, tfn - Prepered dept, name, telephone Kontr - Chk Rev Dokumentnummer - Document number<br />
UTSBP Bertil Planeskog, 5423 A<br />
Bilaga 2 – FL.C<br />
//=======================================================<br />
// Created by Bertil Planeskog<br />
// Student at <strong>Örebro</strong> University (electrical engineering)<br />
// Period: 20010820-20020124 (20p)<br />
// Titel: Hole-localisation<br />
// Company: Atlas Copco Rock Drills AB<br />
// Filename: FL.C<br />
//=======================================================<br />
/*=======================================================<br />
| Description: This program is a demo/testing program for the<br />
| FrameLocker video frame grabber.<br />
|<br />
| IMPORTANT NOTE !<br />
|<br />
| The function "do_it()" contains almost all routines<br />
| that have to do with image grabbing & uploading.<br />
| This program "grabs" an image with the board and<br />
| puts it into the VGA screen. The VGA is set into<br />
| the 320 x 200 pixels, 256 colors mode. See the init()<br />
| function for FrameLockers initialization.<br />
|<br />
| All functions with the FL_ prefix are in the FLLIB-<br />
| library.<br />
|<br />
| Refer to the Bt819 specifications for a closer<br />
| description on the registers.<br />
|<br />
| Disclaimer: The code in this module is not guaranteed to be<br />
| correct and free of defects. Ajeco shall under no<br />
| circumstances be liable for incidental or conse-<br />
| quential damages or related expenses resulting from<br />
| use of Ajeco's products or programs even if it has<br />
| been notified of the possibility of such damages.<br />
|<br />
| Copyright (C) 1994, 1995, 1996 Ajeco Oy<br />
|<br />
| Ajeco Oy<br />
| Takkatie 7A<br />
| FIN-00370 Helsinki<br />
| Finland<br />
|<br />
| Tel: +358-9-7003 9200 Fax: +358-9-7003 9209<br />
|<br />
=======================================================*/<br />
#include <br />
#include <br />
#include <br />
#include <br />
#include <br />
#include <br />
#include <br />
#include "commlib.h" // Commlib serial communication functions<br />
#include "fllib20.h" // FrameLocker library functions<br />
#include "fl.h" // Function prototypes<br />
#define TRUE 1<br />
#define FALSE 0<br />
#define VGAGRAPHICS 1<br />
#define VGATEXT 2<br />
/* Global variables used in this demo only */<br />
int g_videomode = -1;<br />
int g_contr;<br />
int g_bright;<br />
int g_pixels;<br />
int g_lines;<br />
int g_maxpix;<br />
int gray;<br />
int min; // Smalest greyscale-value in image<br />
int max; // Maximum greyscale-value<br />
int n_pix=1500; // Level of black pixels in image<br />
int dist=10;<br />
int erode_on=0;<br />
int koord_on=0;<br />
static unsigned char org_matris[300][160];<br />
static unsigned char matris[300][160];<br />
static char tempmatris[300][160];<br />
//------------------------------------------------------------------<br />
// Main<br />
//------------------------------------------------------------------<br />
void main(argc, argv)<br />
int argc;<br />
char **argv;<br />
{<br />
// This MUST be the first call to the library functions<br />
FL_set_base(0x300);<br />
/*<br />
Card initialization; RESET the I2C communications<br />
chip and the video front end chip Bt819. After reset<br />
the board is initialized. This is a hardware reset.<br />
*/<br />
printf("Hardware resetting FrameLocker...");<br />
FL_reset();<br />
printf("done.\n");<br />
/*<br />
Check if user want's PAL or NTSC video<br />
*/<br />
ask_for_defaults(argc, argv);<br />
/*<br />
Initialize FrameLocker - This is important !<br />
*/<br />
init();<br />
32 (41)<br />
/*<br />
Image digitation and uploading to VGA display<br />
*/<br />
do_it();<br />
}<br />
//-----------------------------------------------------------------<br />
// Check the command line arguments that the user gave, and set the<br />
// global variable g_videomode to indicate whether NTSC or PAL video<br />
// is wanted. The g_videomode is used only inside this demo program.<br />
//-----------------------------------------------------------------<br />
void ask_for_defaults(int argc, char *argv[])<br />
{<br />
if (argc != 2)<br />
{<br />
usage();<br />
exit(-1);<br />
}<br />
if (argv[1][0] != '-')<br />
{<br />
usage();<br />
exit(-1);<br />
}<br />
// Get the user command line argument for PAL or NTSC.<br />
if (argv[1][1] == 'p')<br />
{<br />
g_videomode = 1;