嘿,我有我的美國設置從鍵盤讀取中斷,並使用我的圖片從我的麪包板傳輸ADC讀數中斷是用戶可以輸入的鍵盤命令這將改變我的模擬麪包板溫度傳感器的上限和下限USART崩潰(如何同時管理用戶輸入和打印)
我的問題是有時候我的usart只是隨機崩潰,它凍結了並停止傳輸,當我進入我的鍵盤輸入時,有時當它傳輸某些中間句子時(例如通過printf的一半),然後我按下回車鍵,中斷似乎會崩潰,導致像下面的圖像一樣的圖像。
http://imageshack.us/photo/my-images/5/ftfk.png/
看看突出顯示的行,這是我按enter鍵,輸出我通過緩衝區收集的字符流,它似乎只是將輸出減半,然後跳過中斷輸出。
這裏有什麼問題,我應該尋找什麼?
請在下面找到
void mainNema(char *nemaSentence) //this function processes my output and prints it out
{
int i;
for (i = 0; i< 20; i++) {
GPGGA_Tokens[i] = '\0';
}
parseNemaSentence(nemaSentence);
i = 0;
while (strcmp(GPGGA_Tokens[i], msgEndOfSentence)!=0) {
printf("\r\ntoken %i: %s\r\n",i, GPGGA_Tokens[i]);
i++;
}
evaluateTokens();
changeNema(token1,token2,token3);
if (token2 == 1)
printf("your new upper limit for channel %i is %i", token1, token3);
else
printf("your new lower limit for channel %i is %i", token1, token3);
}
代碼樣本下面從ADC轉換器讀取並通過USART
ConvertADC(); //take value from potentiometer
while(BusyADC() == TRUE)
Delay1TCY();//wait until value is received
sampledValue = ReadADC(); //store value as sampledValue
setCurrentTemperatureForChannel(channelsel, sampledValue); //call function with channelsel and sampledValue
readSwitches(channelsel); //read inputs from pushbuttons
printf ("\n\rcurrent Temp of channel %i is %#x, highlimit is %i, low limit is %i \n\r", (channelsel+1), getCurrentTemperatureForChannel(channelsel),
getUpperLimitForChannel(channelsel),getLowerLimitForChannel(channelsel));
凹凸!任何接受者? – user2860684