• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: dsPIC3F4011程式裡的值要如何從16進位轉10進位?
#3
新會員
新會員


查看用戶資訊
我的問題已解決~
感謝大大的指點

發表於: 2007/5/24 22:38
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsPIC3F4011程式裡的值要如何從16進位轉10進位?
#2
中級會員
中級會員


查看用戶資訊
因為RS232傳的資料本身就是16進制的值
而超級終端機能夠顯示的是字串
所以你再送出去的時後應該要先將其轉換成ASCII CODE
//全域變數
char send[3];


void chartoasc (char cin)
{
char temp;
temp=cin%10;
send[0]=cin%10;
send[1]=temp%10;
send[2]=temp/10;
for(temp=0;temp<3;temp++)
{
send[temp]=send[temp]+0x30; // change to ASCII
}

}

然後再把SEND的資料送出去就好了


發表於: 2007/5/24 21:30
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


dsPIC3F4011程式裡的值要如何從16進位轉10進位?
#1
新會員
新會員


查看用戶資訊
我把下面這程式用終端機輸出x1~x3、y1~y3後,因為是16進位結果顯使亂碼要如何使它可以顯示出數字呢?
這東西蠻急的~如果有範例能參考的大大幫個忙吧~感激不進!
while(1) // do for ever
{
unsigned int i;
for (i =0 ; i < 10 ; i++) Delay_123( );
if (PORTBbits.RB1==0) // 1st test key pressed
{
while(BusyUART1());
ASCbuf=x1;
WriteUART1(ASCbuf);
while(BusyUART1());
ASCbuf=x2;
WriteUART1(ASCbuf);
while(BusyUART1());
ASCbuf=x3;
WriteUART1(ASCbuf);
while(BusyUART1());
ASCbuf=y1;
WriteUART1(ASCbuf);
while(BusyUART1());
ASCbuf=y2;
WriteUART1(ASCbuf);
while(BusyUART1());
ASCbuf=y3;
WriteUART1(ASCbuf);
while(BusyUART1());
ASCbuf=CR;
WriteUART1(ASCbuf);
while(BusyUART1());
ASCbuf=LF;
WriteUART1(ASCbuf);
while(BusyUART1());

while (PORTBbits.RB0==0)Delay_123( ); // wait for key released

}

發表於: 2007/5/24 20:06
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... ]

教育訓練中心

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