Presentation is loading. Please wait.

Presentation is loading. Please wait.

A/D Converter Control Discussion D8.6. Analog-to-Digital Converters Converts analog signals to digital signals –8-bit: 0 – 255 –10-bit: 0 – 1023 –12-bit:

Similar presentations


Presentation on theme: "A/D Converter Control Discussion D8.6. Analog-to-Digital Converters Converts analog signals to digital signals –8-bit: 0 – 255 –10-bit: 0 – 1023 –12-bit:"— Presentation transcript:

1 A/D Converter Control Discussion D8.6

2 Analog-to-Digital Converters Converts analog signals to digital signals –8-bit: 0 – 255 –10-bit: 0 – 1023 –12-bit: 0 – 4095 Successive Approximation

3 Method of Successive Approximation

4 Implementing Successive Approximation

5

6 A/D CPLD Control

7 Use Mealy Machine Inputs to C1: adstart, gt, done Outputs from C2: sarald, sh, adld, msel

8 A/D Control Unit

9 A Mealy state machine

10 ADctl adflg = done; msel = ~gt; adld = done; sarld = ~done; sh = ~done;

11

12 A Mealy state machine Use one-hot encoding: one flip-flop per state

13 module DFF (D, clk, clr, Q); input clk, clr ; wire clk, clr ; input D ; wire D ; output Q ; reg Q ; always @(posedge clk or posedge clr) if(clr == 1) Q <= 0; else Q <= D; endmodule

14 module DFF1 (D, clk, reset, Q); input clk, reset; wire clk, reset ; input D ; wire D ; output Q ; reg Q ; always @(posedge clk or posedge reset) if(reset == 1) Q <= 1; else Q <= D; endmodule

15 // adconv control module ADctrl(Clk, Clear, gt, adstart, done, msel, sarld, sh, adld, adflg); input Clk, Clear, gt, adstart, done; output msel, sarld, sh, adld, adflg; wire msel, sarld, sh, adld, adflg; wire start, keep, remove; wire startD, keepD, removeD; assign startD = start & ~adstart | keep & done | remove & done; assign keepD = start & adstart & gt | keep & gt & ~done | remove & gt & ~done; assign removeD = start & adstart & ~gt | keep & ~gt & ~done | remove & ~gt & ~done;

16 DFF1 startFF(.D(startD),.clk(Clk),.reset(Clear),.Q(start)); DFF keepFF(.D(keepD),.clk(Clk),.clr(Clear),.Q(keep)); DFF removeFF(.D(removeD),.clk(Clk),.clr(Clear),.Q(remove));

17 // C2 Outputs assign adflg = done; assign msel = ~gt; assign adld = done; assign sarld = ~done & keep | ~done & remove | adgo & start; assign sh = ~done & keep | ~done & remove | adgo & start; endmodule

18 // Title : A/D converter module adconv(clock, clear, adstart, gt, adflg, sar, adreg); input clock, clear, adstart, gt; output adflg; output [3:0] sar, adreg; wire adflg, msel, sarld, adld, sh, done; wire [3:0] sar, adreg; ADpath adc1(.clk(clock),.reset(clear),.msel(msel),.sh(sh),.sarld(sarld),.adld(adld),.sar(sar),.ADR(adreg),.done(done)); ADctrladc2(.Clk(clock),.Clear(clear),.gt(gt),.adstart(adstart),.done(done),.msel(msel),.sarld(sarld),.sh(sh),.adld(adld),.adflg(adflg)); endmodule

19 A Mealy state machine Use binary encoding: two flip-flops

20 // adconv control module ADctrl(Clk, Clear, gt, adstart, zero, msel, sarld, sh, adld, adflg); input Clk, Clear, gt, adstart, zero; output msel, sarld, sh, adld, adflg; reg msel, sarld, sh, adld, adflg; reg[2:0] present_state, next_state; parameterstart = 2'b00, keep = 2'b01, remove = 2'b11;

21 always @(posedge Clk or posedge Clear) begin if (Clear == 1) present_state <= start; else present_state <= next_state; end

22 always @(present_state or adstart or gt or done) begin case(present_state) start: if(adstart == 1) next_state <= load; else if(gt == 1) next_state <= keep; else next_state <= remove; keep: if(done == 1) next_state <= start; else if(gt == 1) next_state <= keep; else next_state <= remove; remove: if(done == 1) next_state <= start; else if(gt == 1) next_state <= keep; else next_state <= remove; default next_state <= start; endcase end

23 // C2 Outputs assign adflg = done; assign msel = ~gt; assign adld = done; assign sarld = ~done & keep | ~done & remove | adgo & start; assign sh = ~done & keep | ~done & remove | adgo & start; endmodule

24 A/D Control Unit

25 // Title : A/D converter module adconv(clock, clear, adstart, gt, adflg, sar, adreg); input clock, clear, adstart, gt; output adflg; output [3:0] sar, adreg; wire adflg, msel, sarld, adld, sh, done; wire [3:0] sar, adreg; ADpath adc1(.clk(clock),.reset(clear),.msel(msel),.sh(sh),.sarld(sarld),.adld(adld),.sar(sar),.ADR(adreg),.done(done)); ADctrl adc2(.Clk(clock),.Clear(clear),.gt(gt),.adstart(adstart),.done(done),.msel(msel),.sarld(sarld),.sh(sh),.adld(adld),.adflg(adflg)); endmodule

26


Download ppt "A/D Converter Control Discussion D8.6. Analog-to-Digital Converters Converts analog signals to digital signals –8-bit: 0 – 255 –10-bit: 0 – 1023 –12-bit:"

Similar presentations


Ads by Google