VISUAL BASIC SECTION
Q1 : Grade yourself on your Visual Basic Skill ?
1 ¨C poor ¡¡.. 10- Advance player
Ans:
Q2 : Declare Function Multiply_Add Lib ¡°test¡± (ByRef A as integer ,VeRef B as integer , ByVal c as integer ) as integer
Q2.1: Explain what is Declare Function used for ?
Ans :
Q2.2 : Explain the difference between ByRef and ByVal ?
Ans :
Q3 : Is Visual Basic a COMPILER or an INTERPERTER ?
Ans
C++ SECTION
Q4 :
int iVal1 = 0, iVal2 = 0;
int * ipVal;
ipVal = &iVal1; What is the Value of ipVal = *ipVal =
ipVal = (int*)iVal1; What is the Value of ipVal = *ipVal =
iVal2 = (int)&iVal1; What is the Value of ipVal = *ipVal =
Q5:
void SwapAB(int A, int B)
{
A=B;
B=A;
}
int main()
{
int A,B;
A=1;
B=2;
SwapAB(A,B);
return 0; // A= ?, B= ?
}
What is the value of A and B ?
What is the difference between STRUCTURE and OBJECT ORIENTED PROGRAMMING ?
What is the difference between C and C++ ?
What is an interpreter ?
.
Q6. Step through the following C code and answer the questions
void FillMem(unsigned char *pData, unsigned char len)
{
while (len–) *pData++ = len;
}
void main()
{
unsigned char buffer1[8];
unsigned char buffer2[8];
unsigned char * pData;
unsigned char cnt1, cnt2;
for (cnt1 = 0; cnt1 < 8; cnt1++)
buffer1[cnt1] = 0xFF;
for (cnt1 = 0; cnt1 < 8; cnt1++)
buffer2[cnt1] = 0xFF;
for (cnt1 = 0, cnt2 = 4; cnt1 < 4; cnt1++, cnt2–)
buffer1[cnt1] = cnt1;
buffer2[cnt2] = cnt2;
/***************************************************************
Q What is the content of buffer1 & buffer2 ?
buffer1[0] = ?? buffer2[0] = ??
buffer1[1] = ?? buffer2[1] = ??
buffer1[2] = ?? buffer2[2] = ??
buffer1[3] = ?? buffer2[3] = ??
****************************************************************/
for (cnt1 = 0; cnt1 < 8; cnt1++)
buffer1[cnt1] = 0xFF;
FillMem(&buffer1[0], 4);
/***************************************************************
Q. What is the content of buffer1 ?
buffer1[0] = ??
buffer1[1] = ??
buffer1[2] = ??
buffer1[3] = ??
****************************************************************/
for (cnt1 = 0; cnt1 < 8; cnt1++)
buffer1[cnt1] = 0xFF;
pData = &buffer1[4];
pData = pData – 2;
for (cnt1 = 0; cnt1 < 2; cnt1++)
*pData++ = cnt1;
/***************************************************************
Q. What is the content of buffer1 ?
buffer1[0] = ??
buffer1[1] = ??
buffer1[2] = ??
buffer1[3] = ??
****************************************************************/
}
Visual Basic / C++ Section:
You can use C/C++ or Visual Basic to do the following
Please write a simple function to access the momory card 8×8 bytes
The input parameter for memory location is between 0-63
If user want to write ¡®1¡¯ at the memory location 9, then this function will write ¡®1¡¯ at cell (1,1)
Eg.
MemAccess(9,1); // MemAccess(int Position, int Value);
MemAccess(2,5);
Result
0
1
2
3
4
5
6
7
0
1
2
3
4
5
6
7
Note: you can use array type to define this memory card.
Eg.
Int MemoryCard[8][8]; // Array definition in C
{
}
BACK TO FOUNDATION
1 BYTE = _________BITS (based on 8 bits processor)
1 INTEGER = _______BYTES (based on 8 bits processor)
1 LONG = _________BYTES (based on 8 bits processor)
8051 ASSEMBLY LANGUAGE PROGRAMMING
Add a comment on each line !
MOV DPTR,#atable
MOV A,R7
MOVC A, @A+DPTR
CJNE A,#EEPDELIVERYSTATE,_JUMP1
RET
_JUMP1:
MOV R6,A
MOV A,R7
INC A
MOVC A, @A+DPTR
MOV DPL,A
MOV DPH,R6
POP ACC
POP ACC
CLR A
JMP @A+DPTR
Explain what is the function ?