1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/docs/wiki/Examples--demo Mon May 20 23:34:28 2019 +0200
1.3 @@ -0,0 +1,57 @@
1.4 += Demo Example =
1.5 +
1.6 +This example demonstrates UART communication using UART1. Interrupt conditions
1.7 +on the UART peripheral are handled, input is tested, output is produced, and
1.8 +upon receiving the `0` character, DMA-driven output is initiated.
1.9 +
1.10 +The DMA-driven output demonstrates mechanisms employed by some of the [[VGA
1.11 +Output Examples|VGA examples]]. A channel is enabled by the interrupt handler
1.12 +and its transfers each initiated by a timer; this should cause text to be
1.13 +transmitted relatively slowly across the serial connection...
1.14 +
1.15 +{{{
1.16 +Hello!
1.17 +}}}
1.18 +
1.19 +When this first channel completes all transfers, two other channels chained to
1.20 +it are enabled. Another timer then causes their transfers to be initiated.
1.21 +Since these two channels effectively compete for access to the UART
1.22 +peripheral, their transfers are interleaved. Regardless of the configuration
1.23 +of the example, more text should be transmitted relatively slowly...
1.24 +
1.25 +{{{
1.26 +And once again, hello!
1.27 +}}}
1.28 +
1.29 +Although such DMA channel interleaving is rather exotic, other techniques
1.30 +employed by the example are likely to be applicable elsewhere.
1.31 +
1.32 +== Hardware Details ==
1.33 +
1.34 +The pin usage of this solution is documented below.
1.35 +
1.36 +=== PIC32MX270F256B-50I/SP Pin Assignments ===
1.37 +
1.38 +{{{
1.39 +MCLR# 1 \/ 28
1.40 + RA0 2 27
1.41 + RA1 3 26 RB15/U1TX
1.42 + RB0 4 25 RB14
1.43 + RB1 5 24 RB13/U1RX
1.44 + RB2 6 23
1.45 + RB3 7 22 RB11/PGEC2
1.46 + 8 21 RB10/PGEC3
1.47 + RA2 9 20
1.48 + RA3 10 19
1.49 + RB4 11 18 RB9
1.50 + 12 17 RB8
1.51 + 13 16 RB7
1.52 + RB5 14 15
1.53 +}}}
1.54 +
1.55 +Note that RB6 is not available on pin 15 on this device (it is needed for VBUS
1.56 +unlike the MX170 variant).
1.57 +
1.58 +=== UART Connections ===
1.59 +
1.60 +UART1 is exposed by the RB13 and RB15 pins.