• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::


Browsing this Thread:   1 Anonymous Users






Re: VT100指令換行會卡住-已解決
#2
版主
版主


查看用戶資訊
知道為什麼要加入 UART.h 的原因嗎?

發表於: 2008/6/19 14:32
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


VT100指令換行會卡住-已解決
#1
新會員
新會員


查看用戶資訊
是這樣的
我用了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
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------