求助:usb固件,觉的有点不可思议

2020-02-05 09:12发布

void Fifo_Write_InterruptServiceRoutine (unsigned char addr, unsigned int uNumBytes, unsigned char * pData)
{
   int i;

if ((*DATAPTR == 0x00)&&(flag_led == 1)) ////////////调试
{
        P0 |= 0x10;
        *DATAPTR = 0x03;
}

   // If >0 bytes requested,
   if (uNumBytes)
   {
      while (USB0ADR & 0x80);          // Wait for BUSY->'0'(register available)
      USB0ADR = (addr);                // Set address (mask out bits7-6)

      // Write <NumBytes> to the selected FIFO
      for (i=0; i<uNumBytes; i++)
      {
         USB0DAT = pData[i];
         while (USB0ADR & 0x80);       // Wait for BUSY->'0' (data ready)
      }
   }
}
程序一进入这个函数DATAPTR 的值就改变(也就是pData)半天都想不明白,可能什么原因呢?
if ((*DATAPTR == 0x00)&&(flag_led == 1)) ////////////调试
{
        P0 |= 0x10;
        *DATAPTR = 0x03;
}
这个是我为了调试加进去的,不知道有没有谁遇到过
0条回答

一周热门 更多>