Applilet for the RL78 family

Renesas provides a code generator called Applilet (“Application Leading Tool”) for the RL78 family and others as well.

瑞薩為RL78系列以及其他芯片提供了一款代碼生成器叫做Applilet(“Application Leading Tool”)去枷。

A valuable feature of Applilet is that it provides “round-trip engineering” in that you can generate code with Applilet, add in your own code, and read it back into Applilet for further modification without deleting or breaking your additions.

“雙向工程”是該Applilet的一項極具價值的特性怖辆,你可以使用Applilet生成代碼删顶,添加自己編寫的代碼淑廊,然后讀回到Applilet中作進一步的修正,而不會把你添加的代碼刪掉或者打亂季惩。

In order to configure all port bits of a port as outputs, we need to check “Out” for each port bit.

若要將一個端口的所有位配置成輸出,需要將每一位都選中“Out”画拾。


we can specify the initial value of the output bits as one (by checking the “1? box) or zero (by leaving it unchecked).

輸出位的初始值可以設置為1(選中復選框1)或者0(復選框不選中)。

The code generated by Applilet after we press “Generate Code” can be viewed by selecting the “File” tab next to “Module” and navigating the file tree view of the generated files.

按“生成代碼”后Applilet生成的代碼可以選擇在“模塊”旁邊的“文件”標簽頁中進行瀏覽青抛。

/*
    Port Register (Pm)
*/
/* Pmn pin data (Pm0 to Pm7) */
#define _00_Pn0_OUTPUT_0        (0x00U) /* Pn0 output 0 */
#define _01_Pn0_OUTPUT_1        (0x01U) /* Pn0 output 1 */
#define _00_Pn1_OUTPUT_0        (0x00U) /* Pn1 output 0 */
#define _02_Pn1_OUTPUT_1        (0x02U) /* Pn1 output 1 */
#define _00_Pn2_OUTPUT_0        (0x00U) /* Pn2 output 0 */
#define _04_Pn2_OUTPUT_1        (0x04U) /* Pn2 output 1 */
#define _00_Pn3_OUTPUT_0        (0x00U) /* Pn3 output 0 */
#define _08_Pn3_OUTPUT_1        (0x08U) /* Pn3 output 1 */
#define _00_Pn4_OUTPUT_0        (0x00U) /* Pn4 output 0 */
#define _10_Pn4_OUTPUT_1        (0x10U) /* Pn4 output 1 */
#define _00_Pn5_OUTPUT_0        (0x00U) /* Pn5 output 0 */
#define _20_Pn5_OUTPUT_1        (0x20U) /* Pn5 output 1 */
#define _00_Pn6_OUTPUT_0        (0x00U) /* Pn6 output 0 */
#define _40_Pn6_OUTPUT_1        (0x40U) /* Pn6 output 1 */
#define _00_Pn7_OUTPUT_0        (0x00U) /* Pn7 output 0 */
#define _80_Pn7_OUTPUT_1        (0x80U) /* Pn7 output 1 */

解釋含義
_00_Pn0_OUTPUT_0 代表:

  • _00: 符號的實際值 (0x00)
  • _Pn0: 端口寄存器第0位(no0)
  • _OUTPUT_0: 輸出值為 0
    同樣, _02_Pn1_OUTPUT_1 代表:
  • _02: 符號的實際值 (0x02)
  • _Pn1: 端口寄存器第1位(n1)
  • _OUTPUT_1: 輸出值為 1
/*
    Port Mode Register (PMm)
*/
/* Pmn pin I/O mode selection (PMm7 - PMm0) */
#define _01_PMn0_NOT_USE        (0x01U) /* not use Pn0 as digital I/O */
#define _01_PMn0_MODE_INPUT     (0x01U) /* use Pn0 as input mode */
#define _00_PMn0_MODE_OUTPUT    (0x00U) /* use Pn0 as output mode */
#define _02_PMn1_NOT_USE        (0x02U) /* not use Pn1 as digital I/O */
#define _02_PMn1_MODE_INPUT     (0x02U) /* use Pn1 as input mode */
#define _00_PMn1_MODE_OUTPUT    (0x00U) /* use Pn1 as output mode */
#define _04_PMn2_NOT_USE        (0x04U) /* not use Pn2 as digital I/O */
#define _04_PMn2_MODE_INPUT     (0x04U) /* use Pn2 as input mode */
#define _00_PMn2_MODE_OUTPUT    (0x00U) /* use Pn2 as output mode */
#define _08_PMn3_NOT_USE        (0x08U) /* not use Pn3 as digital I/O */
#define _08_PMn3_MODE_INPUT     (0x08U) /* use Pn3 as input mode */
#define _00_PMn3_MODE_OUTPUT    (0x00U) /* use Pn3 as output mode */
#define _10_PMn4_NOT_USE        (0x10U) /* not use Pn4 as digital I/O */
#define _10_PMn4_MODE_INPUT     (0x10U) /* use Pn4 as input mode */
#define _00_PMn4_MODE_OUTPUT    (0x00U) /* use Pn4 as output mode */
#define _20_PMn5_NOT_USE        (0x20U) /* not use Pn5 as digital I/O */
#define _20_PMn5_MODE_INPUT     (0x20U) /* use Pn5 as input mode */
#define _00_PMn5_MODE_OUTPUT    (0x00U) /* use Pn5 as output mode */
#define _40_PMn6_NOT_USE        (0x40U) /* not use Pn6 as digital I/O */
#define _40_PMn6_MODE_INPUT     (0x40U) /* use Pn6 as input mode */
#define _00_PMn6_MODE_OUTPUT    (0x00U) /* use Pn6 as output mode */
#define _80_PMn7_NOT_USE        (0x80U) /* not use Pn7 as digital I/O */
#define _80_PMn7_MODE_INPUT     (0x80U) /* use Pn7 as input mode */
#define _00_PMn7_MODE_OUTPUT    (0x00U) /* use Pn7 as output mode */

解釋含義

  • _00_PMn0_MODE_OUTPUT 代表:
  • _00: 符號的實際值 (0x00)
  • _Pmn0: 端口狀態(tài)寄存器第0位(no0)
  • _MODE_OUTPUT: 輸出位
    同樣, _01_PMn0_MODE_INPUT 代表:
  • _01: 符號的實際值 (0x01)
  • _PMn0: 端口狀態(tài)寄存器第0位
  • _MODE_INPUT: 輸入位

詞匯

  • sink currents,反向電流
  • Servos适室,伺服電機
  • Stepper motors,步進馬達
  • level converter捣辆,電平變換器
  • comparator,比較器
  • quantization汽畴,數(shù)字化
  • polling,輪詢

Pulse Width Modulation###

A common method for controlling the speed of a simple DC motor or the brightness of an LED is Pulse Width Modulation. Pulse Width Modulation works as a DAC by changing the duty cycle of an oscillating digital output as shown in Figure 2.20. In the case of an LED, the more time the duty cycle is HIGH, the brighter the LED. This method works in cases where the oscillating frequency is so fast that the resulting output seems smooth. The LED is actually turning on and off many tens of times per second; however, the human eye cannot
detect the independent flashes of the LED due to their speed. Motor speed can be controlled this way because the inertia of the spinning armature carries the motor forward through the moments when no power is applied. A PWM signal is typically generated by a timer peripheral which sets or clears the output signal when the internal counter reaches configurable count values.
控制簡單直流電機的轉(zhuǎn)速整袁,或者LED亮度的普通方法是PWM,PWM通過改變震蕩數(shù)字輸出的占空比按DAC工作坐昙,對于LED來說绳匀,高占空比的時間越長炸客,LED越亮,實際上LED每秒鐘點亮熄滅次數(shù)太高痹仙,這樣的高速人眼根本不能反應過來。馬達的控制也是一樣开仰。計時器外設產(chǎn)生PWM信號拟枚。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末众弓,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子谓娃,更是在濱河造成了極大的恐慌,老刑警劉巖滨达,帶你破解...
    沈念sama閱讀 222,183評論 6 516
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異捡遍,居然都是意外死亡锌订,警方通過查閱死者的電腦和手機辆飘,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,850評論 3 399
  • 文/潘曉璐 我一進店門涩搓,熙熙樓的掌柜王于貴愁眉苦臉地迎上來劈猪,“玉大人,你說我怎么就攤上這事战得〕浔撸” “怎么了常侦?”我有些...
    開封第一講書人閱讀 168,766評論 0 361
  • 文/不壞的土叔 我叫張陵,是天一觀的道長聋亡。 經(jīng)常有香客問我,道長坡倔,這世上最難降的妖魔是什么漂佩? 我笑而不...
    開封第一講書人閱讀 59,854評論 1 299
  • 正文 為了忘掉前任投蝉,我火速辦了婚禮,結(jié)果婚禮上征堪,老公的妹妹穿的比我還像新娘。我一直安慰自己佃蚜,他們只是感情好,可當我...
    茶點故事閱讀 68,871評論 6 398
  • 文/花漫 我一把揭開白布谐算。 她就那樣靜靜地躺著熟尉,像睡著了一般氯夷。 火紅的嫁衣襯著肌膚如雪靶擦。 梳的紋絲不亂的頭發(fā)上腮考,一...
    開封第一講書人閱讀 52,457評論 1 311
  • 那天踩蔚,我揣著相機與錄音,去河邊找鬼枚粘。 笑死,一個胖子當著我的面吹牛,可吹牛的內(nèi)容都是我干的福也。 我是一名探鬼主播,決...
    沈念sama閱讀 40,999評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼暴凑,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了现喳?” 一聲冷哼從身側(cè)響起凯傲,我...
    開封第一講書人閱讀 39,914評論 0 277
  • 序言:老撾萬榮一對情侶失蹤冰单,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后灸促,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 46,465評論 1 319
  • 正文 獨居荒郊野嶺守林人離奇死亡浴栽,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,543評論 3 342
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了吃度。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,675評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡椿每,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出间护,到底是詐尸還是另有隱情亦渗,我是刑警寧澤汁尺,帶...
    沈念sama閱讀 36,354評論 5 351
  • 正文 年R本政府宣布,位于F島的核電站痴突,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏辽装。R本人自食惡果不足惜帮碰,卻給世界環(huán)境...
    茶點故事閱讀 42,029評論 3 335
  • 文/蒙蒙 一殉挽、第九天 我趴在偏房一處隱蔽的房頂上張望丰涉。 院中可真熱鬧斯碌,春花似錦、人聲如沸傻唾。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,514評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至猴抹,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間蟀给,已是汗流浹背蝙砌。 一陣腳步聲響...
    開封第一講書人閱讀 33,616評論 1 274
  • 我被黑心中介騙來泰國打工跋理, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留择克,地道東北人。 一個月前我還...
    沈念sama閱讀 49,091評論 3 378
  • 正文 我出身青樓肚邢,卻偏偏與公主長得像,于是被迫代替她去往敵國和親骡湖。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 45,685評論 2 360

推薦閱讀更多精彩內(nèi)容