• slider image 442
  • slider image 509
  • slider image 510
  • slider image 511
  • slider image 512
  • slider image 513
  • slider image 514
  • slider image 515
:::


Browsing this Thread:   1 Anonymous Users






Re: 請問浮點數
#8
資深會員
資深會員


查看用戶資訊
做值域轉換,比較耗效能
數學演算法如下
PWM階數範圍從0x26~0x89,把開始的地方歸零
(0x26 - 0x26)~(0x89 - 0x26) =
0x00~0x63 --> 等比例放大(2.58倍) --> 0x00~0xFF

發表於: 2008/11/5 23:39
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問浮點數
#7
中級會員
中級會員


查看用戶資訊
請問如下:

把浮點部份當作整數看一樣可以用
4.3-->0x04.4C-->0000 0100.0100 1100
把沒有用到的高位元去掉,左旋5次得到
1000 1001.1000 0000
浮點部份捨棄-->1000 1001-->0x89-->PWM
如果PWM要0~255階,數值要另外轉換。
如不轉換
1.2-->0x01.33-->0000 0001.0011 0011
0010 0110.0110 0000
0010 0110-->0x26-->PWM
PWM階數範圍從0x26~0x89

那如果想把他轉成PWM要0~255階 該如何下手呢??

發表於: 2008/11/5 22:26
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問浮點數
#6
資深會員
資深會員


查看用戶資訊
了解
thanks ~~

發表於: 2008/11/5 16:45
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問浮點數
#5
資深會員
資深會員


查看用戶資訊
Good Question.
0.3 * 256 = 76.8 餘數不要 -->76 = 0x4C
還原-->76 / 256 = 0.296875很接近0.3吧!

發表於: 2008/11/5 16:30
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問浮點數
#4
資深會員
資深會員


查看用戶資訊
參照:

hellowanz 寫道:
把浮點部份當作整數看一樣可以用
4.3-->0x04.4C-->0000 0100.0100 1100


請問
4.3-->0x04.4C
4C是怎麼來的?

發表於: 2008/11/5 14:13
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問浮點數
#3
版主
版主


查看用戶資訊
用組語還是C ?

組語請參考 : AN575 提供了 IEEE754 Floating Point 轉 24-bit 整數的程式:

http://www.microchip.com/stellent/idc ... eId=1824&appnote=en010961

經客戶修正過的程式:

http://www.piclist.com/techref/microc ... th/round/fp-24bint-ng.htm

發表於: 2008/11/5 10:35
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問浮點數
#2
資深會員
資深會員


查看用戶資訊
把浮點部份當作整數看一樣可以用
4.3-->0x04.4C-->0000 0100.0100 1100
把沒有用到的高位元去掉,左旋5次得到
1000 1001.1000 0000
浮點部份捨棄-->1000 1001-->0x89-->PWM
如果PWM要0~255階,數值要另外轉換。
如不轉換
1.2-->0x01.33-->0000 0001.0011 0011
0010 0110.0110 0000
0010 0110-->0x26-->PWM
PWM階數範圍從0x26~0x89

發表於: 2008/11/5 10:26
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請問浮點數
#1
中級會員
中級會員


查看用戶資訊
請問浮點數要怎樣運算才能在8BIT的微控制器

裡面使用??


假如4.3-1.2所得到的數字 想把他放在

PWM 做輸出 可是PWM只有二進制

沒有辦法有浮點數輸出

該怎麼做??

發表於: 2008/11/4 16:07
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... ]

教育訓練中心

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