advertisement

顯示具有 Microcontroller 標籤的文章。 顯示所有文章
顯示具有 Microcontroller 標籤的文章。 顯示所有文章

2017年4月10日

How to choose right PWM frequency

The PWM switching frequency has to be much higher than what would affect the load (the device that uses the power), which is to say that the resultant waveform perceived by the load must be as smooth as possible. The rate (or frequency) at which the power supply must switch can vary greatly depending on load and application, for example
Switching has to be done several times a minute in an electric stove; 120 Hz in a lamp dimmer; between a few kilohertz (kHz), to tens of kHz for a motor drive; and well into the tens or hundreds of kHz in audio amplifiers and computer power supplies.


For a question like this, you will probably get as many answers as there are people interested in answering. Here is my answer: It depends.
Here are some of the limiting factors, first the lower limits:
  • Persistence of vision:
    • Different people are differently sensitive to flicker in a light source. Some would notice flicker even at 100 Hertz, others perhaps not even at as low as 10 Hz.
    • Motion of light source relative to the eye makes flicker more discernible, scaling up with speed of the motion.
    • Human vision sensitivity at low intensity of light - both ambient and source intensity. At very low intensity, the eye is much more sensitive to any change in intensity. So an LED operated at low duty cycle / low current and in a dark environment would require a higher minimum PWM frequency.
Now the upper limits:
  • LED turn-on characteristics: An LED cannot be toggled at arbitrarily high frequency, once the pulse duration approaches the turn-on time, the LED never really turns on fully, hence linearity of PWM control is lost to begin with, and at higher frequency / shorter pulses, eventually the LED just stays dim or off.
  • PWM provider capabilities: Your microcontroller would have its own maximum PWM rate, which sets a hard limit.
  • Switching losses: Any switching system, MOSFET based, BJT based, or other, suffers switching losses of power as switching rate increases. At one point this become significant both in terms of heating of switching device, and efficiency of illumination.
Thus, depending on these parameters, and any others affecting your specific requirement, the correct answer could be anywhere in the 50 Hz to few dozen KHz range.

motor frequency 可以測試不同頻率下輸出電流來決定

Ref:

2016年2月19日

在Linux平台撰寫、除錯與燒入8051程式


IDE:MCU 8051 IDE 載點

平台:Linux Debian jessie

下載IDE

我電腦是Debian 8所以下載mcu8051ide-1.4.10-all.deb,很特別的是Linux是free的,而Windows要錢^_^

安裝IDE
# cd /下載目錄位置
# dpkg -i mcu8051ide-1.4.10-all.deb

2014年12月29日

LCD應用控制 8051 assembly

;------------------------------------------
;     ==================================
;     ==        LCD應用控制         ==
;     ==          2014/12/29          ==
;     ==        蘇偉諺 4A037052       ==
;     ==================================
;------------------------------------------
;於LCD顯示第二列顯示'THIS IS 2ND LINE'並閃爍三次,然後由左而右依序清除

LCD應用控制 8051 assembly

UART、LCD與4x4鍵盤應用

4x4按鍵與LCD應用 8051 assembly

喇叭與七段應用控制 8051 assembly

LCD 應用控制 8051 assembly

七段與MINIKEY應用控制 8051 assembly

;------------------------------------------
;     ===================================
;     ==     七段與MINIKEY應用控制     ==
;     ==          2014/12/29           ==
;     ==        蘇偉諺 4A037052        ==
;     ===================================
;------------------------------------------
; 以MINIKEY的4個按鍵來控制七段顯示器的動作,按S1、S2、S3、S4分別顯示“┌” 、 “┐” 、“└” 、“┘”。;-----------------------------------------------------------------------------

喇叭與MINIKEY應用控制 8051 assembly

;------------------------------------------
;     ===================================
;     ==     喇叭與MINIKEY應用控制     ==
;     ==          2014/12/29           ==
;     ==        蘇偉諺 4A037052        ==
;     ===================================
;以MINIKEY的4個按鍵來控制喇叭,按S1、S2、S3、S4分別讓喇叭發出1kHz、2kHz、4kHz、8kHz聲響。

七段應用控制 8051 assembly

;------------------------------------------
;     ===================================
;     ==         七段應用控制          ==
;     ==          2014/12/29               ==
;     ==        蘇偉諺 4A037052     ==
;     ===================================
;------------------------------------------
;依序點亮七段顯示器的燈管a、燈管b、燈管c…燈管g;點亮的同時依序閃爍1次、2次、3次…7次。

2014年1月3日

89C51 顯示時鐘 Assembly

;------------------------------------------
;     ==================================
;     ==     LCD 計時器控制(改良版)      ==
;     ==          2013/12/21          ==
;     ==        蘇偉諺 4A037052        ==
;     ==================================
;------------------------------------------

2013年12月1日

89C51 LCD顯示控制

題目:

掃描minikey,將按鍵值依下列方式顯示於LCD上:
  1. '1'鍵,將'1'顯示於第一列奇數位置和第二列偶數位置
  2. '2'鍵,將'2'顯示於第一列偶數位置和第二列奇數位置
  3. '3'鍵,將'3'顯示於第一列奇數位置和第二列偶數位置
  4. '4'鍵,將'4'顯示於第一列偶數位置和第二列奇數位置

2013年4月30日

Keil uVision2 基本操作 教學



    程式語言已為職場上必備的基礎,在學習每種程式語言一定要會使用整合開發環境(IDE)來撰寫、模擬、編譯、除錯與執行,使用IDE為了增加撰寫與除錯效率,那到底何謂IDE?
    整合開發環境Integrated Development Environment 看看wiki,簡單舉個例,支援C語言的IDE有Dev-C++Eclipse等,支援Java的IDE有NetbeansEclipse等,而下面談到的Keil uVision2 為支援組合語言與C語言 IDE  http://www.keil.com/,且主要用來寫微控制晶片(Microcontroller)控制,那下面開始介紹Keil uVision2(載點)基本操作。(載點失效請留言告知)