Skip to content

Commit 920bab7

Browse files
Updated review comments
1 parent 965dfb5 commit 920bab7

File tree

8 files changed

+58
-58
lines changed

8 files changed

+58
-58
lines changed

dspic33e-adc-1msps/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ In this example, ADC is set up to convert AIN0 using CH0 and CH1 sample/hold in
88
at 1.1MHz throughput rate. ADC clock is configured at 13.3Mhz or Tad=75ns
99
ADC Conversion Time for 10-bit conversion is Tc=12 * Tab = 900ns (1.1MHz).
1010

11-
void initAdc1(void);<br />
11+
void initAdc1(void);
1212
ADC CH0 and CH1 S/H is set-up to covert AIN0 in 10-bit mode. ADC is configured to next sample data immediately after the conversion.
1313
So, ADC keeps conversion data through CH0/CH1 S/H alternatively. Effective conversion rate is 1.1Mhz
1414

15-
void initDma0(void);<br />
15+
void initDma0(void);
1616
DMA channel 0 is configured in ping-pong mode to move the converted data from ADC to DMA RAM on every sample/convert sequence.
1717
It generates interrupt after every 16 sample transfer.
1818

19-
void \_\_attribute\_\_((\_\_interrupt\_\_)) _DMA0Interrupt(void);<br />
19+
void \_\_attribute\_\_((\_\_interrupt\_\_)) _DMA0Interrupt(void);
2020
DMA interrupt service routine, moves the data from DMA buffer to ADC signal buffer and collects 256 samples.
2121

2222
The Toggle frequency of one pulse should be around 240us(micro second), if the operating clock frequency at 40Mhz.

dspic33e-adc-fir-dma/README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,43 @@
44

55
## Description:
66

7-
In this example, ADC is configured to sample (AN5) at 250 KHz rate and the converted data is assembled in a 480-sample buffer. This input data is then filtered using the block FIR filter function from the DSP library. A 20-tap filter is used.<br />
8-
Timer 3 is setup to time-out every 4 microseconds (250 KHz rate). On every Timer3 time-out (every Ts = 4 microsecs), the ADC module will stop sampling and trigger a 10-bit A/D conversion. At that time, the conversion process starts and completes Tc = 12 * Tad = 1.2 microsecs later. <br />
9-
When the conversion is complete, the module starts sampling again. <br />
10-
However, since Timer3 is already on and counting, about (Ts-Tc) secs later Timer3 will expire again and trigger the next conversion. <br />
11-
The DMA is configured in continuous, ping pong mode, such that after the DMA channel has read 480 samples into a buffer (BufferA/BufferB) a DMA interrupt is generated.<br />
12-
These samples are filtered by a function call in the main function while the DMA controller starts filling new ADC samples into buffer (BufferB/BufferA). Thus the two buffers are alternately filled and processed in an infinite loop.<br />
13-
The ADC module clock time period is configured as Tad = Tcy * (ADCS+1) = (1/40M) * 1 = 100ns nanosecs with ADCS = 3. Hence the conversion time for 10-bit A/D is 12 * Tad = 1.2 microsecs.<br />
14-
FIRStruct describes the data structure for FIR filter with the filter specifications given below. FIRStructInit() initializes the FIR filter structure parameters. <br />
15-
FIRDelayInit() initializes the delay values in the FIR filter structure to zeros. The FIR() function applies an FIR filter to a sequence of source samples and places the result in a sequence of destination samples.<br />
16-
17-
FIR filter specifications used:<br />
18-
Sampling freq = 250 KHz<br />
19-
FIR block size, N = 480<br />
20-
Number of FIR coefficients, M = 20<br />
21-
FCY = 40 MIPS<br />
22-
Passband Frequency = 1300 Hz<br />
23-
Stopband Frequency = 1350 Hz<br />
24-
Passband Ripple = 1 dB<br />
25-
Stopband Ripple = 3 dB<br />
7+
In this example, ADC is configured to sample (AN5) at 250 KHz rate and the converted data is assembled in a 480-sample buffer. This input data is then filtered using the block FIR filter function from the DSP library. A 20-tap filter is used.
8+
Timer 3 is setup to time-out every 4 microseconds (250 KHz rate). On every Timer3 time-out (every Ts = 4 microsecs), the ADC module will stop sampling and trigger a 10-bit A/D conversion. At that time, the conversion process starts and completes Tc = 12 * Tad = 1.2 microsecs later.
9+
When the conversion is complete, the module starts sampling again.
10+
However, since Timer3 is already on and counting, about (Ts-Tc) secs later Timer3 will expire again and trigger the next conversion.
11+
The DMA is configured in continuous, ping pong mode, such that after the DMA channel has read 480 samples into a buffer (BufferA/BufferB) a DMA interrupt is generated.
12+
These samples are filtered by a function call in the main function while the DMA controller starts filling new ADC samples into buffer (BufferB/BufferA). Thus the two buffers are alternately filled and processed in an infinite loop.
13+
The ADC module clock time period is configured as Tad = Tcy * (ADCS+1) = (1/40M) * 1 = 100ns nanosecs with ADCS = 3. Hence the conversion time for 10-bit A/D is 12 * Tad = 1.2 microsecs.
14+
FIRStruct describes the data structure for FIR filter with the filter specifications given below. FIRStructInit() initializes the FIR filter structure parameters.
15+
FIRDelayInit() initializes the delay values in the FIR filter structure to zeros. The FIR() function applies an FIR filter to a sequence of source samples and places the result in a sequence of destination samples.
16+
17+
FIR filter specifications used:
18+
Sampling freq = 250 KHz
19+
FIR block size, N = 480
20+
Number of FIR coefficients, M = 20
21+
FCY = 40 MIPS
22+
Passband Frequency = 1300 Hz
23+
Stopband Frequency = 1350 Hz
24+
Passband Ripple = 1 dB
25+
Stopband Ripple = 3 dB
2626
Kaiser Windowing
2727

2828
The FIR() function takes [53+N(4+M)] instruction cycles. In this example, since N = 480 and M = 20, the total number of instruction cycles taken by FIR() is C = 11,573. Since the instruction cycle frequency is FCY = 40 MIPS the total time taken by the FIR filter to filter 480 samples is TFIR = C/FCY = 0.3 millisecs.
2929

3030
NOTE: A NOP associated with Y memory errata was removed from the fir.s source in the DSP library before using it in this code example, as this errata item only applies to certain dsPIC30F devices and does not affect the dsPIC33E device family.
3131

3232

33-
void initTmr3();<br />
33+
void initTmr3();
3434
Timer 3 is configured to time-out at 250 KHz rate.
3535

36-
void initAdc1(void);<br />
36+
void initAdc1(void);
3737
ADC module is set-up to convert AIN5 input using CH0 S/H on Timer 3 event in 10-bit mode.
3838

39-
void initDma0(void);<br />
39+
void initDma0(void);
4040
DMA channel 0 is confiured in ping-pong mode to move the converted data from ADC to DMA RAM on every sample/convert sequence.
4141
It generates interrupt after every 480 sample transfer.
4242

43-
void \_\_attribute\_\_((\_\_interrupt\_\_)) _DMA0Interrupt(void);<br />
43+
void \_\_attribute\_\_((\_\_interrupt\_\_)) _DMA0Interrupt(void);
4444
DMA interrupt service routine sets flag for FIR filtering on the data buffer.
4545

4646

dspic33e-adc-iir-filter/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@
66

77
In this example, ADC is configured to sample (AIN5) at 8Khz rate and converted data is assembled as 256 sample buffer before triggering filtering operation.
88

9-
Timer 3 is setup to time-out every 125 microseconds (8Khz Rate). <br />
10-
As a result, the module will stop sampling and trigger a 12-bit A/D conversion on every Timer3 time-out, i.e., Ts=125us. <br />
11-
At that time, the conversion process starts and completes Tc=14*Tad periods later.<br />
9+
Timer 3 is setup to time-out every 125 microseconds (8Khz Rate).
10+
As a result, the module will stop sampling and trigger a 12-bit A/D conversion on every Timer3 time-out, i.e., Ts=125us.
11+
At that time, the conversion process starts and completes Tc=14*Tad periods later.
1212
When the conversion completes, the module starts sampling again. However, since Timer3
1313
is already on and counting, about (Ts-Tc)us later, Timer3 will expire again and trigger
1414
next conversion.
1515

1616
ADC module clock time period is configured as Tad=Tcy*(ADCS+1)= (1/40M)*64 = 1.6us (625Khz).
1717
Hence the conversion time for 12-bit A/D Conversion Time Tc=14*Tad = 22.4us
1818

19-
void initTmr3();<br />
19+
void initTmr3();
2020
Timer 3 is configured to time-out at 8Khz rate.
2121

22-
void initAdc1(void);<br />
22+
void initAdc1(void);
2323
ADC module is set-up to convert AIN5 input using CH0 S/H on Timer 3 event in 12-bit mode.
2424

25-
void initDma0(void);<br />
25+
void initDma0(void);
2626
DMA channel 0 is configured in ping-pong mode to move the converted data from ADC to DMA RAM on every sample/convert sequence.
2727
It generates interrupt after every 256 sample transfer.
2828

29-
void \_\_attribute\_\_((\_\_interrupt\_\_)) _DMA0Interrupt(void);<br />
29+
void \_\_attribute\_\_((\_\_interrupt\_\_)) _DMA0Interrupt(void);
3030
DMA interrupt service routine performs IIR filtering on the data buffer.
3131

3232

dspic33e-pmp/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ The PMP module is configured in the Master Mode.
1212
Set the I/O ports as digital ports.
1313

1414

15-
mLDCInit()<br />
15+
mLDCInit()
1616
This function will initialise the LCDinit pointer to sets LCDState mchine to _uLCDstate = 2
1717

1818

19-
TimerInit()<br />
19+
TimerInit()
2020
This function will enable to run the Timer
2121

2222

23-
BannerStart()<br />
24-
This function will enable to Setup the banner processing<br />
23+
BannerStart()
24+
This function will enable to Setup the banner processing
2525
The following events are performed in this function
2626
- Check if the LCD is busy
2727
- Set the Cursor to the starting point
@@ -30,22 +30,22 @@ The following events are performed in this function
3030

3131
In the While loop the following events follow.
3232

33-
LCDProcessEvents()<br />
33+
LCDProcessEvents()
3434
This is a state machine to issue commands and data to LCD. Must be called periodically to make LCD message processing.
3535
The communication with the LCD module is enabled through the PMP module.
3636
This function Initialises the LCD function + Processes a series of LCD events.
3737

38-
- Initialises the LCD function.<br />
38+
- Initialises the LCD function.
3939
Open the PMP module for communication with LCD ( Case2)
4040
complete a set of events to initialise the LCD from (Case 64 to case 71)
4141
Clear the LCD state machine i.e (_uLCDstate = 0)
4242

4343

44-
TimerIsOverflowEvent()<br />
44+
TimerIsOverflowEvent()
4545
Only on timer Overflow the BannerProcessEvents is processed
4646

4747

48-
BannerProcessEvents()<br />
48+
BannerProcessEvents()
4949
- Display the Banner array
5050
Pick the character to be displayed from the banner pointer
5151
Prepare the character for display

dspic33e-pwm-oc-ptg/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ phase shift of half the PWM period between OC1 and OC2 outputs.
1717

1818
PTG Timer is configured for delay of 20us and calculation is as follows:
1919

20-
Required delay: 20us<br/>
21-
PTG Clock: 70MHz<br/>
22-
COunt in PTGT0LIm: 20us/(1/70MHz) = 20us*70Mhz = 1400;<br/>
20+
Required delay: 20us
21+
PTG Clock: 70MHz
22+
COunt in PTGT0LIm: 20us/(1/70MHz) = 20us*70Mhz = 1400;
2323

2424
In this example OC2 is configured for 25% duty cycle or 10us .
2525

dspic33e-spi-loopback/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@
77
In this code examples, 2x16=32words is transmitted using SPI and received back in ping-pong mode.
88
This operation happens continuously.
99

10-
Note: RG7 pin should be connected to RG8 externally (Depending on the PIN mapping, accordingly the it varies.Pls refer corresponding PIM sheet respectively)<br/>
11-
For dspic33ep512mu810 :RG7 pin should be connected to RG8 externally .<br/>
12-
For dspic33ep256gp506 :RF7 pin should be connected to RF8 externally .<br/>
13-
For dspic33ep512gm710 :RF7 pin should be connected to RF8 externally .<br/>
10+
Note: RG7 pin should be connected to RG8 externally (Depending on the PIN mapping, accordingly the it varies.Pls refer corresponding PIM sheet respectively)
11+
For dspic33ep512mu810 :RG7 pin should be connected to RG8 externally .
12+
For dspic33ep256gp506 :RF7 pin should be connected to RF8 externally .
13+
For dspic33ep512gm710 :RF7 pin should be connected to RF8 externally .
1414

15-
void CfgSpi1Master(void)/void CfgSpi2Master(void)<br/>
15+
void CfgSpi1Master(void)/void CfgSpi2Master(void)
1616
This function configures SPI in master mode to transmit/receive 16-bit word.
1717

18-
void initSPIBuff(void)<br/>
18+
void initSPIBuff(void)
1919
This function pre-initialise the transmit data buffer and DMA RAM buffer for transmission
2020

21-
void cfgDma0SpiTx(void)<br/>
21+
void cfgDma0SpiTx(void)
2222
This function configures DMA channel 0 for SPI transmission. DMA is configured in ping-pong mode
2323
with auto increment addressing for DMA memory read.
2424

25-
void cfgDma1SpiRx(void)<br/>
25+
void cfgDma1SpiRx(void)
2626
This function configures DMA channel 0 for SPI reception. DMA is configured in ping-pong mode
2727
with auto increment addressing for DMA memory write.
2828

29-
void \_\_attribute\_\_((\_\_interrupt\_\_)) _DMA0Interrupt(void)<br/>
29+
void \_\_attribute\_\_((\_\_interrupt\_\_)) _DMA0Interrupt(void)
3030
This interrupt routine handles transmit DMA interrupt
3131

32-
void \_\_attribute\_\_((\_\_interrupt\_\_)) _DMA1Interrupt(void)<br/>
32+
void \_\_attribute\_\_((\_\_interrupt\_\_)) _DMA1Interrupt(void)
3333
This interrupt routine handles the receive ping-pong buffer.
3434

3535

dspic33e-spi-no-dma/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ The code sends from 00h through FFh and then cycles through again. A delay was
1212

1313
Externally Connect for testing:
1414
-------------------------------
15-
RF7 & RF8 on Expl16 board for dspic33ep256GP506 PIM<br/>
16-
RF7 & RF8 on Expl16 board for dspic33ep512gm710 PIM<br/>
17-
RF2 & RF3 on Expl16 board for dspic33ep512mu810 PIM<br/>
15+
RF7 & RF8 on Expl16 board for dspic33ep256GP506 PIM
16+
RF7 & RF8 on Expl16 board for dspic33ep512gm710 PIM
17+
RF2 & RF3 on Expl16 board for dspic33ep512mu810 PIM
1818

1919

2020
## Hardware Used

dspic33e-timer1-rtc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ timers. Of these, the Timer1 module has the capability to be clocked by
99
an external asynchronous 32KHz crystal connected to the device via the
1010
SOSCI and SOSCO pins. The attached code example demonstrates how Timer1
1111
may be configured to use the 32KHz secondary oscillator for a real-time
12-
clock (RTC) application.<br/><br/>
12+
clock (RTC) application.
1313
Configuring Timer1 for the real-time clock application is a two-step
1414
process. In the first step, the code demonstrates how the secondary
1515
oscillator may be enabled via a special write sequence to the OSCCON

0 commit comments

Comments
 (0)