Giter VIP home page Giter VIP logo

pic32mxblinky's Introduction

PIC32MXBlinky

Blink a LED on a PIC32MX250F256L dev board. Main loop timing by millisecond timer interrupt generated by Timer 1. 500Hz square wave on RD11, pin 71. LED on RB9, pin 33, blinks at 1Hz. UART1 on pins 89 and 90 transmits at 9600 baud. Tact switch or pushbutton on RA1, pin 38, with pull-up resistor. Three channels of PWM on OC1, OC2, and OC3 to drive an RGB LED.

Later, we'll have:

  • SPI channels configured to send data

Connections

Name Port Pin PIC32MX795F512L pin Activity
LED RB9 33 33 LED, active-LOW
SQWAVE RD11 71 71 500Hz
U1TX RG0 90 53 (RF8) UART1 transmit
U1RX RG1 89 52 (RF2) UART1 receive
BUTTON RA1 38 38 Button, active-LOW
RED RD0 72 72 (RD0/OC1) Red LED PWM
GREEN RD1 76 76 (RD1/OC2) Green LED PWM
BLUE RD2 77 77 (RD2/OC3) Blue LED PWM

PIC32 pin numbers are for the 100-pin package.

Note that the PIC32MX795F512L does not have PPS and therefore has all the peripheral pins pre-assigned. It is not possible to assign U1TX to RF8 via PPS on the chips which do have it. Which means that we have the plain GPIOs assigned the same, but the UART assigned differently between the two classes of chip.

LED on RB9 lights when the pin is pulled LOW. RGB LED lights when the PWM pin is HIGH.

Configurations

Name PIC32 RAM Flash Clock Notes
default PIC32MX250F256L 32k 256k+3k 48MHz The usual PIC32 on the Reach Robotics Leg Test Board
MoreRAM PIC32MX570F512L 64k 512k+3k 48MHz Modified board with 64k RAM
Faster PIC32MX795F512L 128k 512k+12k 80MHz Modified board with 80MHz and 128k RAM

The PLL setup for the PIC32MX795F512L is different from the other two so that we get an 80MHz SYSCLK. This makes the PIC32MX795F512L about 4.5 times faster than the other PIC32s, once we have switched on the cache and the prefetch buffer in 'initMCU()'. But we must divide SYSCLK by two to get a 40MHz PBCLK which is within the limits of the chip. A #define in the code (FPBCLK) is used to calculate timer settings and baud rates.

PIC32 Toolchain

MPLAB X V3.45 and 'xc32' V2.15. These are quite old versions now, so I really ought to upgrade!

PIC32 Programmer

Microchip ICD3. Other programmers should work, e.g. ICD4 or PICkit4.

pic32mxblinky's People

Contributors

anachrocomputer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.