System Development
Coding Examples

Basic Setup

6min

For more information about the PIC16F18875 | PIC16F18877

In the code sample below, the device is set up to use PORTB and PORTE to flash an LED. This is a simple project and is often used as a "heartbeat" to ensure that the device is working.

The code sample below is written in Mikro C, available from Mikroe.

main ()

The code is initiated by first setting up the device and then going into a continual loop flashing the designated pin.

setup_Device()

The device setup does the following:

  • The analogs for each port are disabled, as we will be using them as digital I/O.
  • All the pins are set to input
  • Ony the designated pins are set for outputs
  • Comparators are also disabled

flash_Pin()

The pin on PORT# Bit 0 is toggled once every 500ms

Code Sample

The sample described above is listed below. Use the copy function to extract the code for use.

C
๏ปฟ

Parts List

To complete this project the following is needed:

  • Radix Duo (with PIC16F18875 | PIC16F18877) + Radix Shield

Alternatively, you may use the following

  • Radix Duo (with PIC16F18875 | PIC16F18877)
  • 820 Ohm Resistor
  • 3 or 5 mm LED

[END]

Updated 21 Jul 2023
Doc contributor
Did this page help you?