Re: VT100指令換行會卡住-已解決
|
||||
---|---|---|---|---|
版主
|
知道為什麼要加入 UART.h 的原因嗎?
發表於: 2008/6/19 14:32
|
|||
|
VT100指令換行會卡住-已解決
|
||||
---|---|---|---|---|
新會員
|
是這樣的
我用了W-AP002實作 裡面練習三的VT100指令做函數使用 http://studentweb.ncnu.edu.tw/95327511/VT100.c 結果發現這裡面其中的換行指令 void VT100_Cursor_N_Line (void) // Send "ESC E" to UART { while (BusyUSART()); WriteUSART('\x1b'); while (BusyUSART()); WriteUSART('E'); } 我只能做一次~ 在程式裡面第二次使用這個指令的時候會卡住 游標不會往下移了 會卡在這個迴圈裏面 下面是我一小段的程式 OpenUSART( USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH, 25); OpenLCD(); INTCONbits.PEIE=1; INTCONbits.GIE=1; WriteCmdLCD(CLR_DISP); LCD_Set_Cursor(0,0); delay(); putrsLCD("Low correction"); delay(); VT100_Cursor_Home (); putrsUSART("Low correction"); while(BusyUSART()); VT100_Cursor_N_Line (); do { if(set==1) { switch (mode) { case 0: { /* do { if(count%2==0) { L_ADC=Adc_Read(0); ADC_temp[0]=L_ADC; } else { L_ADC=Adc_Read(0); ADC_temp[1]=L_ADC-ADC_temp[0]; } count++; }while(count<6000);*/ LCD_Set_Cursor(1,0); delay(); putrsLCD("Starting."); putrsUSART("Starting."); VT100_Cursor_N_Line (); ADC_temp[1]=1000; do { if(count%2==0) { L_ADC=Adc_Read(0); ADC_temp[0]=L_ADC; ADC_temp[1]=1000; delay1(1); } else { L_ADC=Adc_Read(0); ADC_temp[1]=fabs(L_ADC-ADC_temp[0]); delay1(1); } if(ADC_temp[1]<200) test_count++; count++; }while(test_count<3); ====================================== putrsUSART("Low correction"); VT100_Cursor_N_Line (); 這個會換行 但是到了 putrsUSART("Starting."); VT100_Cursor_N_Line (); 這邊的VT100_Cursor_N_Line (); 就不會換行了 而且會卡住 跳不出迴圈~ 不知道版上的先進們聽的懂我的敘述嗎 ^^a 需要的話我在附上完整的檔案 PIC18F4550 / C18 / MPLAB IDE v8.01 ========================================= 耍笨的問題已解決 在main.h的前面加一行 #include <usart.h> 而且要把usart.h放到"header files" 這樣就OK了 = ="
發表於: 2008/6/19 1:26
|
|||
|