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 />
}<br />
/*<br />
10. Get the default brightness and contrast values. The board<br />
sets default values after reset.<br />
*/<br />
status = FL_get_bright(&g_bright);<br />
errhdlr(status);<br />
status = FL_get_contrast(&g_contr);<br />
errhdlr(status);<br />
printf("Phase 10: FL_get_bright(%d), FL_get_contrast(%d)\n",<br />
g_bright, g_contr);<br />
/*<br />
11. Set the current trigger mode. 0 means software trigger<br />
at which FrameLocker snaps an image immediately when<br />
calling the FL_snap function. 1 sets the board to wait<br />
for a hardware trigger (raising edge) when FL_snap has<br />
been called.<br />
*/<br />
status = FL_set_trig(0); /* Software trigger for snap */<br />
errhdlr(status);<br />
printf("Phase 11: FL_set_trig(0)\n");<br />
/*<br />
12. Turn off the Fast Conversion Mode.<br />
*/<br />
status = FL_set_fcm(0);<br />
errhdlr(status);<br />
printf("Phase 12: FL_set_fcm(0)\n");<br />
printf("\n\nPress [Enter] to continue...");<br />
flushall();<br />
(void) getch();<br />
printf("\n\n\n");<br />
//------------------------------------------------------------------<br />
// The user entered wrong startup parameters, therefore show some<br />
// information on how to run this demo...<br />
//------------------------------------------------------------------<br />
void usage(void)<br />
{<br />
printf("Usage:\n");<br />
printf("fl -n Run test with NTSC parameters\n");<br />
printf("fl -p Run test with PAL parameters\n\n");<br />
printf("FL assumes that FrameLocker has been set for base\n");<br />
printf("address %3xh, (BS2 & BS1 open, BS0 closed).\n\n",<br />
FL_get_base());<br />
}<br />
//------------------------------------------------------------------<br />
// Set the VGA display to 320 x 300 pixel 256 color/shades mode<br />
//-----------------------------------------------------------------void<br />
set_vga_mode(int mode)<br />
{<br />
union REGS regs;<br />
if (mode == VGAGRAPHICS)<br />
regs.h.al = 0x13;<br />
else if (mode == VGATEXT)<br />
regs.h.al = 2;<br />
else<br />
{<br />
regs.h.al = 2;<br />
regs.h.ah = (char)0;<br />
int86(0x10, ®s, ®s);<br />
fprintf(stderr,"FL_setVGAmode: mode error.\n");<br />
}<br />
regs.h.ah = (char)0;<br />
int86(0x10, ®s, ®s);<br />
}<br />
//------------------------------------------------------------------<br />
// Make a gray scale palette<br />
//------------------------------------------------------------------<br />
void vga_greymap(void)<br />
{<br />
union REGS regs;<br />
struct SREGS sregs;<br />
register int i, j;<br />
unsigned char far *ptr;<br />
int count;<br />
unsigned char map[770];<br />
for (i = 0; i < 770; i++)<br />
map[i] = 0;<br />
j = 0;<br />
count = 0;<br />
for (i = 0; i < 768; i = i + 3)<br />
{<br />
map[i] = (unsigned char)j;<br />
map[i + 1] = (unsigned char)j;<br />
map[i + 2] = (unsigned char)j;<br />
count++;<br />
if (count >= 4)<br />
{<br />
count = 0;<br />
j++;<br />
}<br />
if (j > 64)<br />
j = 64;<br />
}<br />
regs.h.ah = 0x10;<br />
regs.h.al = 0x12;<br />
regs.x.bx = 0x0;<br />
regs.x.cx = 0x100;<br />
ptr = map;<br />
sregs.es = FP_SEG(ptr);<br />
regs.x.dx = FP_OFF(ptr);<br />
int86x(0x10, ®s, ®s, &sregs);<br />
}<br />
//------------------------------------------------------------------<br />
// Display an error message and quit...<br />
//------------------------------------------------------------------<br />
void errhdlr(int status)<br />
{<br />
int stat;<br />
if (status == FALSE)<br />
stat = FL_get_errcode();<br />
else<br />
return;<br />
set_vga_mode(VGATEXT);<br />
switch (stat) {<br />
case FL_E_NOERR:<br />
printf("No error code !\n");<br />
return;<br />
break;<br />
case FL_E_RESET:<br />
printf("\aResetting error !\n");<br />
break;<br />
case FL_E_READI2C:<br />
printf("\aCan't read from I2C !\n");<br />
break;<br />
case FL_E_NODECODE:<br />
printf("\aDecoding error !\n");<br />
break;<br />
case FL_E_BADDECODE:<br />
printf("\aBad decode setting !\n");<br />
break;<br />
case FL_E_BADCHIP:<br />
printf("\aBad I2C response from Bt819 !\n");<br />
break;<br />
38 (41)