I enjoyed this example as it’s interfacing between the user and the MCU via a computer. It also showed some interesting concepts on power management within source code.
I did notice this time I needed to use a different approach to telling the compiler I’m using the Explorer16. For some reason, it would not maintain the setting using the pre-programmer directive. So open up the file include\pic24_all.h and right at the start of the code, add the directive
Here is the snippit of the file.
// Documentation for this file. If the \file tag isn't present, // this file won't be documented. /** \file * This header file includes the all the pic24_*.h files as detailed * in the \ref index and also includes the necessary * processor-specific include file (via a \#include p24h/fxxxx.h). */ // Added this define as I'm using the Explorer16 for these examples. #define EXPLORER16_100P #ifndef _PIC24_ALL_H_ #define _PIC24_ALL_H_ // Include processor-specific header file #if defined(__PIC24H__)
You will also need to change the device to your processor as the default project uses the PIC24HJ32GP202. It should be PIC24FJ128GP010 if your using the default PIM on the Explorer 16. You do this in the menu item [Configure] – [Select Device].