yawijaya
Member level 2
- Joined
- Aug 18, 2009
- Messages
- 42
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- New Freedom, PA-USA
- Activity points
- 1,625
Hi guys, i'm currently learning the firmware code for microchip pic18f4550, generic USB HID. I got the firmware from lvr.com as an example. one of the header file, HardwareProfile.h has the list of microcontroller that can be used, and then a specific HardwareProfile header file is tied with each type of microcontroller. Here's a chunk from the code
#if defined(__18CXX)
#if defined(__18F4550)
#include "HardwareProfile - PICDEM FSUSB.h"
#elif defined(__18F87J50)
#include "HardwareProfile - PIC18F87J50 PIM.h"
#elif defined(__18F14K50)
#include "HardwareProfile - Low Pin Count USB Development Kit.h"
#elif defined(__18F46J50)
#if defined(PIC18F_STARTER_KIT_1)
#include "HardwareProfile - PIC18F Starter Kit 1.h"
#else
#include "HardwareProfile - PIC18F46J50 PIM.h"
#endif
#endif
#endif
my question is, how can the firmware know which type of chip i'm using? I assume that in order for the firmware to know which chip i am using on the board, something has to be declared somewhere. but I don't find #define(__18CXX) or #define(__18F4550) in any of the headers and source file. So how does it actually work?will the microcontroller itself define #define(__18CXX) and #define(__18F4550) once its powered?Thanks for your help!
#if defined(__18CXX)
#if defined(__18F4550)
#include "HardwareProfile - PICDEM FSUSB.h"
#elif defined(__18F87J50)
#include "HardwareProfile - PIC18F87J50 PIM.h"
#elif defined(__18F14K50)
#include "HardwareProfile - Low Pin Count USB Development Kit.h"
#elif defined(__18F46J50)
#if defined(PIC18F_STARTER_KIT_1)
#include "HardwareProfile - PIC18F Starter Kit 1.h"
#else
#include "HardwareProfile - PIC18F46J50 PIM.h"
#endif
#endif
#endif
my question is, how can the firmware know which type of chip i'm using? I assume that in order for the firmware to know which chip i am using on the board, something has to be declared somewhere. but I don't find #define(__18CXX) or #define(__18F4550) in any of the headers and source file. So how does it actually work?will the microcontroller itself define #define(__18CXX) and #define(__18F4550) once its powered?Thanks for your help!