Iam Trying to simulate a hardware "pci" by visual c++ program.....
" i don't have the hardware right now so i want to test my program"
the hardware is about to inter a number for example from switches compare it to other number also from switches.."which iam gonna take it from 1 textbox"...
1- inter first number
2- and then wait for strop on pin 3 of the switches " eg. sw3= 0...1...0 iam ready to read 2nd number"
3- inter the second number on the same text box....
4-then display the largest on leds which will be a message box for me
the problem is when I inter the first number i keep checking for the strop to be ready to inter next value but compiler keep checking and doesn't give me a chance to change the value of the textbox "not responding infinite loop"
this is the code
CString str1;
CEdit *ptr1;
double d;
unsigned long port = 0;
unsigned char num1 = 0;
unsigned char num2 = 0;
unsigned char data = 0;
unsigned char tempdata = 0;
unsigned char check = 0;
unsigned char begin_state;
unsigned char l =0;
ptr1= (CEdit*)GetDlgItem(DutyCycle);
ptr1 -> GetWindowText(str1);
d=atoi(str1);
l = (unsigned char)d;
tempdata = l & 15;
check = tempdata/8;
begin_state = check;
int i=0;
while (i<3)
{
ptr1= (CEdit*)GetDlgItem(DutyCycle);
ptr1 -> GetWindowText(str1);
d=atoi(str1);
l = (unsigned char)d;
tempdata = l & 15;
check = tempdata / 8;
unsigned char y2=0;
unsigned char y3=0;
y2 = l & 7;
y3 = l & 240;
y3 = y3 >> 1;
num1 = y2 + y3;
i++;
CString S;
S.Format("%d",num1);
MessageBox("first number ="+ S);
begin_state = check;
while(check = begin_state)
{
ptr1= (CEdit*)GetDlgItem(DutyCycle);
ptr1 -> GetWindowText(str1);
d=atoi(str1);
l = (unsigned char)d;
tempdata = l & 15;
check = tempdata/8;
if(check != begin_state)
{break;}
}
CString S2;
S2.Format("%d",check);
MessageBox("bit3 ="+ S2);
while(check != begin_state)
{
ptr1= (CEdit*)GetDlgItem(DutyCycle);
ptr1 -> GetWindowText(str1);
d=atoi(str1);
l = (unsigned char)d;
tempdata = l & 15;
check = tempdata/8;
if(check == begin_state)
{break;}
}
CString S3;
S3.Format("%d",check);
MessageBox("bit3 ="+ S3);
if(check == begin_state)
{
y2 = l & 7;
y3 = l & 240;
y3 = y3>>1;
num2 = y2 + y3;
i++;
CString S4;
S4.Format("%d",num2);
MessageBox("second number ="+ S4);
CString S5;
if(num1 >= num2)
{
i++;
S5.Format("%d",num1);
MessageBox("the larger is ="+ S5);
}
else
{
i++;
S5.Format("%d",num1);
MessageBox("the larger is ="+ S5);
}
}
}
how can I make the compiler to let me edit the text box while it's inside the while loop