- What this example do?
- How I must configure my ORbit16™ to work with this example?
- Where I can learn more about this?
- Download this example!
In the previous example we’ve used PPS with UART1. Now we are going to do the same thing but with UART2 and using the PRINTF function that comes with standard C library <STDIO.H>.
When you press SW2 on ORbit16™, it answers back with a message sent on serial port with the number of times SW2 was pressed. In the meanwhile, L2 will flash indipendently using interrupt on Timer1. Now we’ve a second source of interrupt: the receive interrupt on UART2. When the UART2 receives a byte, it will echoes back on the screen.
PRINTF can works only with ONE UART peripheral, so you must specify the UART with printf must work by setting a variable.
For this example you need a serial adapter since the UART on ORbit16™ works at 3.3V. So if you’ve a COM port on you PC, you need an adapter from RS232 to TTL level at 3.3V. If your PC doesn’t have a COM port, you can use an USB/TTL adapter. Please remember your adapter must works with a TTL level of 3.3V.
Using the PPS feature we redirect the UART2 Transmit on port RP14 and UART2 Receive on RP15 (for compactness those ports are identified as P14 and P15 on the ORbit16™). Yes, it is the same configuration of previous example! Don’t forget to connect ground lines together! Here are shown the connections with a 990.004 USB to Serial Micro Converter from Droids.it (click the image for enlarge):
We configure the UART2 peripheral to works at 57600bps, 8 data bits, 1 stop bit, No parity. You can use any terminal software on your pc to see how this demo works:
I hope you’ve read the documents adviced in the previous examples, since are the same.UART2 - PrintF usage (134 downloads)