Skip to content

Instantly share code, notes, and snippets.

@hayview
Created March 24, 2015 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hayview/1e4602c0aa0a415a1554 to your computer and use it in GitHub Desktop.
Save hayview/1e4602c0aa0a415a1554 to your computer and use it in GitHub Desktop.
SK40C pic development kit hardware profile
/********************************************************************
FileName: HardwareProfile - PIC SK40C.h
Dependencies: See INCLUDES section
Processor: PIC18 USB Microcontrollers
Hardware: PIC SK40C
Compiler: Microchip C18
Company: CYTAN.
********************************************************************
File Description:
Change History:
Rev Date Description
1.0 22/03/2015 Initial release
********************************************************************/
#ifndef HARDWARE_PROFILE_PIC_SK40C_H
#define HARDWARE_PROFILE_PIC_SK40C_H
/*******************************************************************/
/******** USB stack hardware selection options *********************/
/*******************************************************************/
//This section is the set of definitions required by the MCHPFSUSB
// framework. These definitions tell the firmware what mode it is
// running in, and where it can find the results to some information
// that the stack needs.
//These definitions are required by every application developed with
// this revision of the MCHPFSUSB framework. Please review each
// option carefully and determine which options are desired/required
// for your application.
//The PICDEM FS USB Demo Board platform supports the USE_SELF_POWER_SENSE_IO
//and USE_USB_BUS_SENSE_IO features. Uncomment the below line(s) if
//it is desireable to use one or both of the features.
//#define USE_SELF_POWER_SENSE_IO
#define tris_self_power TRISAbits.TRISA2 // Input
#if defined(USE_SELF_POWER_SENSE_IO)
#define self_power PORTAbits.RA2
#else
#define self_power 1
#endif
//#define USE_USB_BUS_SENSE_IO
#define tris_usb_bus_sense TRISAbits.TRISA1 // Input
#if defined(USE_USB_BUS_SENSE_IO)
#define USB_BUS_SENSE PORTAbits.RA1
#else
#define USB_BUS_SENSE 1
#endif
//Uncomment the following line to make the output HEX of this
// project work with the MCHPUSB Bootloader
//#define PROGRAMMABLE_WITH_USB_MCHPUSB_BOOTLOADER
//Uncomment the following line to make the output HEX of this
// project work with the HID Bootloader
#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/******** Application specific definitions *************************/
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/** Board definition ***********************************************/
//These defintions will tell the main() function which board is
// currently selected. This will allow the application to add
// the correct configuration bits as wells use the correct
// initialization functions for the board. These defitions are only
// required in the stack provided demos. They are not required in
// final application design.
#define DEMO_BOARD PICDEM_FS_USB
#define PICDEM_FS_USB
#define CLOCK_FREQ 20000000
/** LED ************************************************************/
#define mInitAllLEDs() LATB &= 0x0D; TRISB &= 0x0D;
#define mLED_1 LATBbits.LATB6
#define mLED_2 LATBbits.LATB7
#define mGetLED_1() mLED_1
#define mGetLED_2() mLED_2
#define mLED_1_On() mLED_1 = 1;
#define mLED_2_On() mLED_2 = 1;
#define mLED_1_Off() mLED_1 = 0;
#define mLED_2_Off() mLED_2 = 0;
#define mLED_1_Toggle() mLED_1 = !mLED_1;
#define mLED_2_Toggle() mLED_2 = !mLED_2;
/** SWITCH *********************************************************/
#define mInitAllSwitches() TRISBbits.TRISB0=1;TRISBbits.TRISB1=1;
#define mInitSwitch1() TRISBbits.TRISB0=1;
#define mInitSwitch2() TRISBbits.TRISB1=1;
#define sw1 PORTBbits.RB0
#define sw2 PORTBbits.RB1
/** USB external transceiver interface (optional) ******************/
#define tris_usb_vpo TRISBbits.TRISB3 // Output
#define tris_usb_vmo TRISBbits.TRISB2 // Output
#define tris_usb_rcv TRISAbits.TRISA4 // Input
#define tris_usb_vp TRISCbits.TRISC5 // Input
#define tris_usb_vm TRISCbits.TRISC4 // Input
#define tris_usb_oe TRISCbits.TRISC1 // Output
#define tris_usb_suspnd TRISAbits.TRISA3 // Output
/** I/O pin definitions ********************************************/
#define INPUT_PIN 1
#define OUTPUT_PIN 0
#endif //HARDWARE_PROFILE_PIC_SK40C_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment