#include
#include
#include
//#include "pc104.h"
//calmotion_mc104p.lib
void init_mc104p(void);
void outportb(unsigned int io_add, unsigned char io_val);
unsigned char inportb(unsigned int io_add);
void outmemb(unsigned long mem_add, unsigned char mem_val);
unsigned char inmemb(unsigned long mem_add);
//calmotion_video.lib
void init_cirrus_video(void);
void cls(void);
void color(unsigned char foreground, unsigned char background);
void locate(unsigned int row, unsigned int column);
//calmotion_utility.lib
void init_utility(void);
void mc104p_utility(void);
void data_xfer(void);
char row, column, foreground, background;
char col,x;
#include "letters.c"
void main (void)
{
init_mc104p(); // initialize the MC104p ports
init_cirrus_video(); // initialize the video card with
// the Cirrus chipset.
cls(); // clear the screen
foreground=7; // foreground = white
background=0; // background = black
row=1; // home the cursor
column=1;
color(foreground,background); // set the initial foreground // and background.
//write the characters to the flat panel display.
_M();
_C();
_1();
_0();
_4();
_P();
while(1);
}
// A typical letter forming function from letters.c
void _M(void)
{
row=1;
column = col = 3;
color(0x06,0x00);
locate(row, column);
printf("MM MM");
++row;
column = col;
locate(row, column);
printf("MM MM MM MM");
++row;
column = col;
locate(row, column);
printf("MM MM MM MM");
++row;
column = col;
locate(row, column);
printf("MM M MM");
++row;
for(x=0;x<5;++x)
{
column = col;
locate(row, column);
printf("MM MM");
++row;
}
}
Listing
1—The printf statement is used in a manner that you’re accustomed to. But instead
of having your ASCII characters flow through a USART, they’re shown on a PC display.