Hi,
I am using hid simple custom demo that provided by microchip, for my device. In one of cases (case 0x82:) in the ProcessIO function, I am starting a loop that take a long time to be completed. And in some cases I want to break this loop by a commond from PC. how can I do this? the code is below and I want to break it anywhere in this case:
Code:
case 0x82:
{
dackontrol1 = 1;
dackontrol2 = 1;
dacch2=0x0000;
databuffersayisi = 0x00;
xindex=0x0000;
yindex=0x0000;
dacnum2= 0x0000;
dacnum1=0x0000;
//spi yaz
/*verial(); // dds value can be ready to scan;
deger=ilkdeger;
converter();
spiyaz(); */
// adc oncesi veriyi yaz
//ilk durum icin indexler
ToSendDataBuffer[10]= xindex;
ToSendDataBuffer[11]= yindex;
adc2reg=32;
adimsayma=0;
verisayma=0;
xdac=0x00;
ydac=0x00;
ysayac=0x00;
while(ydac<0xfff& ReceivedDataBuffer[5]==0x0F)//tarama
{
//bir dac okuması+adımsayacı bir artır
while(xdac<0xfff& ReceivedDataBuffer[5]==0x0F)
{
if(xdac==0)
{
adc2();
adc2reg=adc2reg+2;
}
adimsayma=adimsayma+1;// bu ifin içine alınmalı
xdac++;
dac1(xdac);
gecikme(ReceivedDataBuffer[25]);
if(adimsayma==16)
{
adc2();
adc2reg=adc2reg+2;
verisayma=verisayma+1;
if(verisayma==16)
{
USBInHandle = HIDTxPacket(HID_EP,(BYTE*)&ToSendDataBuffer[0],64); //verigonder
verisayma=0;
adc2reg=32;
}
adimsayma=0;
}
}
while(xdac>0x00& ReceivedDataBuffer[5]==0x0F)
{
if(xdac==4095)
{
adc2();
adc2reg=adc2reg+2;
}
adimsayma=adimsayma+1;//bu ifin içine alınmalı
xdac=xdac-1;
dac1(xdac);
gecikme(ReceivedDataBuffer[25]);
if(adimsayma==16)
{
adc2();
adc2reg=adc2reg+2;
verisayma=verisayma+1;
if(verisayma==16)
{
USBInHandle = HIDTxPacket(HID_EP,(BYTE*)&ToSendDataBuffer[0],64); //verigonder
verisayma=0;
adc2reg=32;
}
adimsayma=0;
}
}
while(ysayac<16)//ysayac<17 bunu ysayac<16 olarak değiştirdim
{
ydac=ydac+1;
ysayac=ysayac+1;
dac2(ydac);
gecikme(ReceivedDataBuffer[25]);
}
ysayac=0x00;
}
while(ydac>0x00)
{
ydac=ydac-1;
dac2(ydac);
gecikme(ReceivedDataBuffer[25]);
}
}
break;