# 峰值電流模式 PWM 控制器 (`pwmController`)

> 比較開關電流與設定值，藉此控制轉換器的開關。

![pwmController](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/pwmController.svg)

[元件參考](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/) · [English](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/ic/pwmController/)

**分類:** 積體電路 · **種類:** `{"definition":"pwmController","kind":"subsystem"}`

## 何時使用

轉換器使用固定頻率的峰值電流模式晶片，並要連同 COMP 上的補償網路一起模擬時使用。要研究自訂的控制律時，改用 PI 控制器與 PWM 產生器。

## 接腳

| 接腳 | 訊號域 | 意義 |
|---|---|---|
| `VFB` | 電氣 | 回授輸入，輸出分壓接在這裡 |
| `COMP` | 電氣 | 誤差放大器輸出，補償網路接在這裡 |
| `CS` | 電氣 | 電流感測輸入，接感測電阻 |
| `OUT` | 電氣 | 閘極驅動輸出 |
| `VCC` | 電氣 | 電源，低於 UVLO 臨界時輸出保持關閉 |
| `GND` | 電氣 | 所有腳位的接地參考 |

## 常用參數

- `rt`: Timing resistor RT (the datasheet: never below 5 kOhm, Table 5-1 Pin Functions, RT/CT, p.4) (預設值: 10000)
- `ct`: Timing capacitor CT (the datasheet recommends at least about 1000 pF) (預設值: 0.0000000033)
- `dmax`: Maximum duty cycle of the output (預設值: 0.97)
- `vRef`: Error amplifier reference at the non-inverting input (預設值: 2.5)
- `acs`: Current-sense gain: COMP volts per volt of CS threshold (預設值: 3)

## 參數

| 鍵 | 單位 | 預設值 | 典型範圍 | 說明 | 規格書來源 |
|---|---|---|---|---|---|
| `rt` | Ω | 10000 | 5k – 10meg Ω | Timing resistor RT (the datasheet: never below 5 kOhm, Table 5-1 Pin Functions, RT/CT, p.4) | Section 6.5 test condition RRT = 10 kOhm, p.7 |
| `ct` | F | 0.0000000033 | 100p – 1u F | Timing capacitor CT (the datasheet recommends at least about 1000 pF) | Section 6.5 test condition CCT = 3.3 nF, p.7 |
| `dmax` | — | 0.97 | 50m – 990m | Maximum duty cycle of the output | Section 6.5 DMAX typ (UCx842/3), p.8 |
| `oscDiv` | — | 1 | 1 – 2 | Oscillator periods per output period: 1, or 2 for a toggle flip-flop (UCx844/5), which switches at half the oscillator frequency | Section 6.5 note (5): fSW = fOSC for the UCx842/3, fOSC / 2 for the UCx844/5, p.8 |
| `vRef` | V | 2.5 | 500m – 10 V | Error amplifier reference at the non-inverting input | Section 6.5 VVFB typ, p.7 |
| `a0` | V/V | 31623 | 10 – 1g V/V | Error amplifier DC gain (90 dB) | Section 6.5 AVOL typ 90 dB, p.7 |
| `gbw` | Hz | 1000000 | 1k – 1g Hz | Error amplifier unity-gain bandwidth | Section 6.5 unity gain bandwidth typ, p.7 |
| `vCompLo` | V | 0.7 | 0 – 10 V | Lowest COMP voltage | Section 6.5 VCOMP low-level typ, p.7 |
| `vCompHi` | V | 5 | 1 – 20 V | Highest COMP voltage (the datasheet guarantees at least 5 V) | Section 6.5 VCOMP high-level min, p.7 |
| `rCompOut` | Ω | 1250 | 0 – 1meg Ω | COMP output resistance (0 = ideal) | assumption: 6 V at no load falling to 5 V at the 0.8 mA source current, p.7 |
| `iSource` | A | 0 | 0 – 10m A | Error amplifier output source current limit: COMP is fed by this current and clamped to the amplifier's voltage through rCompOut (0 = not modelled: the amplifier drives COMP through rCompOut alone) | Section 6.5 error amplifier output source current typ 0.8 mA, p.7 |
| `acs` | V/V | 3 | 500m – 20 V/V | Current-sense gain: COMP volts per volt of CS threshold | Section 6.5 ACS typ, p.8 |
| `vcsMax` | V | 1 | 50m – 10 V | Maximum current-sense threshold (the COMP clamp) | Section 6.5 VISENSE maximum input signal typ, p.8 |
| `vCompOff` | V | 1.4 | 0 – 5 V | COMP voltage at which the current-sense threshold is zero | Section 7.3.8 p.18: COMP below two diode drops above ground stops the output (0.7 V a drop is an assumption; Figure 6-2 gives the threshold graphically) |
| `vccOn` | V | 8.4 | 1 – 40 V | VCC UVLO enable threshold | Section 6.5 VCCON typ (UCx843/5), p.8 |
| `vccOff` | V | 7.6 | 500m – 40 V | VCC UVLO off threshold | Section 6.5 VCCOFF typ (UCx843/5), p.8 |
| `tSoft` | s | 0 | 0 – 1 s | Soft-start time: the current-sense threshold ramps from 0 to vcsMax after the UVLO releases (0 = none) | assumption: the UCx84x has no internal soft start; usually done with a capacitor on COMP |
| `rOutHi` | Ω | 75 | 100m – 10k Ω | Output resistance to VCC (high level) | Section 6.5 VOUT high 13.5 V at 20 mA from VCC = 15 V, p.8 |
| `rOutLo` | Ω | 5 | 100m – 10k Ω | Output resistance to GND (low level) | Section 6.5 VOUT low 0.1 V at 20 mA, p.8 |
| `rOff` | Ω | 1000000 | 1k – 1t Ω | Off-state resistance of the output switches | assumption: the solver's default switch off resistance |

_參數說明在兩種語言中都是英文。_

## 模型

振盪器頻率為 fosc = 1.72 / (rt * ct)，輸出以 fsw = fosc / oscDiv 切換（oscDiv 為 2 時是 UCx844/5 的 toggle 正反器）。鋸齒波讓輸出在每個週期的前 dmax 導通，這也是開關導通的時脈。誤差放大器是單極點（a0、gbw），輸入為 err = vRef - VFB，輸出限制在 vCompLo 到 vCompHi，並經 rCompOut 驅動 COMP。iSource 大於 0 時，放大器只經 rCompOut 從上方箝制 COMP，另由大小為 iSource 的電流源供給該腳位，如同 VFB 接地、光耦合器把 COMP 往下拉時實際輸出級處於限流的情形。電流臨界為 (V(COMP) - vCompOff) / acs，限制在 0 到 vcsMax（tSoft 大於 0 時再受軟啟動斜坡限制）。V(CS) 超過臨界時輸出關閉，直到下一個時脈，每週期只跳脫一次。VCC 低於 UVLO（vccOn、vccOff）時輸出保持低準位。模型沒有斜率補償，因此工作比超過 50 % 會出現次諧波不穩定，除非在外部把斜坡加到 CS。

## 常見錯誤

- 頻率由 rt 與 ct 決定，沒有另外的頻率參數。預設值下約為 52 kHz，ct 若填 3.3 而不是 3.3n，頻率會差九個數量級。
- 誤差放大器使迴路很剛性，請用 50 ns 以下的步長，且每個切換週期要有數百步。步長太大會讓電流跳脫點過衝，或使 COMP 節點無法穩定。
- VFB 與 CS 都不可懸空。VFB 懸空時 COMP 會被推到上限，轉換器就以滿電流運作。

Problems 規則: `step.too_large`, `param.out_of_range`, `pin.unconnected`

## 規格書與來源

rt 與 ct 是你自己的計時零件，規格書給的是 f = 1.72 / (RT*CT)。UCx842/3 的 oscDiv 為 1，UCx844/5 為 2（電氣特性附註 5）。dmax、vRef、a0、gbw、vCompLo、vCompHi、acs、vcsMax 取自電氣特性中的 PWM、誤差放大器與電流感測列。vccOn、vccOff、rOutHi、rOutLo 取自 UVLO 與輸出列。iSource 取自誤差放大器的輸出源出電流列。vCompOff、tSoft、rCompOut 是假設值。

## 範例

以指令 `file.openExample` 開啟範例，名稱為 `demo:pwmController`.

---
由 `cargo xtask reference` 依使用說明文字與參數規格產生，請勿手動編輯。
