I am an aeronautical engg. but i am interested in computer as well please solve my few queries.
What we mean by cache in computer.Every time when i read about cache it is mentioned that it has got two levels.Level 1 and level 2.What is fuction of these two levels and why their sizes are different.
Secondly I want to measure the time of execution of C program which will be in microseconds.I used time.h but it did not work.If you kindly make a small program and send me i will be thankful to you.
Thirdly I am having a C program which is used to take input data from data aqqusition card.If any one has used this card,Explain this program by writing comments in front of line where necesary.
//An example programme for A/D Convertor
//using sigma-2000 series data acquisition system
//This program converts the data 1000 points from
//the channel 0 and store the data in a column in
//voltage representtaion in filename ar.mat
#include
#include
#include
#include
#include
#define MAXPOINTS 1000 //Points to be acquired
#define CHANS 4
int stch=9, volt=5, maxpoints=50, chans=4, settle=775, convwait=1;
float volts[CHANS][MAXPOINTS]; //The floating point array that would contain the
//the converted voltage
ofstream outfile("ar.dat"); // Output file name.Provides an output stream
//to extract from a file using a filebuf.
short int value[CHANS][MAXPOINTS]; // the data array used to hold the binary intermediate
short int valuebyte1[CHANS][MAXPOINTS], valuebyte2[CHANS][MAXPOINTS],vac;
struct REGPACK reg; // reg struct used for calling software interrupts
#define BASE_ADDRESS 0x300
// The main starts here
void main(int argc, char* argv[])
{
int i;
if (argc==7)
{
stch=atoi(argv[1]);
chans=atoi(argv[2]);
maxpoints=atoi(argv[3]);
settle=atoi(argv[4]);
convwait=atoi(argv[5]);
volt=atoi(argv[6]);
if (maxpoints>MAXPOINTS) maxpoints=MAXPOINTS;
if (chans>CHANS) chans=CHANS;
}
// Control Word for the A/D PPI
// The mask is actually the channel used for the conversion
// the default is channel zero
int mask=0x90; //
outportb(BASE_ADDRESS+0x3,0x92);
outportb(BASE_ADDRESS+0x2,0x3|mask);//start a/d conversion/
for(int j=0;j2047)
{vac=4095-value[ch][q];volts[ch][q]=vac*(-1.0*(float)volt/2047.0); }
outfile< } float v3, i3;
v3=-1*(volts[0][q]+volts[1][q]);
i3=-1*(volts[2][q]+volts[3][q]);
outfile< outfile< outfile<}
}
// END OF MAIN
If you are busy now,you can also drop a mail at moonnightingale@yahoo.com later.Your help will be appreciated.
thanks
Moon