Skip to content

microchip-pic-avr-examples/pic18f56q71-mindi-compare-mplab-mcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCHP

Comparing Simulation to Reality with PIC18F56Q71

This code example contains the code and analog simulation models for the upcoming video "Comparing Simulation to Reality with PIC18F56Q71". This video will compare an analog circuit simulation to the performance of the real device.

Related Documentation

Simulation Software

See Mindi Model Installation for guidance.

Development Software

Hardware Used

  • PIC18F56Q71 Curiosity Nano
  • Oscilloscope
  • 10x Oscilloscope Probe (with hook adapter)
  • Function Generator
  • BNC T-Junction (female to 2x male)
  • BNC-BNC Cable (female to female)
  • BNC (female) to Mini-Hooks Cable

Hardware Setup

Warning: Do not apply voltages outside of the absolute maximum ratings to the I/O of the microcontroller. This may cause permanent damage to the device, the Curiosity Nano, and/or the connected computer!

Test Setup

Note: These instructions assume the nano has been programmed. If it has not, make the sure the Curiosity Nano can be connected to a computer for programming after all cables are attached.

Set up the function generator waveform output. The configured waveform should always remain within the absolute maximum ratings of the microcontroller. (By default, the Curiosity Nano runs at 3.3V.)

For the video, the following waveform settings were used:

Setting Value
Waveform Sine
Frequency 1 kHz
Amplitude 1 Vpp
Offset 500 mV
Load Hi-Z

With the output OFF, connect the function generator output to the BNC T-Junction. Then, use a BNC-BNC cable to connect one side of the T-junction to your oscilloscope. After connecting, make sure this oscilloscope channel is set to 1x mode with 1MΩ termination.

Next, use the BNC to Mini-Hooks cable to connect from the other side of the T-junction to the Curiosity Nano. Connect the ground hook to a GND point or pin, and connect the signal to RB1. Then, connect your 10x oscilloscope probe to RA1 on the Curiosity Nano. (This oscilloscope input should also be set to 1MΩ termination.)

For the oscilloscope ground, connect to a ground point or pin on the nano. The gold-plated mounting holes on the USB-side can be used for grounding, be beware of any electronic components nearby. Alternatively, a female-to-male wire can be used on a ground pin for a suitable connection.

If the nano has been programmed, plug the nano into any USB power supply or port. Then, enable the output of the function generator.

If the nano has not been programmed, connect the nano to a computer and perform Drag-and-Drop programming, which is described below. (Alternatively, you can compile from source and program in MPLAB X IDE).

Drag-and-Drop Programming

  1. On the Github page for this example, go to the Releases section on the right-side of the screen.
    Github Releases
  2. Download and unzip the hex files for the example.
  3. Select one of the provided hex files and drag-and-drop the file over the Curiosity Nano icon in the File Explorer. (Both hex files will function identically on the device, the difference is in memory usage.)
    Curiosity Icon
  4. If programming is successful, the yellow LED should start blinking.

Microcontroller I/O Summary

Pin Description
RA1 OPAMP Output (to oscilloscope)
RB1 Analog Input (from function generator)
RC7 Blinking LED Indicator

Mindi Model Installation

  1. Download and install MPLAB Mindi.
  2. Download the Mindi model for the PIC18F56Q71 family of microcontrollers.
  3. Drag and drop the model file into the Command Shell of Mindi.
    Mindi Command Shell
  4. There will be a prompt to install the model.
    Mindi Install Prompt
  5. This model can now be found within Mindi.

Operation

This example implements a simple non-inverting operational amplifier with a gain of 2, as shown below. Resistor values are approximate values.

Non-Inverting Amplifier

To compare, a Mindi schematic of this same configuration is provided in this repository.

Summary

This example provides the source code and documentation for the video.

About

Compare the performance of the integrated OPAMP with a simulation of the device.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published