No changes between revisions
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/HardwareProfile - PICDEM FSUSB.bak
0,0 → 1,210
/********************************************************************
FileName: HardwareProfile - PICDEM FSUSB.h
Dependencies: See INCLUDES section
Processor: PIC18 USB Microcontrollers
Hardware: PICDEM FSUSB
Compiler: Microchip C18
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
2.3 09/15/2008 Broke out each hardware platform into its own
"HardwareProfile - xxx.h" file
********************************************************************/
 
#ifndef HARDWARE_PROFILE_PICDEM_FSUSB_H
#define HARDWARE_PROFILE_PICDEM_FSUSB_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
 
/*******************************************************************/
/******** MDD File System selection options ************************/
/*******************************************************************/
#define USE_PIC18
 
#define ERASE_BLOCK_SIZE 64
#define WRITE_BLOCK_SIZE 32
 
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/******** 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 48000000
 
/** LED ************************************************************/
#define mInitAllLEDs() LATD &= 0xF0; TRISD &= 0xF0;
#define mLED_1 LATDbits.LATD0
#define mLED_2 LATDbits.LATD1
#define mLED_3 LATDbits.LATD2
#define mLED_4 LATDbits.LATD3
#define mGetLED_1() mLED_1
#define mGetLED_2() mLED_2
#define mGetLED_3() mLED_3
#define mGetLED_4() mLED_4
 
#define mLED_1_On() mLED_1 = 1;
#define mLED_2_On() mLED_2 = 1;
#define mLED_3_On() mLED_3 = 1;
#define mLED_4_On() mLED_4 = 1;
#define mLED_1_Off() mLED_1 = 0;
#define mLED_2_Off() mLED_2 = 0;
#define mLED_3_Off() mLED_3 = 0;
#define mLED_4_Off() mLED_4 = 0;
#define mLED_1_Toggle() mLED_1 = !mLED_1;
#define mLED_2_Toggle() mLED_2 = !mLED_2;
#define mLED_3_Toggle() mLED_3 = !mLED_3;
#define mLED_4_Toggle() mLED_4 = !mLED_4;
/** SWITCH *********************************************************/
#define mInitAllSwitches() TRISBbits.TRISB4=1;TRISBbits.TRISB5=1;
#define mInitSwitch2() TRISBbits.TRISB4=1;
#define mInitSwitch3() TRISBbits.TRISB5=1;
#define sw2 PORTBbits.RB4
#define sw3 PORTBbits.RB5
/** POT ************************************************************/
#define mInitPOT() {TRISAbits.TRISA0=1;ADCON0=0x01;ADCON2=0x3C;ADCON2bits.ADFM = 1;}
/** SPI : Chip Select Lines ****************************************/
#define tris_cs_temp_sensor TRISBbits.TRISB2 // Output
#define cs_temp_sensor LATBbits.LATB2
/** 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
/** TRIS ***********************************************************/
#define INPUT_PIN 1
#define OUTPUT_PIN 0
 
#if defined(YAS)
#define RXTX LATBbits.LATB5
#else
#define RXTX LATAbits.LATA2
#endif
 
#define BPF_S0 LATAbits.LATA0
#define BPF_S1 LATAbits.LATA1
 
#if defined(YAS)
#define BPF_S2 LATAbits.LATA2
#endif
 
#define BPF_S0_STATE PORTAbits.RA0
#define BPF_S1_STATE PORTAbits.RA1
 
#if defined(YAS)
#define BPF_S2_STATE PORTAbits.RA2
#endif
 
#define PADDLE_DIT PORTBbits.RB6
#define PADDLE_DAH PORTBbits.RB7
 
#define LPF_0 LATAbits.LATA3
#define LPF_1 LATAbits.LATA4
#define LPF_2 LATAbits.LATA5
 
#if defined(YAS)
#else
#define LPF_3 LATBbits.LATB2
#define LPF_4 LATBbits.LATB3
#define LPF_5 LATBbits.LATB4
#define LPF_6 LATBbits.LATB5
#endif
 
/** S W I T C H *****************************************************/
#define mInitSwitch() TRISCbits.TRISC2 = 1;
#define UserSW PORTCbits.RC2
 
#define mLED_Both_Off() {mLED_1_Off(); mLED_2_Off();}
#define mLED_Both_On() {mLED_1_On(); mLED_2_On();}
#define mLED_Only_1_On() {mLED_1_On(); mLED_2_Off();}
#define mLED_Only_2_On() {mLED_1_Off(); mLED_2_On();}
 
 
#endif //HARDWARE_PROFILE_PICDEM_FSUSB_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/HardwareProfile - PICDEM FSUSB.h
0,0 → 1,210
/********************************************************************
FileName: HardwareProfile - PICDEM FSUSB.h
Dependencies: See INCLUDES section
Processor: PIC18 USB Microcontrollers
Hardware: PICDEM FSUSB
Compiler: Microchip C18
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
2.3 09/15/2008 Broke out each hardware platform into its own
"HardwareProfile - xxx.h" file
********************************************************************/
 
#ifndef HARDWARE_PROFILE_PICDEM_FSUSB_H
#define HARDWARE_PROFILE_PICDEM_FSUSB_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
 
/*******************************************************************/
/******** MDD File System selection options ************************/
/*******************************************************************/
#define USE_PIC18
 
#define ERASE_BLOCK_SIZE 64
#define WRITE_BLOCK_SIZE 32
 
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/******** 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 48000000
 
/** LED ************************************************************/
#define mInitAllLEDs() LATD &= 0xF0; TRISD &= 0xF0;
#define mLED_1 LATDbits.LATD0
#define mLED_2 LATDbits.LATD1
#define mLED_3 LATDbits.LATD2
#define mLED_4 LATDbits.LATD3
#define mGetLED_1() mLED_1
#define mGetLED_2() mLED_2
#define mGetLED_3() mLED_3
#define mGetLED_4() mLED_4
 
#define mLED_1_On() mLED_1 = 1;
#define mLED_2_On() mLED_2 = 1;
#define mLED_3_On() mLED_3 = 1;
#define mLED_4_On() mLED_4 = 1;
#define mLED_1_Off() mLED_1 = 0;
#define mLED_2_Off() mLED_2 = 0;
#define mLED_3_Off() mLED_3 = 0;
#define mLED_4_Off() mLED_4 = 0;
#define mLED_1_Toggle() mLED_1 = !mLED_1;
#define mLED_2_Toggle() mLED_2 = !mLED_2;
#define mLED_3_Toggle() mLED_3 = !mLED_3;
#define mLED_4_Toggle() mLED_4 = !mLED_4;
/** SWITCH *********************************************************/
#define mInitAllSwitches() TRISBbits.TRISB4=1;TRISBbits.TRISB5=1;
#define mInitSwitch2() TRISBbits.TRISB4=1;
#define mInitSwitch3() TRISBbits.TRISB5=1;
#define sw2 PORTBbits.RB4
#define sw3 PORTBbits.RB5
/** POT ************************************************************/
#define mInitPOT() {TRISAbits.TRISA0=1;ADCON0=0x01;ADCON2=0x3C;ADCON2bits.ADFM = 1;}
/** SPI : Chip Select Lines ****************************************/
#define tris_cs_temp_sensor TRISBbits.TRISB2 // Output
#define cs_temp_sensor LATBbits.LATB2
/** 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
/** TRIS ***********************************************************/
#define INPUT_PIN 1
#define OUTPUT_PIN 0
 
#if defined(YAS)
#define RXTX LATBbits.LATB5
#else
#define RXTX LATAbits.LATA2
#endif
 
#define BPF_S0 LATAbits.LATA0
#define BPF_S1 LATAbits.LATA1
 
#if defined(YAS)
#define BPF_S2 LATAbits.LATA2
#endif
 
#define BPF_S0_STATE PORTAbits.RA0
#define BPF_S1_STATE PORTAbits.RA1
 
#if defined(YAS)
#define BPF_S2_STATE PORTAbits.RA2
#endif
 
#define PADDLE_DIT PORTBbits.RB6
#define PADDLE_DAH PORTBbits.RB7
 
#define LPF_0 LATAbits.LATA3
#define LPF_1 LATAbits.LATA4
#define LPF_2 LATAbits.LATA5
 
#if defined(YAS)
#else
#define LPF_3 LATBbits.LATB2
#define LPF_4 LATBbits.LATB3
#define LPF_5 LATBbits.LATB4
#define LPF_6 LATBbits.LATB5
#endif
 
/** S W I T C H *****************************************************/
#define mInitSwitch() TRISCbits.TRISC2 = 1;
#define UserSW PORTCbits.RC2
 
#define mLED_Both_Off() {mLED_1_Off(); mLED_2_Off();}
#define mLED_Both_On() {mLED_1_On(); mLED_2_On();}
#define mLED_Only_1_On() {mLED_1_On(); mLED_2_Off();}
#define mLED_Only_2_On() {mLED_1_Off(); mLED_2_On();}
 
 
#endif //HARDWARE_PROFILE_PICDEM_FSUSB_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/HardwareProfile.h
0,0 → 1,103
/********************************************************************
FileName: HardwareProfile.h
Dependencies: See INCLUDES section
Processor: PIC18, PIC24, or PIC32 USB Microcontrollers
Hardware: The code is natively intended to be used on the
following hardware platforms:
PICDEM™ FS USB Demo Board
PIC18F46J50 FS USB Plug-In Module
PIC18F87J50 FS USB Plug-In Module
Explorer 16 + PIC24 or PIC32 USB PIMs
PIC24F Starter Kit
Low Pin Count USB Development Kit
The firmware may be modified for use on other USB
platforms by editing this file (HardwareProfile.h)
Compiler: Microchip C18 (for PIC18), C30 (for PIC24),
or C32 (for PIC32)
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
2.3 09/15/2008 Broke out each hardware platform into its own
"HardwareProfile - xxx.h" file
********************************************************************/
 
#ifndef HARDWARE_PROFILE_H
#define HARDWARE_PROFILE_H
 
//#define DEMO_BOARD USER_DEFINED_BOARD
 
 
#if !defined(DEMO_BOARD)
#if defined(__C32__)
#if defined(__32MX460F512L__)
#if defined(PIC32MX460F512L_PIM)
#include "HardwareProfile - PIC32MX460F512L PIM.h"
#elif defined(PIC32_USB_STARTER_KIT)
#include "HardwareProfile - PIC32 USB Starter Kit.h"
#else
#include "HardwareProfile - UBW32.h"
#endif
#elif defined(__32MX795F512L__)
#if defined(PIC32MX795F512L_PIM)
#include "HardwareProfile - PIC32MX795F512L PIM.h"
#elif defined(PIC32_USB_STARTER_KIT)
//PIC32 USB Starter Kit II
#include "HardwareProfile - PIC32 USB Starter Kit.h"
#endif
#endif
#endif
#if defined(__C30__)
#if defined(__PIC24FJ256GB110__)
#include "HardwareProfile - PIC24FJ256GB110 PIM.h"
#elif defined(__PIC24FJ256GB106__)
#include "HardwareProfile - PIC24F Starter Kit.h"
#endif
#endif
 
#if defined(__18CXX)
#if defined(__18F4550)
#include "HardwareProfile - UBW.h"
#elif defined(__18F87J50)
#include "HardwareProfile - PIC18F87J50 PIM.h"
#elif defined(__18F14K50)
#include "HardwareProfile - Low Pin Count USB Development Kit.h"
#elif defined(__18F46J50)
#include "HardwareProfile - PIC18F46J50 PIM.h"
#elif defined(__18F2550)
#include "HardwareProfile - UBW.h"
#endif
#endif
#endif
 
#if !defined(DEMO_BOARD)
#error "Demo board not defined. Either define DEMO_BOARD for a custom board or select the correct processor for the demo board."
#endif
 
#endif //HARDWARE_PROFILE_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/README.txt
0,0 → 1,268
NEWS
====
 
11.11.2010
 
Firmware was edited to work without bootloader falashing tool.
So simply program PIC18F4550.hex in to PIC18F4550v01A module with 20MHz crystal.
Connect it via I2C to CLKGEN01A. And you have wide tunable LO compatible with DG8SAQ USB Si570 synthesiser!
 
 
14 Apr 2009
 
The UBW has 1 power indicator LED, and 2 blinking LED's usually used to indicate the
status of USB connections with the PC.
 
Charles (and maybe some of you) finds the blinking LED's to be too bright and
distracting.
 
So I have implemented a toggle switch (the PRG button) function for you to turn
the blinking on or off.
 
Once turned on or off, the setting is stored in EEPROM, so it will continue to
behave this way when you power off and next power on the UBW.
 
The default setting is LED blinking ON. So when you (re)flash the firmware, the
default is active.
 
14 Mar 2009
 
I have just released the latest version of my UBW Emulator firmware. It now
has (almost) all the functionalities of Fred (PE0FKO)'s v15.10 firmware for
ATTINY45 and ATTINY85. All the functions are accessible with Winrad with Fred's
ExtIO_Si570_v0.8.dll, including the wonderful option of setting of the
filter crossover points from the software. The crossover points are stored
in the UBW EEPROM so it will persist until changed again. Another new feature
is the setting of floating point offset and multiplier in the firmware. This
complements the setting of offset and (usually) integer multiplier in the PC
SDR software.
 
Winrad/ExtIO can be used to calibrate the UBW/Si570 (2 methods are available -
calibrating the default freq, or against a known station freq, eg. WWV).
Once calibrated, there is no need to calibrate other software - both set
freq by value and set freq by register will give the correct calibrated
freq now. In PowerSDR, leave the fxtal freq at the default 114.285 Mhz.
 
The new UBW Emulator works perfectly with Rocky v3.6, PowerSDR-sr40,
and PowerSDR-IQ. (set the Fxtal freq in the setup tab to the default 114.285 Mhz).
 
With Fred's v15.10 firmware in the ATTINY, users can use the ATTINY based USB
interfaces to do auto band switching of the mobo for Rx. To be able to do both Rx
and Tx BPF switching, Rx/Tx switching (PTT), and external LPF switching, from a
single USB connection, there are only 3 uC solutions that I know of:
 
1. The UBW (or UBW32) with this UBW firmware
2. Dave Brainerd's HSUSB, with firmware by Christos
3. Arduino board (or clone), with PE0FKO firmware modified by Loftur TF3LJ.
See Message #31623
 
 
UBW EMULATOR
============
This is the UBW emulator firmware for emulating the AVR based
DG8SAQ USB Si570 synthesiser, and Tony's USB-i2C Interface.
It emulates most of the functions of the orginal DG8SAQ firmware.
In addition, it emulates the new functions of the PE0FKO firmware (v15.10)
by Fred, with smooth tune, calibration, setting of Auto BPF crossover
points, setting of startup freq etc. After calibration of the UBW,
both set freq by value (used by Rocky) and set freq by register (used by
PowerSDR-sr40, with the fxtal freq set to the default 114.285 Mhz) will
give the correct calibrated freq output from the Si570. No further
calibration with the PC software is required.
 
I would like to thank Joe Hopster who wrote the original UBW Si570
code, Tom DG8SAQ for the AVR synthesiser code, Mike Collins who has
been invaluable in helping with the debugging and testing, John Fisher
for the code example on Si570 slide, Edson for advice on BPF selection coding,
bug fixing and testing, Fred for help to emulate his v15.7 firmware,
and others who have contributed so much to Softrock and Si570.
 
The emulator firmware HEX file is loaded in the UBW (either PIC
18F2455, 18F2550 or 18F2553 version) by the Microchip USB bootloader.
See UBW website for more details about the bootloader.
 
Before starting the firmware (via the reset button, or on power up by
plugging in the USB), the UBW should be connected via i2c interface to
an Si570. Power up the Si570 before the UBW.
 
There are several ways for connecting the UBW with the Si570.
 
(1) Connection is with 4 wires, +5V, Gnd, SCL, SDA, to an i2c
level converter, and then to Si570 with 4 wires, +3V3, Gnd, SCL, and
SDA. If you use the WB6DHW Si570 board, it has the level converter built-in. So
You can just connect the 4 wires to the header pins on the WB6DHW board. Note
that the order of the 4 wires on the UBW is: GND, VCC, RB0, RB1. The order
of the 4 header pins on WB6DHW board is: +5V, GND, SDA, SCL.
 
(2) If you are not using an IC such as GTL2002 for +5V to +3V3 conversion, you
can use discretes with the Philips (see AN97055 from Philips)
i2c level converter circuit using 2 BS170's.
 
(3) The UBW Emulator firmware sets up the SCL and SDA pins as open collector outputs.
So you can just connect 3 wires from the UBW to the +3v3 Si570 on the Softrock:
GND, SCL and SDA. The SCL and SDA lines will have pullup resistors to +3V3 on the
Softrock pcb. This has been tested to work. HOwever, there is the risk that
if the UBW firmware malfunctions for some reason (eg loading the wrong firmware instead
of the Emulator firmware), the RB0 and RB1 (SDA and SCL) pins may go to output high of
+5V, which may damage the Si570 or other +3V3 chips.
 
 
The PC will detect the new USB device as a DG8SAQ-I2C device and as
far as the PC is concerned, the UBW behaves almost exactly like the
USB Si570 synthesiser (which is based on the AVR uController). When
prompted by the PC to install the driver for this device, you install
the AVR USB driver (from the USB Si570 synthesiser software download).
You will also need the libusb0.dll and libusb0.sys files installed
for the PC software to work (available also from the USB Si570 synthesiser
software package).
 
The following PC software programs have been tested with the UBW emulation so far:
 
1. SI570_USB_Test.exe from the USB Si570 synthesiser software package
2. USB_Synth.exe from the USB Si570 synthesiser software package
2. Rocky v3.6
3. Guido's PowerSDR v1.9.0 sr40
4. WinRad with Fred's ExtIO_Si570_v0.8.dll
5. Christos's PowerSDR-IQ v1.12.20
 
SI570_USB_Test.exe can be used test the USB communication and UBW
functions,and for calibrating the UBW-Si570 ie.
 
(1) Click "Read Si570 Register" - the default Si570 startup frequency
and register values will be displayed
 
(2) If you know the actual startup frequency of your Si570 (which is
close to but generally not equal to the nominal startup freq of 56.32
Mhz), you can do the calibration now by inputting the actual freq in the
text box to the left of the "cal on startup freq", and then hit "cal
on startup freq". The UBW-Si570 is now calibrated for "set freq by
value". The calibration is stored in the EEPROM of the UBW and you do
not need to re-calibrate again unless you reload the UBW firmware from
the .hex file.
 
(3) Now you can input any freq desired in the text box and hit either
"set freq by value" or "set freq by register". The si570 should now
output the freq set by you. It should be accurate as set, and can be
confirmed with an external freq counter.
 
 
Many of the functions of the SI570_USB_Test.exe have been implemented,
including Paddle input, RXTX level, etc.
 
Both the "old" and "new" (with new icon) versions of USB_Synth.exe work in setting
the Si570 freq. The old version uses set freq by value, and the new version
(with enhancements) uses set freq by register.
 
If the SI570_USB_Test run is OK, you can fire up Rocky v3.6 to use the
Si570-USB functionality. Rocky uses the "set freq by value" method. You can use
the Rocky calibration function with the UBW, but it should not be necessary and should
be avoided. Use the calibration method in WinRad (see below under Calibration) or
the SI570_USB_Test.exe method (see above).
 
PowerSDR works by "set Freq by Register" method. You can change freq by the band buttons
or sliding the freq up and down with the mouse. Leave the Fxtal
freq in PowerSDR "Setup" to the default 114.285 Mhz. There is no need for
further calibration.
 
To use Winrad, you have to download the ExtIO_Si570.dll by Fred PE0FKO. Put the v0.8
dll in the same directory as Winrad (usually installed in "c:\Program Files\Winrad" directory).
 
 
Calibration
===========
You can use Winrad (with ExtIO_Si570_v0.8.dll by Fred) to do the calibration. This is the
easier (and preferred method). There are two calibration methods in ExtIO_Si570.dll. One is
calibrating to the factory default freq of the Si570 (a value close to 56.32 Mhz). The
other method is to tune Winrad to a known frequency station, eg. the WWV stations broadcasting
at 2.5 Mhz, 5.0 Mhz, 10.0 Mhz, 15.0 Mhz etc., and then put in the actual frequencies. For
example, you may find a good signal of WWV at 10.023 Mhz. So the "tuned" freq is 10.023 Mhz,
but the "real" freq is 10.000 Mhz. So you enter this real freq in the box and the hit "calibrate"
botton.
 
Si570 calibration can also be done with SI570_USB_Test.exe software,
to calibrate the startup freq accurately once after loading (or reloading)
of the firmware .hex file. The calibration data are then stored in the UBW EEPROM.
 
 
If UBW is not connected to the Si570
====================================
I have eliminated the readstartupconfiguration() step. So now the UBW will NOT hang
when it is not connected to the i2c bus on startup. On connection to USB it will be
recognized by the PC.
 
Of course, if you try to communicate with the Si570 it will hang and disconnect from
the USB if you don't have the Si570 connected at this time.
 
Restoring EEPROM to factory default condition
=============================================
 
After the UBW EEPROM is corrupted (eg. by mis-calibration), you can restore the factory default
by reloading the .hex file. (Thanks to Mike for the suggestion.). Alternatively, you can use
SI570_USB_Test.exe to sent 41 (hex) in the "request" box, and ff (hex) in the "Value" box,
then click "USB ctrl msg Data to Host". This then clears the EEPROM in the UBW to the default
condition and when you reset the UBW (hit the reset botton on the uBW, or by powering off
and then on again).
 
Using Winrad, there is a "reset" botton at the "calibrate" tab which will do the same thing.
 
 
Download
========
 
The UBW emulation firmware and the source files can be found in
Files->9V1AL->UBW emulation.
 
 
 
IO Port Pin assignment
======================
 
 
Pin assignments for the UBW are as follows:
 
Pin Name Input/Output Active Remarks
 
RA0 BPF_SO O H BPF select S0
RA1 BPF_S1 O H BPF select S1
S1,S0 selects 1 of 4 BPF's for Softrock
RA2 RXTX O H PTT, H = Transmit
 
RB0 SDA Open Collector For i2c connection to Si570
RB1 SCL Open Collector may need conversion to +3v3
in case of firmware failure
(eg wrong firmware loaded)
then RB0 and RB1 may be set
to logic high output of +5V
 
RB6 PADDLE_DIT I L Paddle DIT Input, active low
RB7 PADDLE_DAH I L Paddle DAH Input, active low
As internal pullup is enabled,
there is no need to add external
pullup resistors. Just ground the pin
to activate.
 
RA3-5, RB2-5 LPF_x O H LPF select pins
This has to be customised for
the LPF bank you use.
Email me (lee188@singnet.com.sg)
and I will sent you a customised hex file
 
 
Connections to SR v6.3 and Mobo v3.6
=====================================
 
 
UBW SRv6.3 Mobo v3.6 External Paddle
 
RA0 - P7 Pin 1 -
RA1 - P7 Pin 2 -
RA2 PTT_I K6 Pin 1 -
RB0 SDA - -
RB1 SCL - -
GND GND P10 Pin 2 Paddle Common
RB6 - - Paddle dot (dit)
RB7 - - Paddle dash (dah)
- +5V P10 Pin 1 -
 
 
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/USB Device - MCHPUSB - Generic Driver - C18 - PIC18F4550.hex
0,0 → 1,1389
:020000040000FA
:06000000FBEF2DF01200E1
:0600080004EF04F01200F9
:060018000CEF04F01200E1
:06080000FBEF2DF01200D9
:060808000CEF2CF01200C1
:0608180015EF2CF01200A8
:06082A000100425C000029
:08083000E901000005000000D1
:08083800D9CFE6FFE1CFD9FFA3
:10084000080EE126FD0EDBCF00F0FE0EDBCF01F03F
:10085000050ED89001320032E804FBE100C02CF014
:1008600001C02DF014EC29F02BC0DEFF2CC0DEFF00
:100870002DC0DEFF2EC0DDFFDD52DD521F0EE76E04
:10088000FD0EDBCF04F0FE0EDBCF05F0E7500416C3
:10089000056A04C02CF005C02DF014EC29F02BC023
:1008A00000F02CC001F02DC002F02EC003F0306A21
:1008B000316A326A420E336E00C02BF001C02CF058
:1008C00002C02DF003C02EF0DBEC29F0040E2BC08B
:1008D000DBFF050E2CC0DBFF060E2DC0DBFF070E75
:1008E0002EC0DBFFD9CFE9FFDACFEAFFEECF04F06D
:1008F000EECF05F0EECF06F0EFCF07F0040EDBCF22
:1009000008F0050EDBCF09F0060EDBCF0AF0070E6C
:10091000DBCF0BF008C030F009C031F00AC032F074
:100920000BC033F004C02BF005C02CF006C02DF036
:1009300007C02EF045EC29F02BC000F02CC001F0D0
:100940002DC002F02EC003F000C02AF001C02BF031
:1009500002C02CF003C02DF0080EE15C03E200D0D1
:10096000E16AE552E16EE552E7CFD9FF1200D9CF37
:10097000E6FFE1CFD9FF040EE126FB0EDBCF2BF023
:10098000FC0EDBCF2CF0FD0EDBCF2DF0FE0EDBCF0F
:100990002EF0B9EC2AF0020E2CC0DBFF030E2DC0A6
:1009A000DBFF020EDBCF2CF0030EDBCF2DF014ECBF
:1009B00029F02BC000F02CC001F02DC002F02EC099
:1009C00003F0306A316A326A420E336E00C02BF097
:1009D00001C02CF002C02DF003C02EF02EEC2AF046
:1009E000B9EC2AF02CC0DEFF2DC0DDFFFB0EDBCF03
:1009F00006F0FC0EDBCF07F0FD0EDBCF08F0FE0E9D
:100A0000DBCF09F0020EDBCF2CF0030EDBCF2DF095
:100A100014EC29F02BC00AF02CC00BF02DC00CF008
:100A20002EC00DF00AC030F00BC031F00CC032F017
:100A30000DC033F006C02BF007C02CF008C02DF01D
:100A400009C02EF044EC29F02BC002F02CC003F0BA
:100A50002DC004F02EC005F0306A316A326A420EB1
:100A6000336E02C02BF003C02CF004C02DF005C083
:100A70002EF02EEC2AF0B9EC2AF02CC000F02DC09C
:100A800001F0D9CFE9FFDACFEAFF0050EE2601509E
:100A9000ED22DECF00F0DDCF01F000C0F3FF01C09A
:100AA000F4FF040EE15C03E200D0E16AE552E16E7E
:100AB000E552E7CFD9FF1200D9CFE6FFE1CFD9FF4A
:100AC000060EE126896A926A0F0EC16EC290070E69
:100AD000B46E8A6AC30E936EF19E8B6A9468FC0EA4
:100AE0008B16941694848250040B01E0010E0101D0
:100AF000006F550E016F000EE66EE66A85EC2DF074
:100B0000E552E552550809E00101A56BF60EA66F06
:100B1000480EA76F720EA86F37D0020EDB6A030E65
:100B2000DB6A020EDBCF00F0030EDBCF01F0040E18
:100B3000005C000E015828E2010EE76E020EDBCFCA
:100B400000F0030EDBCF01F0E7500026000E01227B
:100B500000C0E6FF01C0E6FF85EC2DF0E552E5524E
:100B6000E66E020EDBCFE9FF030EDBCFEAFFA50E38
:100B7000E926010EEA22E552E750EF6E020EDB2A6B
:100B8000030E01E3DB2ACDD7A5C12AF0A6C12BF0C5
:100B9000A7C12CF0A8C12DF029EC29F02BC000F042
:100BA0002CC001F02DC002F02EC003F0306A316A73
:100BB000800E326E4B0E336E00C02BF001C02CF055
:100BC00002C02DF003C02EF0DBEC29F02BC0C6F1E3
:100BD0002CC0C7F12DC0C8F12EC0C9F10101010E12
:100BE000DE6FA06B9E6B9F6BCA6BCB6BCC6BCD6BC0
:100BF000050EE66EE66A85EC2DF0E552E5525508E5
:100C00000AE00101700EA16F3D0EA26F0A0EA36FE4
:100C1000070EA46F3BD0020EDB6A030EDB6A020EE6
:100C2000DBCF00F0030EDBCF01F0040E005C000E02
:100C300001582CE2050EE76E020EDBCF00F0030E2A
:100C4000DBCF01F0E7500026000E0122010E002646
:100C5000000E012200C0E6FF01C0E6FF85EC2DF08A
:100C6000E552E552E66E020EDBCFE9FF030EDBCF65
:100C7000EAFFA10EE926010EEA22E552E750EF6EE7
:100C8000020EDB2A030E01E3DB2AC9D70A0EE66E49
:100C9000E66A85EC2DF0E552E55255080AE00101BF
:100CA000420ECE6F600ECF6F650ED06F3B0ED16FD0
:100CB00066D0020EDB6A030EDB6A020EDBCF00F0A9
:100CC000030EDBCF01F0020E005C000E01582EE295
:100CD0000A0EE76E020EDBCF02F0030EDBCF03F04D
:100CE000E7500226000E0322010E0226000E032208
:100CF00002C0E6FF03C0E6FF85EC2DF0E552E552A9
:100D0000E66ED9CF00F0DACF01F0020EDB500024FE
:100D1000E96E030EDB500120EA6EE552E750EF6EFC
:100D2000020EDB2A030E01E3DB2AC7D7000EDFCF5A
:100D30002CF0010EDBCF2DF014EC29F02BC000F0CD
:100D40002CC001F02DC002F02EC003F0306A240E3A
:100D5000316E740E326E490E336E00C02BF001C03E
:100D60002CF002C02DF003C02EF0DBEC29F02BC0DC
:100D7000CEF12CC0CFF12DC0D0F12EC0D1F10D0E8F
:100D8000E66EE66A85EC2DF0E552E55255080BE07B
:100D90000101DA6BDB6BDC6BDD6BD66BD76B200E86
:100DA000D86FD96B76D0020EDB6A030EDB6A020EB7
:100DB000DBCF00F0030EDBCF01F0040E005C000E71
:100DC00001582CE20D0EE76E020EDBCF00F0030E91
:100DD000DBCF01F0E7500026000E0122010E0026B5
:100DE000000E012200C0E6FF01C0E6FF85EC2DF0F9
:100DF000E552E552E66E020EDBCFE9FF030EDBCFD4
:100E0000EAFFDA0EE926010EEA22E552E750EF6E1C
:100E1000020EDB2A030E01E3DB2AC9D7020EDB6ACE
:100E2000030EDB6A020EDBCF00F0030EDBCF01F016
:100E3000040E005C000E01582CE20D0EE76E020E4F
:100E4000DBCF00F0030EDBCF01F0E7500026000EF1
:100E50000122050E0026000E012200C0E6FF01C09F
:100E6000E6FF85EC2DF0E552E552E66E020EDBCF93
:100E7000E9FF030EDBCFEAFFD60EE926010EEA22D8
:100E8000E552E750EF6E020EDB2A030E01E3DB2A88
:100E9000C9D7160EE66EE66A85EC2DF0E552E552EE
:100EA000550801E1DDD000019A0E706F990E716F47
:100EB000190E726F410E736F746B756B080E766F3F
:100EC000420E776F786B796B980E7A6F420E7B6F5C
:100ED000020EDB6A030EDB6A020EDBCF00F0030EAC
:100EE000DBCF01F0005C000E01583BE2020EDBCFCD
:100EF000E9FF030EDBCFEAFF020ED890E936EA36AF
:100F0000E806FBE1700EE926000EEA22EECFE6FFCE
:100F1000EECFE6FFEECFE6FFEFCFE6FF28DDE552AE
:100F2000E552E552E552F3CF00F0F4CF01F0020EA6
:100F3000DBCFE9FF030EDBCFEAFF010ED890E936E5
:100F4000EA36E806FBE1600EE926000EEA2200C060
:100F5000EEFF01C0EDFF020EDB2A030E01E3DB2AE8
:100F6000BBD7010E0001666F676B01010D6F0001B9
:100F70009C6B9D6B9E6B410E9F6FA06BA16B800E57
:100F8000A26F410EA36FA46BA56B100EA66F420E4D
:100F9000A76FA86BA96B300EAA6F420EAB6FAC6B3C
:100FA000AD6B680EAE6F420EAF6FB06BB16BA00E43
:100FB000B26F420EB36FB46BB56BF00EB66F420EEC
:100FC000B76F020EDB6A030EDB6A020EDBCF00F0A6
:100FD000030EDBCF01F0070E005C000E01583BE270
:100FE000020EDBCFE9FF030EDBCFEAFF020ED89043
:100FF000E936EA36E806FBE19C0EE926000EEA2215
:10100000EECFE6FFEECFE6FFEECFE6FFEFCFE6FF57
:10101000AEDCE552E552E552E552F3CF00F0F4CFF5
:1010200001F0020EDBCFE9FF030EDBCFEAFF010E7A
:10103000D890E936EA36E806FBE18C0EE926000E88
:10104000EA2200C0EEFF01C0EDFF020EDB2A030E14
:1010500001E3DB2ABAD7010E00019A6F9B6BDED049
:10106000020EDB6A030EDB6A020EDBCF00F0030E1A
:10107000DBCF01F0040E005C000E01585FE2020EAF
:101080002C6E2D6ADBCF31F0030EDBCF32F09BEC00
:101090002AF02AC000F02BC001F0160E0026000E28
:1010A0000122010E0026000E012200C0E6FF01C051
:1010B000E6FF85EC2DF0E552E552DF6E020E2C6E58
:1010C0002D6ADBCF31F0030EDBCF32F09BEC2AF040
:1010D0002AC000F02BC001F0010E0026000E0122F4
:1010E000160E0026000E0122010E0026000E01221F
:1010F00000C0E6FF01C0E6FF85EC2DF0E552E552A9
:10110000E76E010EE7CFDBFF020EDBCFE9FF030E38
:10111000DBCFEAFF010ED890E936EA36E806FBE1BC
:10112000600EE926000EEA22DECFEEFFDDCFEDFFF6
:10113000020EDB2A030E01E3DB2A96D766C00DF10F
:10114000020EDB6A030EDB6A020EDBCF00F0030E39
:10115000DBCF01F0080E005C000E01585FE2020ECA
:101160002C6E2D6ADBCF31F0030EDBCF32F09BEC1F
:101170002AF02AC000F02BC001F0160E0026000E47
:101180000122110E0026000E012200C0E6FF01C060
:10119000E6FF85EC2DF0E552E552DF6E020E2C6E77
:1011A0002D6ADBCF31F0030EDBCF32F09BEC2AF05F
:1011B0002AC000F02BC001F0010E0026000E012213
:1011C000160E0026000E0122110E0026000E01222E
:1011D00000C0E6FF01C0E6FF85EC2DF0E552E552C8
:1011E000E76E010EE7CFDBFF020EDBCFE9FF030E58
:1011F000DBCFEAFF010ED890E936EA36E806FBE1DC
:101200008C0EE926000EEA22DECFEEFFDDCFEDFFE9
:10121000020EDB2A030E01E3DB2A96D7020EDB6AFD
:10122000030EDB6A020EDBCF00F0030EDBCF01F012
:10123000005C000E01583EE2020EDBCFE9FF030E18
:10124000DBCFEAFF010ED890E936EA36E806FBE18B
:10125000600EE926000EEA22EECFE6FFEFCFE6FFB2
:101260001CEC04F0E552E5522AC000F02BC001F05E
:101270002CC002F02DC003F0020EDBCFE9FF030EFD
:10128000DBCFEAFF020ED890E936EA36E806FBE14A
:10129000700EE926000EEA2200C0EEFF01C0EEFF4C
:1012A00002C0EEFF03C0EEFF020EDB2A030E01E3D5
:1012B000DB2AB8D7020EDB6A030EDB6A020EDBCF35
:1012C00000F0030EDBCF01F0070E005C000E0158AA
:1012D0003EE2020EDBCFE9FF030EDBCFEAFF010E99
:1012E000D890E936EA36E806FBE18C0EE926000ED6
:1012F000EA22EECFE6FFEFCFE6FF1CEC04F0E5526A
:10130000E5522AC000F02BC001F02CC002F02DC025
:1013100003F0020EDBCFE9FF030EDBCFEAFF020E84
:10132000D890E936EA36E806FBE19C0EE926000E85
:10133000EA2200C0EEFF01C0EEFF02C0EEFF03C0D4
:10134000EEFF020EDB2A030E01E3DB2AB7D7370ECE
:10135000E66EE66A85EC2DF0E552E5520101EB6F91
:10136000E66A080EE66EA0EC2DF0E552E552300E6E
:10137000C86E12D9050EE66EE66A85EC2DF0E552D0
:10138000E552550837E1A1C12AF0A2C12BF0A3C153
:101390002CF0A4C12DF029EC29F02BC000F02CC0BA
:1013A00001F02DC002F02EC003F0306A316A326ABB
:1013B0004A0E336E00C02BF001C02CF002C02DF09D
:1013C00003C02EF0DBEC29F02BC0D2F12CC0D3F1FE
:1013D0002DC0D4F12EC0D5F1D2C1E6FFD3C1E6FFB6
:1013E000D4C1E6FFD5C1E6FF81EC13F0E552E5522A
:1013F000E552E552060EE15C02E2E16AE552E16E79
:10140000E552E7CFD9FF1200B4D8000911E001017D
:10141000EB5102E0000E01D0010EEB6FEBC1E6FFD5
:10142000370EE66EE66A60EC2DF0E552E552E552C5
:101430000101EB5102E055D802D08B908B92100E37
:101440000001E76EB819E8AE02D0E73402D0E750E9
:10145000B85D03E36D50020B01E001D001D812002A
:10146000D9CFE6FFE1CFD9FFE6520101A051000834
:1014700033E29F51090DF3CFE9FFF4CFEAFF0E0EDF
:10148000E926010EEA22EFCFDFFFDF50350A1AE02E
:10149000010A15E0070A10E0010A0BE0030A06E062
:1014A000010A01E012D0A7EC14F00FD03CEC16F0CA
:1014B0000CD02BEC14F009D010EC15F006D0D0ECC9
:1014C00015F003D07EEC1AF000D001019F2B100E16
:1014D0009F5D01E39F6BA007E552E552E7CFD9FF7F
:1014E00012000101EC51ED1104E1100EEC6F270E1A
:1014F000ED6FEC07000EED5B6DA20BD0EC51ED1122
:1015000007E18B708B50010B02E08B8201D08B9234
:101510002FD00001B85103E18B908B9229D0B805F0
:1015200003E18B808B8224D0020EB85D03E18B80B7
:101530008B921ED0040EB85D03E18B908B8218D085
:10154000100EB85D07E10101EC51ED1102E18B7065
:101550008B920ED0200EB85D0BE10101EC51ED1124
:1015600007E18B708B50010B02E08B9201D08B82D4
:1015700012008250040B01E0010E0101005D09E040
:101580008250040B01E0010E006F82B402D0010E04
:1015900002D0000E00D01200C580C5B0FED716ECF8
:1015A0002EF001010151E824E66E27EC2DF0E55202
:1015B000870EE66E27EC2DF0E552010EE66E27EC65
:1015C0002DF0E552C584C5B4FED716EF2EF0D9CF65
:1015D000E6FFE1CFD9FF020EE126DE6ADD6ADECF4B
:1015E00000F0DDCF01F0060E005C000E01583BE27A
:1015F000C580C5B0FED716EC2EF001010151E824DC
:10160000E66E27EC2DF0E552DECF00F0DDCF01F0E5
:10161000070E0024E66E27EC2DF0E552C582C5B218
:10162000FED716EC2EF001010151E8240109E66E07
:1016300027EC2DF0E55209EC2EF0E66EDECFE9FF47
:10164000DDCFEAFFAB0EE926010EEA22E552E750B4
:10165000EF6EC584C5B4FED716EC2EF0DF2A010E5E
:1016600001E3DB2ABCD7020EE15C02E2E16AE5524B
:10167000E16EE552E7CFD9FF1200890EE66EE66A09
:101680003DD8E552E55209EC2EF00101A96FAA6B95
:10169000100EA911A96F5EEF0BF0890EE66EE66AD7
:1016A0002DD8E552E55209EC2EF00101A96FAA6B85
:1016B000EF0EA915A96FAA6B5EEF0BF0C584C5B438
:1016C000FED716EC2EF0C580C5B0FED716EC2EF076
:1016D00001010151E824E66E27EC2DF0E552890E58
:1016E000E66E27EC2DF0E552A9C1E6FF27EC2DF0C0
:1016F000E552C584C5B4FED716EF2EF0D9CFE6FF6C
:10170000E1CFD9FFC580C5B0FED716EC2EF00101A0
:101710000151E824E66E27EC2DF0E552FD0EDBCFFB
:10172000E6FF27EC2DF0E552C582C5B2FED716ECD8
:101730002EF001010151E8240109E66E27EC2DF09D
:10174000E552E552E7CFD9FF1200870EE66EE66A52
:10175000D5DFE552E55209EC2EF00101E96FEA6BA5
:10176000E98DC584C5B4FED716EC2EF0C580C5B092
:10177000FED716EC2EF001010151E824E66E27ECAD
:101780002DF0E552870EE66E27EC2DF0E552E9C10B
:10179000E6FF27EC2DF0E552C584C5B4FED716EF61
:1017A0002EF0D9CFE6FFE1CFD9FF1F0EE1260C0EB8
:1017B000DB6A300EF36E0D0EF3CFDBFFB10EF36E6E
:1017C0000E0EF3CFDBFF450EF36E0F0EF3CFDBFFF4
:1017D000100EDB6A900EF36E110EF3CFDBFF970E47
:1017E000F36E120EF3CFDBFF450EF36E130EF3CF45
:1017F000DBFF190EDB6A1A0EDB6A1B0EDB6A1C0E9E
:10180000DB6A100EDBCF2BF0110EDBCF2CF0120EAB
:10181000DBCF2DF0130EDBCF2EF0FB0EDBCF30F045
:10182000FC0EDBCF31F0FD0EDBCF32F0FE0EDBCF56
:1018300033F0DBEC29F02BC000F02CC001F02DC000
:1018400002F02EC003F000C02BF001C02CF002C04B
:101850002DF003C02EF0B9EC2AF01D0E2CC0DBFFDA
:101860001E0E2DC0DBFF800EF36E1B0EF3CFDBFFD1
:10187000050EF36E1C0EF3CFDBFF0B0EF36E140E92
:10188000F3CFDBFFDB50030801E397D0140EDB50EE
:10189000080804E0140EDB500A0801E18BD0140E96
:1018A000DB50026E036A1D0EDBCF2CF01E0EDBCF69
:1018B0002DF002C031F003C032F0D5EC2DF02CC079
:1018C00000F02DC001F0010E0026000E0122150EC1
:1018D00000C0DBFF160E01C0DBFFD950150FE96E0B
:1018E000DACFEAFF800ED880EE54000EED5401E20C
:1018F00061D0D950150FE96EDACFEAFF010EEE186C
:1019000001E1ED5018E0010EE76E150EDBCF00F09F
:10191000160EDBCF01F0E7500016016A010E001829
:1019200001E1015008E1D950150FE96EDACFEAFF65
:10193000EE2A000EED22140EDB50006E016A00C08C
:101940002CF001C02DF0150EDBCF31F0160EDBCFE1
:1019500032F09BEC2AF0170E2AC0DBFF180E2BC0CA
:10196000DBFF1B0EDBCF00F01C0EDBCF01F0170EF0
:10197000DBCF02F0180EDBCF03F00050025C015009
:10198000035818E2170EDBCF2CF0180EDBCF2DF02A
:101990001B0E2CC0DBFF1C0E2DC0DBFF150EDB5019
:1019A000E76E1A0EE7CFDBFF140EDB50E76E190E61
:1019B000E7CFDBFF140EDB0665D70101DE6B190EE6
:1019C000DB5001E198D1FB0EDBCF00F0FC0EDBCF4A
:1019D00001F0FD0EDBCF02F0FE0EDBCF03F01B0E9D
:1019E000DBCF2CF01C0EDBCF2DF014EC29F02BC03C
:1019F00004F02CC005F02DC006F02EC007F004C086
:101A000030F005C031F006C032F007C033F000C03E
:101A10002BF001C02CF002C02DF003C02EF02EECF4
:101A20002AF02BC0BEF12CC0BFF12DC0C0F12EC0DA
:101A3000C1F10C0EDBCF00F00D0EDBCF01F00E0E6E
:101A4000DBCF02F00F0EDBCF03F000C030F001C09F
:101A500031F002C032F003C033F0BEC12BF0BFC181
:101A60002CF0C0C12DF0C1C12EF01FEC2BF0010AEB
:101A700001E141D10101010EDE6FC6C130F0C7C1E5
:101A800031F0C8C132F0C9C133F0BEC12BF0BFC1C3
:101A90002CF0C0C12DF0C1C12EF0DBEC29F02BC021
:101AA000BEF12CC0BFF12DC0C0F12EC0C1F1BEC12E
:101AB0002BF0BFC12CF0C0C12DF0C1C12EF0E8EC5D
:101AC0002AF0040E2AC0DBFF050E2BC0DBFF060E3A
:101AD0002CC0DBFF070E2DC0DBFF040EDBCF04F0B4
:101AE000050EDBCF05F0060EDBCF06F0070EDBCFD1
:101AF00007F004C02AF005C02BF006C02CF007C088
:101B00002DF029EC29F02BC000F02CC001F02DC0E5
:101B100002F02EC003F000C030F001C031F002C06E
:101B200032F003C033F0BEC12BF0BFC12CF0C0C1F6
:101B30002DF0C1C12EF044EC29F02BC0DEFF2CC0EB
:101B4000DEFF2DC0DEFF2EC0DDFFDD52DD52D9CF1E
:101B5000E9FFDACFEAFFEECF00F0EECF01F0EECFF3
:101B600002F0EFCF03F0306A316A800E326E4D0E14
:101B7000336E00C02BF001C02CF002C02DF003C06A
:101B80002EF02EEC2AF0E8EC2AF0080E2AC0DBFF3B
:101B9000090E2BC0DBFF0A0E2CC0DBFF0B0E2DC085
:101BA000DBFF040E006E190EDBCFE7FF0050E75E8F
:101BB000190EE7CFDBFF1A0EDB06DB40E8403F0BD8
:101BC000006E190EDB50200DF35000100101B16FB3
:101BD0001A0EDB50030B400DF3CFB2F1040EDBCF36
:101BE00000F0050EDBCF01F0060EDBCF02F0070E92
:101BF000DBCF03F0040ED890033202320132003200
:101C0000E806F9E13F0E046E056A066A076A0450A9
:101C10000016055001160650021607500316005014
:101C20000101B2130F0E006E016A026A036AD950F5
:101C3000040FE96EDACFEAFFEE500016EE500116FF
:101C4000EE500216EE500316040E1F0B07E0D8905C
:101C50000036013602360336E806F9E1080EDBCF1E
:101C600004F0090EDBCF05F00A0EDBCF06F00B0EF9
:101C7000DBCF07F0180ED890073206320532043257
:101C8000E806F9E104500012055001120650021254
:101C90000750031200C0B3F1080EDBCF00F0090EAD
:101CA000DBCF01F00A0EDBCF02F00B0EDBCF03F02F
:101CB000100ED8900332023201320032E806F9E108
:101CC00000C0B4F1080EDBCF00F0090EDBCF01F04D
:101CD0000A0EDBCF02F00B0EDBCF03F0080ED8901C
:101CE0000332023201320032E806F9E100C0B5F1F8
:101CF000080EDBCFB6F11F0EE15C02E2E16AE552AD
:101D0000E16EE552E7CFD9FF1200D9CFE6FFE1CF70
:101D1000D9FF0A0EE1260101DE5101E148D1ADDC17
:101D2000070EDE6EDD6ADECF00F0DDCF01F001349C
:101D300004E200500C08000E01542CE3C580C5B02D
:101D4000FED716EC2EF001010151E824E66E27ECD7
:101D50002DF0E552DFCFE6FF27EC2DF0E552DECF88
:101D6000E9FFDDCFEAFF070EE95E000EEA5AB10E89
:101D7000E926010EEA22EF50E66E27EC2DF0E5523F
:101D8000C584C5B4FED716EC2EF0DF2A010E01E3A0
:101D9000DB2AC9D782DCC6C1E6FFC7C1E6FFC8C1DE
:101DA000E6FFC9C1E6FF0DD9E552E552E552E5521D
:101DB000020E2AC0DBFF030E2BC0DBFF040E2CC07B
:101DC000DBFF050E2DC0DBFF020EDBCF00F0030EA4
:101DD000DBCF01F0040EDBCF02F0050EDBCF03F00A
:101DE000CAC130F0CBC131F0CCC132F0CDC133F03B
:101DF00000C02BF001C02CF002C02DF003C02EF06B
:101E000028EC2BF0010A2BE0020EDBCF00F0030ED2
:101E1000DBCF01F0040EDBCF02F0050EDBCF03F0C9
:101E2000CAC130F0CBC131F0CCC132F0CDC133F0FA
:101E300000C02BF001C02CF002C02DF003C02EF02A
:101E400044EC29F0060E2BC0DBFF070E2CC0DBFF95
:101E5000080E2DC0DBFF090E2EC0DBFF2AD0020EBC
:101E6000DBCF00F0030EDBCF01F0040EDBCF02F07E
:101E7000050EDBCF03F000C030F001C031F002C02E
:101E800032F003C033F0CAC12BF0CBC12CF0CCC16F
:101E90002DF0CDC12EF044EC29F0060E2BC0DBFF57
:101EA000070E2CC0DBFF080E2DC0DBFF090E2EC075
:101EB000DBFFC2C130F0C3C131F0C4C132F0C5C1D3
:101EC00033F0BAC12BF0BBC12CF0BCC12DF0BDC1A9
:101ED0002EF0DBEC29F02BC000F02CC001F02DC05F
:101EE00002F02EC003F0CEC130F0CFC131F0D0C12E
:101EF00032F0D1C133F000C02BF001C02CF002C091
:101F00002DF003C02EF01FEC2BF0010A1DE0060E91
:101F1000DBCF04F0070EDBCF05F0080EDBCF06F0B9
:101F2000090EDBCF07F0306A316A326A3F0E336E3A
:101F300004C02BF005C02CF006C02DF007C02EF019
:101F40001FEC2BF0010A16E1A5EC0BF0BEC1C2F1AB
:101F5000BFC1C3F1C0C1C4F1C1C1C5F1020EDBCF25
:101F6000CAF1030EDBCFCBF1040EDBCFCCF1050EB3
:101F7000DBCFCDF101010D510DE0D2C1E6FFD3C1A0
:101F8000E6FFD4C1E6FFD5C1E6FF24DAE552E5520B
:101F9000E552E552D2C1E6FFD3C1E6FFD4C1E6FF68
:101FA000D5C1E6FF8ADAE552E552E552E5520A0E5E
:101FB000E15C02E2E16AE552E16EE552E7CFD9FF6A
:101FC0001200D9CFE6FFE1CFD9FF0E0EE126E00ED9
:101FD0000101B115E00BE838E840040FE76E050E8B
:101FE000E7CFDBFF060E016EC00EB21501C0E7FFA2
:101FF000E75204E0E8427F0BE706FCE1006E1F0EAB
:102000000101B115040DF3500024E76E040EE7CF73
:10201000DBFFDB2A3F0EB215006E016A026A036A1B
:10202000040E1F0B07E0D890003601360236033647
:10203000E806F9E1F00E0101B315046E056A066ABF
:10204000076A040ED8900732063205320432E806D9
:10205000F9E1045000120550011206500212075017
:102060000312060E00C0DBFF070E01C0DBFF080EE7
:1020700002C0DBFF090E03C0DBFF0F0E0101B31529
:10208000006E016A026A036A180E1F0B07E0D890FF
:102090000036013602360336E806F9E10A0E00C0C2
:1020A000DBFF0B0E01C0DBFF0C0E02C0DBFF0D0ED1
:1020B00003C0DBFFB4C100F0016A026A036A100EBC
:1020C0001F0B07E0D8900036013602360336E806CB
:1020D000F9E1D9500A0FE96EDACFEAFF0050EE2697
:1020E0000150EE220250EE220350EE22B5C100F064
:1020F000016A026A036A080E1F0B07E0D8900036D7
:10210000013602360336E806F9E1D9500A0FE96EC6
:10211000DACFEAFF0050EE260150EE220250EE2206
:102120000350EE22B6C100F0016A026A036AD95078
:102130000A0FE96EDACFEAFF0050EE260150EE22D8
:102140000250EE220350EE22060EDBCF04F0070E03
:10215000DBCF05F0080EDBCF06F0090EDBCF07F072
:1021600004C02AF005C02BF006C02CF007C02DF0EB
:1021700029EC29F02BC000F02CC001F02DC002F09A
:102180002EC003F00A0EDBCF10F00B0EDBCF11F0E8
:102190000C0EDBCF12F00D0EDBCF13F010C02AF0C7
:1021A00011C02BF012C02CF013C02DF029EC29F037
:1021B0002BC00CF02CC00DF02DC00EF02EC00FF077
:1021C000306A316A800E326E4D0E336E0CC02BF0C9
:1021D0000DC02CF00EC02DF00FC02EF0DBEC29F05E
:1021E0002BC008F02CC009F02DC00AF02EC00BF057
:1021F00008C030F009C031F00AC032F00BC033F033
:1022000000C02BF001C02CF002C02DF003C02EF056
:1022100045EC29F02BC0BEF12CC0BFF12DC0C0F1A0
:102220002EC0C1F1C2C130F0C3C131F0C4C132F01F
:10223000C5C133F0BEC12BF0BFC12CF0C0C12DF021
:10224000C1C12EF028EC2BF0010A1BE0C2C130F016
:10225000C3C131F0C4C132F0C5C133F0BEC12BF0EF
:10226000BFC12CF0C0C12DF0C1C12EF044EC29F04B
:102270002BC0BAF12CC0BBF12DC0BCF12EC0BDF1FA
:102280001AD0BEC130F0BFC131F0C0C132F0C1C1FF
:1022900033F0C2C12BF0C3C12CF0C4C12DF0C5C1B5
:1022A0002EF044EC29F02BC0BAF12CC0BBF12DC0AC
:1022B000BCF12EC0BDF1FB0EDBCF08F0FC0EDBCF76
:1022C00009F0FD0EDBCF0AF0FE0EDBCF0BF0BEC136
:1022D00030F0BFC131F0C0C132F0C1C133F008C02D
:1022E0002BF009C02CF00AC02DF00BC02EF02EEC04
:1022F0002AF02BC004F02CC005F02DC006F02EC033
:1023000007F0050EDBCF10F010C02DF003EC29F024
:102310002BC00CF02CC00DF02DC00EF02EC00FF015
:102320000CC030F00DC031F00EC032F00FC033F0F1
:1023300004C02BF005C02CF006C02DF007C02EF015
:10234000DBEC29F02BC000F02CC001F02DC002F016
:102350002EC003F0040EDBCF15F015C02DF003ECFA
:1023600029F02BC011F02CC012F02DC013F02EC09C
:1023700014F011C030F012C031F013C032F014C0AC
:1023800033F000C02BF001C02CF002C02DF003C0D0
:102390002EF0DBEC29F02BC0DEFF2CC0DEFF2DC0C1
:1023A000DEFF2EC0DDFFDD52DD52DECF2AF0DECFB4
:1023B0002BF0DECF2CF0DDCF2DF0DD52DD520E0EF6
:1023C000E15C03E200D0E16AE552E16EE552E7CF5D
:1023D000D9FF1200D9CFE6FFE1CFD9FFFB0EDBCF4B
:1023E00000F0FC0EDBCF01F0FD0EDBCF02F0FE0EA5
:1023F000DBCF03F070C030F071C031F072C032F04A
:1024000073C033F000C02BF001C02CF002C02DF0DF
:1024100003C02EF028EC2BF0010A03E18992899089
:1024200048D0FB0EDBCF00F0FC0EDBCF01F0FD0E41
:10243000DBCF02F0FE0EDBCF03F074C030F075C0CE
:1024400031F076C032F077C033F000C02BF001C01D
:102450002CF002C02DF003C02EF028EC2BF0010A66
:1024600003E18992898025D0FB0EDBCF00F0FC0EC2
:10247000DBCF01F0FD0EDBCF02F0FE0EDBCF03F071
:1024800078C030F079C031F07AC032F07BC033F0E0
:1024900000C02BF001C02CF002C02DF003C02EF0C4
:1024A00028EC2BF0010A03E18982899002D089820D
:1024B0008980E552E7CFD9FF1200D9CFE6FFE1CFFF
:1024C000D9FFE65289968998899A8A948A968A9839
:1024D0008A9AFB0EDBCF00F0FC0EDBCF01F0FD0E85
:1024E000DBCF02F0FE0EDBCF03F09CC030F09DC0CE
:1024F00031F09EC032F09FC033F000C02BF001C01D
:102500002CF002C02DF003C02EF028EC2BF0010AB5
:1025100004E18986010EDF6EDBD0FB0EDBCF00F01D
:10252000FC0EDBCF01F0FD0EDBCF02F0FE0EDBCFA9
:1025300003F0A0C030F0A1C031F0A2C032F0A3C0BF
:1025400033F000C02BF001C02CF002C02DF003C00E
:102550002EF028EC2BF0010A04E18988020EDF6ED0
:10256000B7D0FB0EDBCF00F0FC0EDBCF01F0FD0E91
:10257000DBCF02F0FE0EDBCF03F0A4C030F0A5C02D
:1025800031F0A6C032F0A7C033F000C02BF001C07C
:102590002CF002C02DF003C02EF01FEC2BF0010A2E
:1025A00004E0898A040EDF6E93D0FB0EDBCF00F0CF
:1025B000FC0EDBCF01F0FD0EDBCF02F0FE0EDBCF19
:1025C00003F0A8C030F0A9C031F0AAC032F0ABC00F
:1025D00033F000C02BF001C02CF002C02DF003C07E
:1025E0002EF028EC2BF0010A04E18A84080EDF6E3D
:1025F0006FD0FB0EDBCF00F0FC0EDBCF01F0FD0E49
:10260000DBCF02F0FE0EDBCF03F0ACC030F0ADC08C
:1026100031F0AEC032F0AFC033F000C02BF001C0DB
:102620002CF002C02DF003C02EF028EC2BF0010A94
:1026300004E18A86100EDF6E4BD0FB0EDBCF00F07C
:10264000FC0EDBCF01F0FD0EDBCF02F0FE0EDBCF88
:1026500003F0B0C030F0B1C031F0B2C032F0B3C05E
:1026600033F000C02BF001C02CF002C02DF003C0ED
:102670002EF028EC2BF0010A04E18A88200EDF6E90
:1026800027D0FB0EDBCF00F0FC0EDBCF01F0FD0E00
:10269000DBCF02F0FE0EDBCF03F0B4C030F0B5C0EC
:1026A00031F0B6C032F0B7C033F000C02BF001C03B
:1026B0002CF002C02DF003C02EF028EC2BF0010A04
:1026C00004E18A8A400EDF6E03D08A8A800EDF6EB4
:1026D000C580C5B0FED716EC2EF0720EE66E27EC64
:1026E0002DF0E552DFCFE6FF27EC2DF0E552C58453
:1026F000C5B4FED716EC2EF0E552E552E7CFD9FF70
:102700001200D9CFE6FFE1CFD9FFFB0EDBCF0CF0F3
:10271000FC0EDBCF0DF0FD0EDBCF0EF0FE0EDBCF9F
:102720000FF0DAC12AF0DBC12BF0DCC12CF0DDC1E7
:102730002DF02BEC29F02BC014F02CC015F02DC07F
:1027400016F02EC017F0306A316A326A4A0E336EC4
:1027500014C02BF015C02CF016C02DF017C02EF0B1
:10276000DBEC29F02BC010F02CC011F02DC012F0C2
:102770002EC013F010C030F011C031F012C032F092
:1027800013C033F00CC02BF00DC02CF00EC02DF098
:102790000FC02EF044EC29F02BC008F02CC009F03B
:1027A0002DC00AF02EC00BF0D6C12AF0D7C12BF0F5
:1027B000D8C12CF0D9C12DF029EC29F02BC018F08C
:1027C0002CC019F02DC01AF02EC01BF018C030F02C
:1027D00019C031F01AC032F01BC033F008C02BF022
:1027E00009C02CF00AC02DF00BC02EF02EEC2AF000
:1027F0002BC004F02CC005F02DC006F02EC007F051
:10280000306A316A326A4A0E336E04C02BF005C05A
:102810002CF006C02DF007C02EF0DBEC29F02BC009
:1028200000F02CC001F02DC002F02EC003F000C05B
:10283000E6FF01C0E6FF02C0E6FF03C0E6FFD1EC01
:102840000BF0E552E552E552E55285EC0EF0E5520B
:10285000E7CFD9FF1200D9CFE6FFE1CFD9FFE6528B
:1028600001019F51090DF3CFE9FFF4CFEAFF0E0EEE
:10287000E926010EEA22EE52040EEE1801E1ED50B7
:1028800061E1DF6A040EDF5C27E201019F51090D5F
:10289000F3CFE9FFF4CFEAFF0E0EE926010EEA229C
:1028A000030EE926000EEA22E9CF00F0EACF01F09C
:1028B000DF500F010024E96E000E0120EA6EEF5098
:1028C000E66EDF50EA6AA10FE96E010EEA22E552D8
:1028D000E750EF6EDF2AD6D7A1C12AF0A2C12BF0B4
:1028E000A3C12CF0A4C12DF029EC29F02BC000F0DD
:1028F0002CC001F02DC002F02EC003F0306A316A06
:10290000326A4A0E336E00C02BF001C02CF002C0B8
:102910002DF003C02EF0DBEC29F02BC0D2F12CC03F
:10292000D3F12DC0D4F12EC0D5F1D2C1E6FFD3C171
:10293000E6FFD4C1E6FFD5C1E6FFE3DEE552E5528E
:10294000E552E552E552E552E7CFD9FF1200D9CF63
:10295000E6FFE1CFD9FFE65201019F51090DF3CF08
:10296000E9FFF4CFEAFF0E0EE926010EEA22EE524D
:10297000060EEE1801E1ED504EE1DF6A060EDF5C57
:1029800027E201019F51090DF3CFE9FFF4CFEAFFE0
:102990000E0EE926010EEA22030EE926000EEA22B7
:1029A000E9CF00F0EACF01F0DF500F010024E96E1B
:1029B000000E0120EA6EEF50E66EDF50EA6AB10FBA
:1029C000E96E010EEA22E552E750EF6EDF2AD6D714
:1029D000EC0EE66E910EE66EE40EE66E420EE66ECC
:1029E000E1EC0FF0E552E552E552E5522AC0D2F192
:1029F0002BC0D3F12CC0D4F12DC0D5F1D2C1E6FF4C
:102A0000D3C1E6FFD4C1E6FFD5C1E6FF7ADEE552C9
:102A1000E552E552E552E552E552E7CFD9FF120003
:102A2000D9CFE6FFE1CFD9FF020EE12601019F5188
:102A3000090DF3CFE9FFF4CFEAFF0E0EE926010EF0
:102A4000EA22EE52040EEE1801E1ED5001E09ED0B4
:102A5000DE6ADD6ADECF00F0DDCF01F0D8900150F4
:102A600004E6040E005C000E01582AE29F51090D95
:102A7000F3CFE9FFF4CFEAFF0E0EE926010EEA22BA
:102A8000030EE926000EEA22E9CF00F0EACF01F0BA
:102A9000DE500024E96EDD500120EA6EEF50E66E54
:102AA000DECFE9FFDDCFEAFFA50EE926010EEA221F
:102AB000E552E750EF6EDF2A010E01E3DB2ACAD7A9
:102AC000A5C12AF0A6C12BF0A7C12CF0A8C12DF0FA
:102AD00029EC29F02BC000F02CC001F02DC002F031
:102AE0002EC003F0306A316A800E326E4B0E336EA8
:102AF00000C02BF001C02CF002C02DF003C02EF05E
:102B0000DBEC29F02BC0C6F12CC0C7F12DC0C8F1F9
:102B10002EC0C9F1DE6ADD6ADECF00F0DDCF01F044
:102B2000D890015004E6040E005C000E015822E229
:102B3000DECFE9FFDDCFEAFFA50EE926010EEA228E
:102B4000EF50E66EDECF00F0DDCF01F0010E002683
:102B5000000E012200C0E6FF01C0E6FF60EC2DF090
:102B6000E552E552E5521DEC2EF0DF2A010E01E39D
:102B7000DB2AD2D7550EE66E000EE66EE66A60ECF2
:102B80002DF0E552E552E5521DEC2EF0020EE15C0F
:102B900002E2E16AE552E16EE552E7CFD9FF1200A9
:102BA000D9CFE6FFE1CFD9FFE65201019F51090DD0
:102BB000F3CFE9FFF4CFEAFF0E0EE926010EEA2279
:102BC000EE52040EEE1801E1ED5051E1DF6A040E01
:102BD000DF5C27E201019F51090DF3CFE9FFF4CF3C
:102BE000EAFF0E0EE926010EEA22030EE926000E88
:102BF000EA22E9CF00F0EACF01F0DF500F01002414
:102C0000E96E000E0120EA6EEF50E66EDF50EA6AD0
:102C1000A10FE96E010EEA22E552E750EF6EDF2ABE
:102C2000D6D7DF6A040EDF5C16E2DF50EA6AA10F36
:102C3000E96E010EEA22EF50E66E050EDF24010F69
:102C4000E66EE66A60EC2DF0E552E552E5521DECC9
:102C50002EF0DF2AE7D7550EE66E050EE66EE66A21
:102C600060EC2DF0E552E552E5521DEC2EF0E552F8
:102C7000E552E7CFD9FF1200D9CFE6FFE1CFD9FF68
:102C80000D0EE12601019F51090DF3CFE9FFF4CFAD
:102C9000EAFF0E0EE926010EEA22EE52080EEE18A9
:102CA00001E1ED5002E074EF1AF0050EDAC1DBFF2E
:102CB000060EDBC1DBFF070EDCC1DBFF080EDDC14A
:102CC000DBFF010ED6C1DBFF020ED7C1DBFF030E17
:102CD000D8C1DBFF040ED9C1DBFFDF6A040EDF5C65
:102CE00027E201019F51090DF3CFE9FFF4CFEAFF7D
:102CF0000E0EE926010EEA22030EE926000EEA2254
:102D0000E9CF00F0EACF01F0DF500F010024E96EB7
:102D1000000E0120EA6EEF50E66EDF50EA6ADA0F2D
:102D2000E96E010EEA22E552E750EF6EDF2AD6D7B0
:102D3000DF6A040EDF5C28E201019F51090DF3CF29
:102D4000E9FFF4CFEAFF0E0EE926010EEA22030E98
:102D5000E926000EEA22E9CF00F0EACF01F0040EE6
:102D6000DF240F010024E96E000E0120EA6EEF500F
:102D7000E66EDF50EA6AD60FE96E010EEA22E552EE
:102D8000E750EF6EDF2AD5D7DF6A040EDF5C16E26C
:102D9000DF50EA6ADA0FE96E010EEA22EF50E66EC2
:102DA0000D0EDF24010FE66EE66A60EC2DF0E552B1
:102DB000E552E5521DEC2EF0DF2AE7D7DF6A040E5C
:102DC000DF5C16E2DF50EA6AD60FE96E010EEA22F6
:102DD000EF50E66E0D0EDF24050FE66EE66A60EC3E
:102DE0002DF0E552E552E5521DEC2EF0DF2AE7D733
:102DF000550EE66E0D0EE66EE66A60EC2DF0E552BD
:102E0000E552E5521DEC2EF0DF6A030EDF5C01E3B4
:102E1000B3D1DF50040DF3CFE9FFF4CFEAFF700E1A
:102E2000E926000EEA22EECF08F0EECF09F0EECF51
:102E30000AF0EFCF0BF0010EDBCF14F0020EDBCF68
:102E400015F0030EDBCF16F0040EDBCF17F014C025
:102E50002AF015C02BF016C02CF017C02DF029EC6D
:102E600029F02BC010F02CC011F02DC012F02EC094
:102E700013F0306A316A326A4A0E336E10C02BF09A
:102E800011C02CF012C02DF013C02EF0DBEC29F095
:102E90002BC00CF02CC00DF02DC00EF02EC00FF08A
:102EA0000CC030F00DC031F00EC032F00FC033F066
:102EB00008C02BF009C02CF00AC02DF00BC02EF07A
:102EC000DBEC29F02BC004F02CC005F02DC006F07F
:102ED0002EC007F0306A316A800E326E400E336EBB
:102EE00004C02BF005C02CF006C02DF007C02EF05A
:102EF000DBEC29F02BC000F02CC001F02DC002F05B
:102F00002EC003F0050EDBCF20F0060EDBCF21F044
:102F1000070EDBCF22F0080EDBCF23F020C02AF013
:102F200021C02BF022C02CF023C02DF02BEC29F077
:102F30002BC01CF02CC01DF02DC01EF02EC01FF0A9
:102F4000306A316A326A4A0E336E1CC02BF01DC0E3
:102F50002CF01EC02DF01FC02EF0DBEC29F02BC092
:102F600018F02CC019F02DC01AF02EC01BF018C09C
:102F700030F019C031F01AC032F01BC033F000C07D
:102F80002BF001C02CF002C02DF003C02EF045EC58
:102F900029F0090E2BC0DBFF0A0E2CC0DBFF0B0E45
:102FA0002DC0DBFF0C0E2EC0DBFF090EDBCF0CF0BB
:102FB0000A0EDBCF0DF00B0EDBCF0EF00C0EDBCFCD
:102FC0000FF0DAC12AF0DBC12BF0DCC12CF0DDC13F
:102FD0002DF02BEC29F02BC014F02CC015F02DC0D7
:102FE00016F02EC017F0306A316A326A4A0E336E1C
:102FF00014C02BF015C02CF016C02DF017C02EF009
:10300000DBEC29F02BC010F02CC011F02DC012F019
:103010002EC013F010C030F011C031F012C032F0E9
:1030200013C033F00CC02BF00DC02CF00EC02DF0EF
:103030000FC02EF044EC29F02BC008F02CC009F092
:103040002DC00AF02EC00BF0D6C12AF0D7C12BF04C
:10305000D8C12CF0D9C12DF029EC29F02BC01CF0DF
:103060002CC01DF02DC01EF02EC01FF0306A316A3A
:10307000326A4A0E336E1CC02BF01DC02CF01EC0ED
:103080002DF01FC02EF0DBEC29F02BC018F02CC067
:1030900019F02DC01AF02EC01BF018C030F019C066
:1030A00031F01AC032F01BC033F008C02BF009C059
:1030B0002CF00AC02DF00BC02EF02EEC2AF02BC005
:1030C00004F02CC005F02DC006F02EC007F0306AC9
:1030D000316A800E326E400E336E04C02BF005C094
:1030E0002CF006C02DF007C02EF02EEC2AF02BC0DD
:1030F00000F02CC001F02DC002F02EC003F0DF5014
:10310000040DF3CFE9FFF4CFEAFF700EE926000EBD
:10311000EA2200C0EEFF01C0EEFF02C0EEFF03C0D6
:10312000EEFFDF50040DF3CFE9FFF4CFEAFF700E9E
:10313000E926000EEA22EECFE6FFEECFE6FFEECF65
:10314000E6FFEFCFE6FFB7EC04F0E552E552E552BB
:10315000E552F3CF00F0F4CF01F0EA6ADF34FE0B62
:10316000EA36E96E600EE926000EEA2200C0EEFFA4
:1031700001C0EDFFDF2A49D6DF6A070EDF5C01E3FD
:10318000B3D1DF50040DF3CFE9FFF4CFEAFF9C0E7B
:10319000E926000EEA22EECF08F0EECF09F0EECFDE
:1031A0000AF0EFCF0BF0010EDBCF14F0020EDBCFF5
:1031B00015F0030EDBCF16F0040EDBCF17F014C0B2
:1031C0002AF015C02BF016C02CF017C02DF029ECFA
:1031D00029F02BC010F02CC011F02DC012F02EC021
:1031E00013F0306A316A326A4A0E336E10C02BF027
:1031F00011C02CF012C02DF013C02EF0DBEC29F022
:103200002BC00CF02CC00DF02DC00EF02EC00FF016
:103210000CC030F00DC031F00EC032F00FC033F0F2
:1032200008C02BF009C02CF00AC02DF00BC02EF006
:10323000DBEC29F02BC004F02CC005F02DC006F00B
:103240002EC007F0306A316A800E326E400E336E47
:1032500004C02BF005C02CF006C02DF007C02EF0E6
:10326000DBEC29F02BC000F02CC001F02DC002F0E7
:103270002EC003F0050EDBCF20F0060EDBCF21F0D1
:10328000070EDBCF22F0080EDBCF23F020C02AF0A0
:1032900021C02BF022C02CF023C02DF02BEC29F004
:1032A0002BC01CF02CC01DF02DC01EF02EC01FF036
:1032B000306A316A326A4A0E336E1CC02BF01DC070
:1032C0002CF01EC02DF01FC02EF0DBEC29F02BC01F
:1032D00018F02CC019F02DC01AF02EC01BF018C029
:1032E00030F019C031F01AC032F01BC033F000C00A
:1032F0002BF001C02CF002C02DF003C02EF045ECE5
:1033000029F0090E2BC0DBFF0A0E2CC0DBFF0B0ED1
:103310002DC0DBFF0C0E2EC0DBFF090EDBCF0CF047
:103320000A0EDBCF0DF00B0EDBCF0EF00C0EDBCF59
:103330000FF0DAC12AF0DBC12BF0DCC12CF0DDC1CB
:103340002DF02BEC29F02BC014F02CC015F02DC063
:1033500016F02EC017F0306A316A326A4A0E336EA8
:1033600014C02BF015C02CF016C02DF017C02EF095
:10337000DBEC29F02BC010F02CC011F02DC012F0A6
:103380002EC013F010C030F011C031F012C032F076
:1033900013C033F00CC02BF00DC02CF00EC02DF07C
:1033A0000FC02EF044EC29F02BC008F02CC009F01F
:1033B0002DC00AF02EC00BF0D6C12AF0D7C12BF0D9
:1033C000D8C12CF0D9C12DF029EC29F02BC01CF06C
:1033D0002CC01DF02DC01EF02EC01FF0306A316AC7
:1033E000326A4A0E336E1CC02BF01DC02CF01EC07A
:1033F0002DF01FC02EF0DBEC29F02BC018F02CC0F4
:1034000019F02DC01AF02EC01BF018C030F019C0F2
:1034100031F01AC032F01BC033F008C02BF009C0E5
:103420002CF00AC02DF00BC02EF02EEC2AF02BC091
:1034300004F02CC005F02DC006F02EC007F0306A55
:10344000316A800E326E400E336E04C02BF005C020
:103450002CF006C02DF007C02EF02EEC2AF02BC069
:1034600000F02CC001F02DC002F02EC003F0DF50A0
:10347000040DF3CFE9FFF4CFEAFF9C0EE926000E1E
:10348000EA2200C0EEFF01C0EEFF02C0EEFF03C063
:10349000EEFFDF50040DF3CFE9FFF4CFEAFF9C0EFF
:1034A000E926000EEA22EECFE6FFEECFE6FFEECFF2
:1034B000E6FFEFCFE6FFB7EC04F0E552E552E55248
:1034C000E552F3CF00F0F4CF01F0EA6ADF34FE0BEF
:1034D000EA36E96E8C0EE926000EEA2200C0EEFF05
:1034E00001C0EDFFDF2A49D60D0EE15C02E2E16A80
:1034F000E552E16EE552E7CFD9FF1200D9CFE6FFE2
:10350000E1CFD9FF040EE12601019F51090DF3CF50
:10351000E9FFF4CFEAFF0E0EE926010EEA22EE5291
:10352000020EEE1801E1ED5001E098D09F51090D17
:10353000F3CFE9FFF4CFEAFF0E0EE926010EEA22EF
:10354000030EE926000EEA22EFCFDFFF9F51090D9F
:10355000F3CFE9FFF4CFEAFF0E0EE926010EEA22CF
:10356000030EE926000EEA22010EE926000EEA22E9
:10357000010EEFCFDBFF000EDFCF2CF0010EDBCF13
:103580002DF014EC29F02BC000F02CC001F02DC060
:1035900002F02EC003F0306A240E316E740E326ECB
:1035A000490E336E00C02BF001C02CF002C02DF08C
:1035B00003C02EF0DBEC29F02BC0CEF12CC0CFF1F4
:1035C0002DC0D0F12EC0D1F1020EDB6A030EDB6AF2
:1035D000020EDBCF00F0030EDBCF01F0020E005C29
:1035E000000E01582FE2D9CF00F0DACF01F0020E21
:1035F000DB500024E96E030EDB500120EA6EEF5031
:10360000E66E0A0EE76E020EDBCF02F0030EDBCF92
:1036100003F0E7500226000E0322010E0226000EE0
:10362000032202C0E6FF03C0E6FF60EC2DF0E55286
:10363000E552E5521DEC2EF0020EDB2A030E01E3EB
:10364000DB2AC6D7550EE66E0A0EE66EE66A60EC19
:103650002DF0E552E552E5521DEC2EF0040EE15C32
:1036600002E2E16AE552E16EE552E7CFD9FF1200CE
:10367000D9CFE6FFE1CFD9FFE652A09A6A6A686A1D
:10368000160E6F6E9F0E6B6E7B0E696E6D8C6E6A82
:10369000010EE66EE66AE66A710EE66E0F0EE66EE3
:1036A000BBEC2DF0006E050EE15E00506D9CDF6AF4
:1036B000DF50006E016A080E005C000E015810E237
:1036C000DF50040DF3CFE9FFF4CFEAFF000EE92647
:1036D000040EEA22EE6AEE6AEE6AEE6ADF2AE8D7A4
:1036E000160E706E68A602D06896FCD70001CB6BF0
:1036F000D06BD16BD26B6D98DF6A020EDF5C18E283
:10370000EA6ADF34FE0BEA36E96EC30EE926000EE4
:10371000EA22EE6AED6AEA6ADF34FE0BEA36E96E07
:10372000BF0EE926000EEA22EE6AED6ADF2AE5D72F
:103730000001080EC36F040EC46FB96BB86BE5527D
:10374000E552E7CFD9FF1200D9CFE6FFE1CFD9FF8D
:10375000E6520001B85116E106D06D6A696A0001AF
:10376000B86BA19AA8D06D6A696A160E6F6E9F0E2B
:103770006B6E7B0E696E6DB602D06D86FCD7000154
:10378000010EB86FB80508E16DBA06D0686A696ABB
:1037900069806988020EB86F6850040B05E06950B3
:1037A000040B02E06894B7D86DA202D0A19A83D02E
:1037B0006850010B12E06950010B0FE059DF000166
:1037C000040EB86F0401200E026F040E036F080E82
:1037D000016F006B8C0E001368906850100B05E0B1
:1037E0006950100B02E085D868986850400B13E0D0
:1037F0006950400B10E0010EE66EE66A000EE66EC0
:10380000E66A730EE66EE66A4BEC2CF0006E060E6E
:10381000E15E0050689C6850200B04E06950200B6A
:1038200001E04ED86850020B13E06950020B10E023
:10383000010EE66EE66A000EE66EE66AE6687F0E48
:10384000E66E4BEC2CF0006E060EE15E00506A6AEC
:10385000040E0001E76EB819E8AE02D0E73402D0DA
:10386000E750B85D02E2A19A26D069A623D0DF6AAC
:10387000040EDF5C1FE268A61AD06CCFD8F0689601
:10388000780E0001D81502E15BD810D0000EE66E6C
:10389000E66AD80EE66E000EE66E720EE66EE66A18
:1038A0004BEC2CF0006E060EE15E005001D002D011
:1038B000DF2ADED7A19AE552E552E7CFD9FF120001
:1038C00070A015D0BBC0E9FFBCC0EAFFEF50800874
:1038D0000DE1C3C0E9FFC4C0EAFFEF50840806E170
:1038E000BBC0E9FFBCC0EAFF8C0EEF6E7090689A17
:1038F0001200698468986D82000EE66EE66AE66ED4
:10390000E66A750EE66EE66A4BEC2CF0006E060E6B
:10391000E15E00501200000EE66EE66AE66EE66AB0
:10392000740EE66EE66A4BEC2CF0006E060EE15E5D
:1039300000506D92699468A402D06894FCD712007C
:10394000D9CFE6FFE1CFD9FFE652FD0E0001D81531
:103950005AE17E0ED815E8407F0B040DF3CFBBF083
:10396000F4CFBCF0000EBB27040EBC23BBC0BDF0DF
:10397000BCC0BEF0BD75BBC0E9FFBCC0EAFFEF50E4
:103980003C0BE842E8420D083CE1BBC0E9FFBCC08B
:10399000EAFF020EE926000EEA22EECF00F0EFCF9A
:1039A00001F0280E001802E1040E011828E1BBC046
:1039B000E9FFBCC0EAFF020EE926000EEA22200E53
:1039C000EE6E040EED6EDF6ADF50006E016A080EC7
:1039D000005C000E015813E2DF50EA6A280FE96E1E
:1039E000040EEA22EF50E66EDF50EA6A200FE96E1D
:1039F000040EEA22E552E750EF6EDF2AE5D70DD834
:103A000001D02ED805D0FD0ED815040801E14ED8FE
:103A1000E552E552E7CFD9FF1200C3C0E9FFC4C0A9
:103A2000EAFFEF50800B05E0C3C0E9FFC4C0EAFF26
:103A3000EF6A0001C76BC86BCC6BCD6BCB6BB6D894
:103A4000000EE66EE66AE66EE66A030EE66EE66A6B
:103A50004BEC2CF0006E060EE15E005087EF1FF07D
:103A6000020E0001C85D02E1B2DB1FD06CD800017C
:103A7000D9511AE1BDC0E9FFBEC0EAFFEE52080EFF
:103A8000EF6EBDC0E9FFBEC0EAFF020EE926000EE0
:103A9000EA22200EEE6E040EED6EBDC0E9FFBEC040
:103AA000EAFF8C0EEF6E01D0D96B1200D9CFE6FF82
:103AB000E1CFD9FFE652C3C0E9FFC4C0EAFFEF502F
:103AC000400B01E0010EDF6E0001C375080EB85D0A
:103AD0000AE122C46EFF6E50000803E2100EB86FB8
:103AE00002D0040EB86FC80528E1C3C0E9FFC4C006
:103AF000EAFF020EE926000EEA22280EEE6E040E00
:103B0000ED6EDADA020E0001C75D07E1C3C0E9FF1E
:103B1000C4C0EAFF840EEF6E0FD0DF5007E1C3C0D0
:103B2000E9FFC4C0EAFFC80EEF6E06D0C3C0E9FFCC
:103B3000C4C0EAFF880EEF6E01D005D8E552E55209
:103B4000E7CFD9FF1200D9CFE6FFE1CFD9FF020EB0
:103B5000E1260001C86BC3C0E9FFC4C0EAFFEF6AF9
:103B6000040EC319006EC4C001F000C0DEFF01C026
:103B7000DDFFDECFE9FFDDCFEAFFEF6AD0AF0CD08B
:103B8000D351D41107E005D0D4C0FAFF0001D351BE
:103B9000F96EFADF0001D09F020EE15C02E2E16AF9
:103BA000E552E16EE552E7CFD9FF12000401205142
:103BB000600BE842E842E842E842E842000901E0DE
:103BC00058D021510C0A54E00B0A43E00C0A35E0AE
:103BD000010A26E00B0A22E0020A20E0030A1CE0A8
:103BE000080A10E0010A0CE00F0A08E0030A01E0ED
:103BF0003FD00001CB8F080EB86F3BD0C7D839D06B
:103C000083DB37D00001B90EC96F000ECA6FCB81BC
:103C1000010ECC6FCB8F2DD019D92BD02BD829D01A
:103C200024510001C96FCA6BBA0EC927000ECA23FE
:103C3000CB81010ECC6FCB8F1CD00001CB8F040148
:103C40002451EA6ABA0FE96E000EEA2222C4EFFF9D
:103C500010D0000EE66EE66AE66EE66A020EE66ECA
:103C6000E66A4BEC2CF0006E060EE15E005001D0CF
:103C700000D01200D9CFE6FFE1CFD9FF040EE12634
:103C80000401220510E120511F0B00090CE1000185
:103C9000CB8F030E0401215D04E10001010ED76FFB
:103CA00002D00001D76B0401225166E120511F0BA5
:103CB000020862E124510F0B00095EE00001CB8F86
:103CC000040124BF10D024510F0BE96EEA6AD8908A
:103CD000E936EA36BF0EE926000EEA22EECFDEFF15
:103CE000EDCFDDFF0FD024510F0BE96EEA6AD890BB
:103CF000E936EA36C30EE926000EEA22EECFDEFFF1
:103D0000EDCFDDFF030E215D07E1DECFE9FFDDCF63
:103D1000EAFF840EEF6E30D024510F0B016A700F52
:103D2000006E0F0E0122020E00C0DBFF030E01C069
:103D3000DBFF020EDBCFE9FF030EDBCFEAFFEF90E4
:103D400024AF0DD0DECFE9FFDDCFEAFFEF6ADF74ED
:103D5000DECFE9FFDDCFEAFF400EEF6E0DD0DECF04
:103D6000E9FFDDCFEAFF880EEF6EDF74DECFE9FFFB
:103D7000DDCFEAFFC80EEF6E040EE15C02E2E16AFD
:103D8000E552E16EE552E7CFD9FF1200800E040143
:103D9000205D5BE10001C00ECB6F04012351030ADB
:103DA00034E0010A0EE0030A03E00001CB6B4DD0C2
:103DB0000001CA0EC96F590ECA6F120ECC6FCD6BBF
:103DC00044D02251F66EF76AD890F636F736440E94
:103DD000F6265A0EF7220900F5CFC9F00A00F5CFF2
:103DE000CAF0020E0001F76AC925F66ECA51F72221
:103DF0000800F5CFCCF0030EF76AC925F66ECA515C
:103E0000F7220800F5CFCDF020D0040E225D1AE293
:103E10002251F66EF76AD890F636F736460EF62639
:103E20005A0EF7220900F5CFC9F00A00F5CFCAF003
:103E3000C9C0F6FFCAC0F7FF0800F5500001CC6FFB
:103E4000CD6B02D00001CB6B00D01200D9CFE6FFC2
:103E5000E1CFD9FF020EE1260401286B296B205126
:103E60001F0B020A12E0030A0DE0010A01E03BD039
:103E70000001CB8F040128810001D70502E1040174
:103E8000288331D00001CB8F2ED00001CB8F0401CD
:103E900024BF10D024510F0BE96EEA6AD890E9369E
:103EA000EA36BF0EE926000EEA22EECFDEFFEDCFA6
:103EB000DDFF0FD024510F0BE96EEA6AD890E93686
:103EC000EA36C30EE926000EEA22EECFDEFFEDCF82
:103ED000DDFFDECFE9FFDDCFEAFFEF50040B02E0AC
:103EE000010E286F00D00001CBAF07D0280EC96F9C
:103EF000040ECA6FCB81020ECC6F020EE15C02E2AF
:103F0000E16AE552E16EE552E7CFD9FF12006D9804
:103F10000001CBBF4AD0D0AF28D0020EC86FC3C0BB
:103F2000E9FFC4C0EAFFEE52EF6AC3C0E9FFC4C0B4
:103F3000EAFFC80EEF6EBDC0E9FFBEC0EAFFEE5259
:103F4000080EEF6EBDC0E9FFBEC0EAFF020EE92613
:103F5000000EEA22280EEE6E040EED6EBDC0E9FFE3
:103F6000BEC0EAFFC80EEF6E1FD0BDC0E9FFBEC0E5
:103F7000EAFFEE52080EEF6EBDC0E9FFBEC0EAFFD9
:103F8000020EE926000EEA22200EEE6E040EED6E01
:103F9000BDC0E9FFBEC0EAFF8C0EEF6EC3C0E9FFF3
:103FA000C4C0EAFF840EEF6E86D0D0BF84D0040177
:103FB00020AF59D00001CC510401265D0001CD5144
:103FC0000401275904E226C4CCF027C4CDF074D8EC
:103FD0000001010EC86FBDC0E9FFBEC0EAFFEE528E
:103FE000080EEF6EBDC0E9FFBEC0EAFF020EE92673
:103FF000000EEA22200EEE6E040EED6EBDC0E9FF4B
:10400000BEC0EAFF800EEF6ED96BBBC0E9FFBCC03B
:10401000EAFFEE52080EEF6EBBC0E9FFBCC0EAFF3C
:10402000020EE926000EEA22200EEE6E040EED6E60
:10403000BBC0E9FFBCC0EAFF840EEF6E010ED96F72
:10404000C3C0E9FFC4C0EAFF020EE926000EEA225F
:10405000280EEE6E040EED6EC3C0E9FFC4C0EAFF89
:10406000C80EEF6E28D00001020EC86FC3C0E9FF72
:10407000C4C0EAFFEE52EF6AC3C0E9FFC4C0EAFF62
:10408000C80EEF6EBDC0E9FFBEC0EAFFEE52080EDB
:10409000EF6EBDC0E9FFBEC0EAFF020EE926000ECA
:1040A000EA22280EEE6E040EED6EBDC0E9FFBEC022
:1040B000EAFFC80EEF6E1200D9CFE6FFE1CFD9FFBD
:1040C000020EE1260001080ECC5D000ECD590EE275
:1040D000CCC0DEFFCDC0DDFFC75103E1010EC76FCD
:1040E00004D0C70502E1020EC76F03D0080EDE6ED2
:1040F000DD6AC3C0E9FFC4C0EAFFEF92C3C0E9FFB5
:10410000C4C0EAFFEF90C3C0E9FFC4C0EAFF010EDC
:10411000DB50EF12C3C0E9FFC4C0EAFFEE52DFCFAD
:10412000EFFF000EDB50CC5F010EDB50CD5B280EA5
:10413000D56F040ED66FCBB121D0D9CFE9FFDACF3E
:10414000EAFFEE50ED1019E0C9C0F6FFCAC0F7FF54
:10415000C92B000ECA230800F550E66ED5C0E9FF52
:10416000D6C0EAFFD52B000ED623E552E750EF6EFE
:10417000DF06010E01E2DB06E0D71FD0D9CFE9FF51
:10418000DACFEAFFEE50ED1018E0C9C0E9FFCAC06F
:10419000EAFFC92B000ECA23EF50E66ED5C0E9FF37
:1041A000D6C0EAFFD52B000ED623E552E750EF6EBE
:1041B000DF06010E01E2DB06E1D7020EE15C02E25E
:1041C000E16AE552E16EE552E7CFD9FF1200D9CF9F
:1041D000E6FFE1CFD9FF020EE126BBC0E9FFBCC07C
:1041E000EAFFEE52EFCFDFFFDFCF00F0005000011B
:1041F000D15D000ED25902E2D1C0DFFFDF50006E68
:10420000016A0050D15DD16F0150D259D26F010EB9
:10421000DB6ADF50F36E010EDBCFF4FFF350F45C8A
:1042200016E2010EDB50EA6A280FE96E040EEA225C
:10423000EF50E66ECEC0E9FFCFC0EAFFCE2B000EF6
:10424000CF23E552E750EF6E010EDB2AE2D7000ED6
:10425000D880D155000ED25528E2BDC0E9FFBEC0BE
:10426000EAFFEE52080EEF6EBDC0E9FFBEC0EAFFE6
:10427000020EE926000EEA22280EEE6E040EED6E06
:10428000BBC0E9FFBCC0EAFFEF50400B07E1BDC077
:10429000E9FFBEC0EAFFC80EEF6E06D0BDC0E9FF61
:1042A000BEC0EAFF880EEF6E25D0BDC0E9FFBEC0DC
:1042B000EAFFEE52080EEF6EBDC0E9FFBEC0EAFF96
:1042C000020EE926000EEA22200EEE6E040EED6EBE
:1042D000BDC0E9FFBEC0EAFF840EEF6ED351D4111A
:1042E00007E005D0D4C0FAFF0001D351F96EFADF20
:1042F0000001D09F020EE15C02E2E16AE552E16E4C
:10430000E552E7CFD9FF1200D9CFE6FFE1CFD9FFC1
:10431000E6520001CB8F010EE66EE66AE66A710E88
:10432000E66E0F0EE66EBBEC2DF0006E050EE15E44
:104330000050DF6ADF50006E016A080E005C000E5C
:10434000015810E2DF50040DF3CFE9FFF4CFEAFF8C
:10435000000EE926040EEA22EE6AEE6AEE6AEE6AC2
:10436000DF2AE8D76D8C010EE66EE66AE66ABA0EC1
:10437000E66E000EE66EBBEC2DF0006E050EE15E03
:1043800000506D9C0001080EC36F040EC46F000E38
:10439000BB6F040EBC6FBBC0BDF0BCC0BEF022C47E
:1043A000B9F0B95103E1100EB86F13D0010EE66EEB
:1043B000E66AB90EE66E000EE66E010EE66EE66A7D
:1043C0004BEC2CF0006E060EE15E00500001200E5A
:1043D000B86FE552E552E7CFD9FF1200D9CFE6FF1B
:1043E000E1CFD9FF020EE126000EDE6E040EDD6E77
:1043F000FD0EDB50E824026EFE0EDB50040DF35080
:104400000224040DF350006E016A020E0F0B05E04A
:10441000D89001320032E806FBE1D8900036013630
:10442000D89000360136D9CFE9FFDACFEAFF005045
:10443000EE260150ED22DECFE9FFDDCFEAFFEF9E51
:10444000FD0EDB500FE1FE0EEA6ADB34FE0BEA36AE
:10445000E96EBF0EE926000EEA22DECFEEFFDDCFC9
:10446000EDFF0ED0FE0EEA6ADB34FE0BEA36E96E93
:10447000C30EE926000EEA22DECFEEFFDDCFEDFF10
:10448000DECFE9FFDDCFEAFFEF9CDECFE9FFDDCF36
:10449000EAFF040EE926000EEA22EF8C020EE15C30
:1044A00002E2E16AE552E16EE552E7CFD9FF120080
:1044B000D9CFE6FFE1CFD9FF020EE126FE0EDB5099
:1044C000016A700F006E0F0E012200C0DEFF01C0F6
:1044D000DDFFDECFE9FFDDCFEAFFFD0EDBCFEFFF33
:1044E000DBA407D0E66AFE0EDBCFE6FF77DFE552FE
:1044F000E552FD0EDBA208D0010EE66EFE0EDBCF0C
:10450000E6FF6CDFE552E552020EE15C02E2E16A91
:10451000E552E16EE552E7CFD9FF1200D9CFE6FFB1
:10452000E1CFD9FF020EE126FE0EDB5020E1BDC037
:10453000E9FFBEC0EAFFEE52080EEF6EBDC0E9FF14
:10454000BEC0EAFF020EE926000EEA22200EEE6E41
:10455000040EED6EBDC0E9FFBEC0EAFF8C0EEF6E2B
:10456000C3C0E9FFC4C0EAFF840EEF6E3DD0FD0E6C
:10457000DB50E824026EFE0EDB50040DF3500224E3
:10458000040DF3CF00F0F4CF01F0000E0026040E6E
:10459000012200C0DEFF01C0DDFF840E006EDECF11
:1045A000E9FFDDCFEAFF0050EF12FD0EDB50E824FB
:1045B000026EFE0EDB50040DF3500224010F040DB9
:1045C000F3CF00F0F4CF01F0000E0026040E01221C
:1045D00000C0DEFF01C0DDFF840E006EDECFE9FF0C
:1045E000DDCFEAFF0050EF12020EE15C02E2E16A69
:1045F000E552E16EE552E7CFD9FF1200D9CFE6FFD1
:10460000E1CFD9FF020EE126FD0EDB500FE0FE0EDA
:10461000EA6ADB34FE0BEA36E96EC30EE926000EC9
:10462000EA22EECFDEFFEDCFDDFF0ED0FE0EEA6A0E
:10463000DB34FE0BEA36E96EBF0EE926000EEA22F5
:10464000EECFDEFFEDCFDDFFD9CFE9FFDACFEAFF16
:10465000EE50ED1003E1F36AF46A49D0DECFE9FFD2
:10466000DDCFEAFF020EE926000EEA22FB0EDBCFC9
:10467000EEFFFC0EDBCFEDFFDECFE9FFDDCFEAFF83
:10468000EE52FA0EDBCFEFFF400E006EDECFE9FFF9
:10469000DDCFEAFF0050EF16880E006EDECFE9FF97
:1046A000DDCFEAFF0050EF12FD0EDB500CE0FE0EF6
:1046B000EA6ADB34FE0BEA36E96EC30EE926000E29
:1046C000EA22EF740BD0FE0EEA6ADB34FE0BEA3608
:1046D000E96EBF0EE926000EEA22EF74DECF00F08D
:1046E000DDCF01F000C0F3FF01C0F4FF00D0020EE7
:1046F000E15C02E2E16AE552E16EE552E7CFD9FF03
:104700001200D9CFE6FFE1CFD9FF6DA84ED0FE0E43
:10471000EA6ADB34FE0BEA36E96EC30EE926000EC8
:10472000EA22EE50EFCFEAFFE96E400EEE16EE6A97
:10473000EE6AEE6AFE0EEA6ADB34FE0BEA36E96EDA
:10474000C30EE926000EEA22EE50EFCFEAFFE96E33
:10475000EE7CFE0EEA6ADB34FE0BEA36E96EC30E2F
:10476000E926000EEA22EF74400E006EFE0EEA6AA1
:10477000DB34FE0BEA36E96EC30EE926000EEA22B0
:10478000EE50EFCFEAFFE96E0050EF16FE0EEA6A38
:10479000DB34FE0BEA36E96EC30EE926000EEA2290
:1047A000EE50EFCFEAFFE96EEF7CE552E7CFD9FF9D
:0247B0001200F5
:0E47B200D9CFE6FFE1CFD9FF0B0EE1260401BF
:1047C0002051600BE842E842E842E842E842000932
:1047D00002E1C9EF28F021C402F10101025102E116
:1047E000BAEF28F0410A02E16DEF28F0010A02E178
:1047F00061EF28F07F0A02E153EF28F0020A02E19C
:1048000049EF28F0010A02E105EF28F0070A01E16B
:10481000D8D3010A01E1B2D3030A01E143D3190A53
:1048200001E115D3370A01E108D1010A01E1E6D01F
:10483000030A01E1AFD0110A01E199D0060A01E1B2
:104840007ED0320A58E0010A56E0030A54E0010A19
:1048500052E0070A50E0010A4EE0650A2CE0010A26
:104860000DE0010103690001030EC96F010ECA6F5B
:10487000CB81010ECC6FCB8FC9EF28F0220EDF6EFB
:1048800081BC02D0000EDF9A81BE02D0000EDF9202
:1048900089A402D0DF8802D0000EDF98DFCF03F1B9
:1048A0000001030EC96F010ECA6FCB81010ECC6FE0
:1048B000CB8FC9EF28F0220EDF6E0401225103E0F6
:1048C0008984DF8803D08994000EDF9881BC02D0F0
:1048D000000EDF9A81BE02D0000EDF92DFCF03F11F
:1048E0000001030EC96F010ECA6FCB81010ECC6FA0
:1048F000CB8FC9EF28F026C40BF127C40CF126C4D6
:10490000D1F027C4D2F00001A60ED36F510ED46FA0
:1049100001019E51090DF3CFE9FFF4CFEAFF0E0E1E
:10492000E926010EEA22030EE926000EEA22E9CF6B
:10493000CEF0EACFCFF00001D08FC9EF28F00D0EF6
:10494000F36E090EF3CFDBFF81BEDB8280B0DB8824
:1049500080B2DB8ADBCF03F10001030EC96F010EC9
:10496000CA6FCB81010ECC6FCB8FC9EF28F0090E37
:1049700022C4DBFF01010D510BE1090EDBA802D0BF
:10498000898001D08990DBAA02D0898201D08992E6
:10499000C9EF28F0030E04012415E76E090EE7CFD6
:1049A000DBFF01010D510BE1090EDBA002D0898074
:1049B00001D08990DBA202D0898201D089928050F7
:1049C000010BE76E090EE7CFDBFF80A202D0DB828E
:1049D00007D0DB92DB94DB96DB98DB9ADB9CDB9EDB
:1049E000DBCF03F10101046B0001030EC96F010E5F
:1049F000CA6FCB81020ECC6FCB8FCBD38050010B13
:104A0000E76E090EE7CFDBFF80A202D0DB8207D082
:104A1000DB92DB94DB96DB98DB9ADB9CDB9EDBCFC7
:104A200003F10101046B0001030EC96F010ECA6F8F
:104A3000CB81020ECC6FCB8FACD3050E24C4DBFF31
:104A4000060E25C4DBFF050EDBCF00F0060EDBCF24
:104A500001F0000E005C010E01586FE2080EF36ECB
:104A60000A0EF3CFDBFF0001600EC96F000ECA6FA4
:104A7000050EDBCF00F0060EDBCF01F0040E005C6C
:104A8000000E015859E2050EDBCFE9FF060EDBCF21
:104A9000EAFF010ED890E936EA36E806FBE1600E3F
:104AA000E926000EEA2222C4EEFF23C4EDFFD9500E
:104AB000050FE96EDACFEAFF030EEE1801E1ED50C3
:104AC00039E0050EDBCFE9FF060EDBCFEAFF010E72
:104AD000D890E936EA36E806FBE1600EE926000EDA
:104AE000EA22EECFE6FFEFCFE6FF1CEC04F0E55242
:104AF000E5522AC000F02BC001F02CC002F02DC0FE
:104B000003F0050EDBCFE9FF060EDBCFEAFF020E56
:104B1000D890E936EA36E806FBE1700EE926000E89
:104B2000EA2200C0EEFF01C0EEFF02C0EEFF03C0AC
:104B3000EEFF02D022C40DF17AD0100EF36E0A0EF1
:104B4000F3CFDBFF00018C0EC96F000ECA6F050E9C
:104B5000DBCF00F0060EDBCF01F0000E005E010E91
:104B6000015A070E00C0DBFF080E01C0DBFF070E75
:104B7000DBCF00F0080EDBCF01F0005C000E015827
:104B800056E2070EDBCFE9FF080EDBCFEAFF010E8E
:104B9000D890E936EA36E806FBE18C0EE926000EED
:104BA000EA2222C4EEFF23C4EDFFD950070FE96EBD
:104BB000DACFEAFF070EEE1801E1ED5038E0070EFC
:104BC000DBCFE9FF080EDBCFEAFF010ED890E93614
:104BD000EA36E806FBE18C0EE926000EEA22EECF6B
:104BE000E6FFEFCFE6FF1CEC04F0E552E5522AC0E9
:104BF00000F02BC001F02CC002F02DC003F0070E16
:104C0000DBCFE9FF080EDBCFEAFF020ED890E936D2
:104C1000EA36E806FBE19C0EE926000EEA2200C017
:104C2000EEFF01C0EEFF02C0EEFF03C0EEFF050E77
:104C3000DB6A060EDB6A050EDBCF00F0060EDBCF6B
:104C400001F0040E005C000E015870E2050EDBCF8F
:104C5000E9FF060EDBCFEAFF010ED890E936EA360F
:104C6000E806FBE1600EE926000EEA22EF50E66E50
:104C7000050EDBCF00F0060EDBCF01F0010ED89061
:104C800000360136E806FBE1160E0026000E012272
:104C9000010E0026000E012200C0E6FF01C0E6FF63
:104CA00060EC2DF0E552E552E5521DEC2EF0050EBC
:104CB000DBCFE9FF060EDBCFEAFF010ED890E93625
:104CC000EA36E806FBE1600EE926000EEA22010E54
:104CD000E926000EEA22EF50E66E050EDBCF00F06B
:104CE000060EDBCF01F0010ED89000360136E80643
:104CF000FBE1160E0026000E0122010E0026000E1A
:104D00000122010E0026000E012200C0E6FF01C0B4
:104D1000E6FF60EC2DF0E552E552E5521DEC2EF079
:104D2000050EDB2A060E01E3DB2A85D7070EDB6AB8
:104D3000080EDB6A070EDBCF00F0080EDBCF01F0B8
:104D4000005C000E015870E2070EDBCFE9FF080E91
:104D5000DBCFEAFF010ED890E936EA36E806FBE140
:104D60008C0EE926000EEA22EF50E66E070EDBCF2E
:104D700000F0080EDBCF01F0010ED89000360136AE
:104D8000E806FBE1160E0026000E0122110E002699
:104D9000000E012200C0E6FF01C0E6FF60EC2DF02E
:104DA000E552E552E5521DEC2EF0070EDBCFE9FF90
:104DB000080EDBCFEAFF010ED890E936EA36E806A6
:104DC000FBE18C0EE926000EEA22010EE926000E18
:104DD000EA22EF50E66E070EDBCF00F0080EDBCFC5
:104DE00001F0010ED89000360136E806FBE1160E00
:104DF0000026000E0122110E0026000E0122010ED7
:104E00000026000E012200C0E6FF01C0E6FF60ECB4
:104E10002DF0E552E552E5521DEC2EF0070EDB2A8F
:104E2000080E01E3DB2A86D7550EE66E160EE66EF7
:104E3000E66A60EC2DF0E552E552E5521DEC2EF0ED
:104E40000A0EDBCFCCF00001CB81CB8FA2D122C4E4
:104E500001F116EC2EF0C580C5B0FED716EC2EF091
:104E600001010151E824E66E27EC2DF0E55223C440
:104E7000E6FF27EC2DF0E55224C4E6FF27EC2DF0E9
:104E8000E552C584C5B4FED716EC2EF00101036BC4
:104E90000001030EC96F010ECA6FCB81010ECC6FEA
:104EA000CB8F77D1050EDB6A060EDB6A050EDBCFF2
:104EB00000F0060EDBCF01F0040E005C000E01587E
:104EC0001FE2050EDBCFE9FF060EDBCFEAFFDA0EAD
:104ED000E926010EEA22EF50E66E050EDBCFE9FF70
:104EE000060EDBCFEAFF030EE926010EEA22E552A9
:104EF000E750EF6E050EDB2A060E01E3DB2AD6D75C
:104F0000050EDB6A060EDB6A050EDBCF00F0060E2F
:104F1000DBCF01F0040E005C000E015825E2050E07
:104F2000DBCFE9FF060EDBCFEAFFD60EE926010E46
:104F3000EA22EF50E66E040EE76E050EDBCFE9FFC6
:104F4000060EDBCFEAFFE750E926000EEA22030E49
:104F5000E926010EEA22E552E750EF6E050EDB2A44
:104F6000060E01E3DB2AD0D70001030EC96F010E44
:104F7000CA6FCB81080ECC6FCB8F0BD1306A316AF0
:104F8000326A4A0E336ED2C12BF0D3C12CF0D4C199
:104F90002DF0D5C12EF02EEC2AF0E8EC2AF02AC034
:104FA000A1F12BC0A2F12CC0A3F12DC0A4F10001EE
:104FB000A10EC96F010ECA6FCB81040ECC6FCB8FCF
:104FC000E8D0306A240E316E740E326E490E336EA4
:104FD000CEC12BF0CFC12CF0D0C12DF0D1C12EF01D
:104FE0002EEC2AF0B9EC2AF0030E2CC0DBFF040EE5
:104FF0002DC0DBFF0001D950030FC96FDACFCAF013
:10500000CB81020ECC6FCB8FC4D0050EDB6A060EAF
:10501000DB6A050EDBCF00F0060EDBCF01F0040EDD
:10502000005C000E01582BE2050EE76EDBCF00F0AE
:10503000060EDBCF01F0E7500026000E0122010E24
:105040000026000E012200C0E6FF01C0E6FF85EC4D
:105050002DF0E552E552E66E050EDBCFE9FF060EB8
:10506000DBCFEAFFA10EE926010EEA22E552E75066
:10507000EF6E050EDB2A060E01E3DB2ACAD700011C
:10508000A10EC96F010ECA6FCB81040ECC6FCB8FFE
:1050900080D00001A50EC96F010ECA6FCB81040E2E
:1050A000CC6FCB8F76D022C401F1E7EC0AF000017F
:1050B000AB0EC96F010ECA6FCB81060ECC6FCB8FC2
:1050C00068D00101036B0001030EC96F010ECA6FA6
:1050D000CB81010ECC6FCB8F5CD0FF0E0401225D23
:1050E0003BE1E668000EE66EE66A60EC2DF0E55204
:1050F000E552E5521DEC2EF0E668050EE66EE66A16
:1051000060EC2DF0E552E552E5521DEC2EF0E6681C
:105110000A0EE66EE66A60EC2DF0E552E552E552C5
:105120001DEC2EF0E6680D0EE66EE66A60EC2DF0E2
:10513000E552E552E5521DEC2EF0E668160EE66EDD
:10514000E66A60EC2DF0E552E552E5521DEC2EF0DA
:105150000101550E016F02D022C401F10101036B60
:105160000001030EC96F010ECA6FCB81010ECC6F17
:10517000CB8F0FD00101040E036F100E046F0001DE
:10518000030EC96F010ECA6FCB81020ECC6FCB8F9D
:1051900000D00B0EE15C02E2E16AE552E16EE552FD
:1051A000E7CFD9FF1200100E0101A05D08E3010155
:1051B0009F2B100E9F5D01E39F6B0101A007010172
:1051C0009E51090DF3CFE9FFF4CFEAFF0E0EE92659
:1051D000010EEA2202C1EFFF9E51090DF3CFE9FF54
:1051E000F4CFEAFF0E0EE926010EEA22EE520BC1C1
:1051F000EEFF0CC1EDFF9E2B100E9E5D01E39E6B3A
:065200000101A02B1200C9
:0A520600259E05D0259E2DAE02D096
:105210002D6C258E2DC027F0266A376A366A860ED9
:10522000286E296AA2EF2BF0259E08D0259E2DAE70
:1052300005D02C6C2D1EE86A2D22258E2DC027F05E
:105240002CC026F0376A366A8E0E286E296AA2EFC5
:105250002BF0259E0CD0259E2DAE09D02A6C2B1E3E
:105260002C1E2D1EE86A2B222C222D22258E2DC0CD
:1052700027F02CC026F02BC037F02AC036F09E0E47
:10528000286E296AA2EF2BF0337E256ADEEC2BF024
:10529000F6EC2BF025B686EF2BF025A20AD025AA36
:1052A00003D025BE86EF2BF025A492EF2BF08FEFD5
:1052B0002BF025AA05D025AC92EF2BF08FEF2BF029
:1052C00025A00AD025A808D025BE04D025A402D048
:1052D0009BEF2BF09FEF2BF0366A296A33502E5C40
:1052E000356E10E32BC037F02CC026F02DC027F010
:1052F0002EC034F030C02BF031C02CF032C02DF075
:10530000253A09D030C037F031C026F032C027F03E
:1053100033C034F0356C259E25BC258E34C028F072
:1053200025B0CEEF2BF01A0E3560CEEF2BF0286AA9
:105330002E6A25A408D02B6C2C1E2D1E2E1EE86A6A
:105340002C222D222E2225AC08D0376C261E271E9B
:10535000281EE86A2622272228222A6A355207E0D8
:105360002E342D322C322B322A32352EF9D72B50B7
:1053700037262C5026222D5027222E5028222AC094
:1053800036F0259E28AE0BD0366C371E261E271E03
:10539000281EE86A3722262227222822258E28A0C6
:1053A00006D0D8802732263237323632342A34C0FB
:1053B00028F0A2EF2BF0256ADEEC2BF0F6EC2BF0B8
:1053C00025B686EF2BF025A205D025BA86EF2BF067
:1053D0008DEF2BF025BA99EF2BF025A005D025B83D
:1053E00086EF2BF099EF2BF025B88DEF2BF0296A83
:1053F0007F0E2E24286EE86A29223350285EE86A40
:10540000295A1A0E346E2E6A366A376A266A276A55
:1054100030502B5E31502C5A32502D5A000E2E5ADD
:1054200009E730502B2631502C2232502D22000E0D
:105430002E2201D0368AD8902B362C362D362E3699
:10544000D8903636373626362736342EE1D72D50CB
:105450002C102B10D8A4368AA2EF2BF0256ADEEC94
:105460002BF0F6EC2BF025B686EF2BF025A205D01D
:1054700025B886EF2BF08DEF2BF025AA05D025B0AF
:1054800086EF2BF08DEF2BF025B002D025A802D0AF
:1054900099EF2BF0296A33502E24286EE86A2922CE
:1054A0007E0E285EE86A295A366A376A266A276AB3
:1054B00032502D02F4CF27F0F3CF26F031502D02D9
:1054C000F3503726F4502622000E272232502C02A9
:1054D000F3503726F4502622000E272230502D029A
:1054E000F3503626F4503722000E26222722315060
:1054F0002C02F3503626F4503722000E26222722A3
:1055000032502B02F3503626F4503722000E26225A
:10551000272230502C02F4503626000E3722262245
:10552000272231502B02F4503626000E3722262235
:105530002722A2EF2BF02CC036F02C503102F4CFF2
:105540002BF0F3CF2AF02D503202F4CF2DF0F3CF11
:105550002CF03102F3502B26F4502C22E86A2D2235
:1055600036503202F3502B26F4502C22E86A2D22BA
:10557000000C256ADEEC2BF025B6C3EF2AF025A23D
:105580000ED025B405D07F0E2D6EFF0E2C6E1FD0D1
:10559000800E2D6E2C6A1BD02D6A2C6A18D025B077
:1055A000FBD78F0E2E60EDD77E0E2E64F5D78E0EB4
:1055B0002E5C05E0D8902D322C322E2AF8D725A467
:1055C00006D02C6C2D1EE86A2D222DAEE5D71200D8
:1055D000256ADEEC2BF025B6F2EF2AF025A20FD0DB
:1055E00025B407D07F0E2D6EFF0E2C6E2B6E2A6E0B
:1055F00025D0800E2D6E01D02D6A000EF6D725B075
:10560000FBD72A6A9F0E2E60EBD77E0E2E64F4D74E
:105610009E0E2E5C07E0D8902D322C322B322A328F
:105620002E2AF6D725A40AD02A6C2B1E2C1E2D1E3E
:10563000E86A2B222C222D222DAEDED7120031EC6F
:105640002BF025B6000C25B0000C25B4000C010C85
:1056500031EC2BF025B6000C25B0000C25A4000C75
:10566000010C256ADEEC2BF0F6EC2BF025B61200CF
:1056700025AE08D025A004D025A802D02580120090
:105680002590120033502E5C0BE132502D5C08E166
:1056900031502C5C05E130502B5C02E1258012007A
:1056A000D8A002D0258E10D02E5033C02EF0336EED
:1056B0002D5032C02DF0326E2C5031C02CF0316E96
:1056C0002B5030C02BF0306E33502E5C10E0FF0FAB
:1056D00009E0259025B403D025AE2584120025AE1F
:1056E00025941200332AD890323231323032305081
:1056F0002B5E31502C5A32502D5A2DBEEAD7D890FD
:105700002B362C362D362E2EF8D7C8D77F0E2E6E80
:10571000FF0E2D6E2C6E2B6E12007F0E25BEFF0E1F
:105720002E6E02D07F0E2E6E800E2D6E2C6A2B6A8E
:10573000F3D725AE04D0800E2E6E2D6AF7D72E6AD1
:105740002D6AF4D72750261037103610F8E029BEFE
:10575000F0D727BE0CD028502910EBE0D890363671
:105760003736263627362806D8A02906F2D72950FC
:10577000D4E12828D2E036AE11D07F0E361402E1F3
:1057800037A00CD0372AE86A2622272207E3D880E0
:10579000273226323732282A2828BFE02850C9E08D
:1057A00037C02BF026C02CF027342D6E28302E6EFB
:1057B0002D322E9E25BE2E8E8CEF2BF02D362E36C2
:1057C00002E32584257E06E125802E6A2D6A2C6A57
:1057D0002B6A12002E2803E0D8802D321200D890B8
:1057E0002D3202E125821200258612003236333630
:1057F00002E3258C257E06E12588336A326A316A08
:10580000306A1200332803E0D88032321200D89078
:085810003232EAE1258A1200A0
:08581800DACFE4FFE2CFDAFF72
:10582000E652E552E5CFDAFF1100D8CFE4FFE0CF32
:10583000E4FFE46EDACFE4FFE2CFDAFFE652E552AE
:10584000E5CFDAFFE550E5CFE0FFE5CFD8FF100068
:1058500006D8A4EC1BF004EC0AF0FBD712000F0EE4
:10586000C1125CEC05F038EF1BF0120012001200C0
:105870001200D9EF23F0120012006D840101080E0E
:10588000EE6F070EEF6FEE07000EEF5BEE51EF11BC
:10589000FAE16D941200D9CFE6FFE1CFD9FFFD0EFA
:1058A000DBCF2CF0FE0EDBCF2DF0720E2C1801E1B9
:1058B0002D5033E0E8682C1802E17F0E2D182BE004
:1058C000740E2C1801E12D5024E0750E2C1801E106
:1058D0002D501DE0730E2C1801E12D5016E0030E23
:1058E0002C1801E12D500FE0020E2C1801E12D5073
:1058F00008E0010E2C1801E12D5001E010D0BCDFB2
:105900000FD0B9DF0DD0B5DF0BD0B1DF09D0ADDFDF
:1059100007D0ACDF05D0ACDF03D0000001D000D051
:0C592000010E00D0E552E7CFD9FF1200C5
:04592C002A0EF66EDB
:10593000080EF76E000EF86E01010900F550E46FD5
:105940000900F550E56F03E1E46701D03DD009009F
:10595000F550DF6F0900F550E06F0900F550E16F79
:1059600009000900F550E96E0900F550EA6E0900DA
:1059700009000900F550E26F0900F550E36F0900D6
:105980000900F6CFE6F1F7CFE7F1F8CFE8F1DFC194
:10599000F6FFE0C1F7FFE1C1F8FF0101E25302E1C8
:1059A000E35307E00900F550EE6EE207F8E2E30783
:1059B000F9D7E6C1F6FFE7C1F7FFE8C1F8FF01013B
:0A59C000E407000EE55BBFD71200FC
:0659CA00120100020000C2
:1059D0000008C016DC0500000102030109022000D6
:1059E000010100C0320904000002000000000705A8
:1059F000010240000107058102400001040309047F
:105A00001A037700770077002E006F0062006400B1
:105A1000650076002E006100740016034400470004
:105A200038005300410051002D004900320043006E
:105A300014035400460033004C004A002D0031008E
:0E5A40002E003000DC59FC59005A1A5A305A18
:025A4E00D9CFAE
:105A5000E6FFDACFE6FFE1CFD9FFE2CFDAFFFD0EB6
:105A6000DB50C96EC6AE02D0FF0E24D00F0EC61496
:105A700008080FE00F0EC6140B080BE0C6889EA6A0
:105A8000FED7C750040B03E1C750010B10E0000E16
:105A900011D00F0EC614080804E00F0EC6140B0830
:105AA00009E1C7B0FED716EC2EF0C5AC02D0FE0E51
:105AB00001D0000EE552E5CFDAFFE7CFD9FF1200A3
:105AC000D9CFE6FFDACFE6FFE1CFD9FFE2CFDAFFA9
:105AD000FF0EE76EFC0EDBCF00F0E7500016005023
:105AE000A96EFB0EDB50A86EA69EA69CA684F29E15
:105AF000550EA76EAA0EA76EA682F28EA694E55248
:0A5B0000E5CFDAFFE7CFD9FF12006E
:065B0A00D9CFE6FFDACF5F
:105B1000E6FFE1CFD9FFE2CFDAFFFF0EE76EFC0E22
:105B2000DBCF00F0E75000160050A96EA69CA69EA1
:105B3000A680A850E552E5CFDAFFE7CFD9FF1200E3
:105B4000D9CFE6FFDACFE6FFE1CFD9FFE2CFDAFF28
:105B50003F0EC716C66AC56AFD0EDB50C612FC0EA4
:105B6000DB50C71293829380C68AE552E5CFDAFFF5
:065B7000E7CFD9FF12008F
:0A5B7600FE0EE3CFE9FFFF0EE3CFC0
:105B8000EAFFE9CFF3FFEACFF4FFFB0EE35003E1B6
:105B9000FC0EE35009E0FB0EE30602E2FC0EE30616
:0A5BA000FD0EE350EE6EF1D7120087
:065BAA00296A286A100EB2
:105BB000E76ED8902C362D36283629363150285CA1
:105BC0003250295805E33150285E3250295A2C2A88
:065BD000E72EF0D71200E1
:0A5BD600000EF36E00EE00F0040E66
:105BE00001D81200EA6002D0EE6AFCD7F350E960F7
:065BF0001200EE6AFCD772
:0A5BF60013EE00F023EE00F0F86A51
:105C0000259C96EC2CF020EC2EF028EC2CF0FBD709
:025C1000120080
:0E5C12000F0EC614080804E00F0EC6140B088F
:0C5C200001E1C586C7A0FED7C9501200E4
:045C2C001F0EC5146E
:0A5C3000FDE1C750040BFAE1120079
:065C3A00A6B2FED7120025
:025C4000120050
:055C420000000100005C
:020000040030CA
:0100000024DB
:010001000EF0
:010002003FBE
:010003001EDE
:010005008179
:010006008178
:010008000FE8
:01000900C036
:01000A000FE6
:01000B00A054
:01000C000FE4
:01000D0040B2
:0200000400F00A
:10000000FF00000000FF00000000FF0000FF0000F4
:10001000000000000000FF000000000000000000E1
:1000200000000000000000000000000000000000D0
:080030000000000000000001C7
:00000001FF
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/USB Device - MCHPUSB - Generic Driver - C18 - PIC18F4550.mcp
0,0 → 1,130
[HEADER]
magic_cookie={66E99B07-E706-4689-9E80-9B2582898A13}
file_version=1.0
device=PIC18F4550
[PATH_INFO]
BuildDirPolicy=BuildDirIsProjectDir
dir_src=
dir_bin=
dir_tmp=.\Objects\USB Device - Generic Driver Demo - C18 - PICDEM FSUSB
dir_sin=
dir_inc=C:\library\Microchip\Include\USB;C:\library\Microchip\USB;C:\library\Microchip\Include;.
dir_lib=C:\Program Files\Microchip\MCC18\lib
dir_lkr=
[CAT_FILTERS]
filter_src=*.asm;*.c
filter_inc=*.h;*.inc
filter_obj=*.o
filter_lib=*.lib
filter_lkr=*.lkr
[CAT_SUBFOLDERS]
subfolder_src=USB Stack
subfolder_inc=Common;USB Stack
subfolder_obj=
subfolder_lib=
subfolder_lkr=
[FILE_SUBFOLDERS]
file_000=.
file_001=.
file_002=.
file_003=.
file_004=USB Stack
file_005=USB Stack
file_006=USB Stack
file_007=.
file_008=.
file_009=.
file_010=Common
file_011=Common
file_012=USB Stack
file_013=USB Stack
file_014=USB Stack
file_015=USB Stack
file_016=USB Stack
file_017=USB Stack
file_018=USB Stack
file_019=.
file_020=.
[GENERATED_FILES]
file_000=no
file_001=no
file_002=no
file_003=no
file_004=no
file_005=no
file_006=no
file_007=no
file_008=no
file_009=no
file_010=no
file_011=no
file_012=no
file_013=no
file_014=no
file_015=no
file_016=no
file_017=no
file_018=no
file_019=no
file_020=no
[OTHER_FILES]
file_000=no
file_001=no
file_002=no
file_003=no
file_004=no
file_005=no
file_006=no
file_007=no
file_008=no
file_009=no
file_010=no
file_011=no
file_012=no
file_013=no
file_014=no
file_015=no
file_016=no
file_017=no
file_018=no
file_019=no
file_020=no
[FILE_INFO]
file_000=user.c
file_001=main.c
file_002=usb_descriptors.c
file_003=UBW-I2C.c
file_004=C:\library\Microchip\USB\usb_device.c
file_005=C:\library\Microchip\Include\USB\usb_device.h
file_006=C:\library\Microchip\Include\USB\usb_function_generic.h
file_007=HardwareProfile.h
file_008=user.h
file_009=usb_config.h
file_010=C:\library\Microchip\Include\GenericTypeDefs.h
file_011=C:\library\Microchip\Include\Compiler.h
file_012=C:\library\Microchip\Include\USB\usb_hal_pic18.h
file_013=C:\library\Microchip\Include\USB\usb.h
file_014=C:\library\Microchip\Include\USB\usb_ch9.h
file_015=C:\library\Microchip\Include\USB\usb_common.h
file_016=C:\library\Microchip\Include\USB\usb_device.h
file_017=C:\library\Microchip\Include\USB\usb_function_generic.h
file_018=C:\library\Microchip\Include\USB\usb_hal.h
file_019=HardwareProfile - PICDEM FSUSB.h
file_020=rm18f4550.lkr
[SUITE_INFO]
suite_guid={5B7D72DD-9861-47BD-9F60-2BE967BF8416}
suite_state=
[TOOL_SETTINGS]
TS{DD2213A8-6310-47B1-8376-9430CDFC013F}=
TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}=/m"$(BINDIR_)$(TARGETBASE).map" /w /o"$(TARGETBASE).cof"
TS{C2AF05E7-1416-4625-923D-E114DB6E2B96}=-Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
TS{ADE93A55-C7C7-4D4D-A4BA-59305F7D0391}=
[INSTRUMENTED_TRACE]
enable=0
transport=0
format=0
[CUSTOM_BUILD]
Pre-Build=
Pre-BuildEnabled=1
Post-Build=
Post-BuildEnabled=1
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/USB Device - MCHPUSB - Generic Driver - C18 - PIC18F4550.mcw
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/main.c
0,0 → 1,1020
/********************************************************************
FileName: main.c
Dependencies: See INCLUDES section
Processor: PIC18 or PIC24 USB Microcontrollers
Hardware: The code is natively intended to be used on the following
hardware platforms: PICDEM™ FS USB Demo Board,
PIC18F87J50 FS USB Plug-In Module, or
Explorer 16 + PIC24 USB PIM. The firmware may be
modified for use on other USB platforms by editing the
HardwareProfile.h file.
Complier: Microchip C18 (for PIC18) or C30 (for PIC24)
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
********************************************************************/
 
/** INCLUDES *******************************************************/
#include "USB/usb.h"
#include "USB/usb_function_generic.h"
#include "user.h" // Modifiable
#include "HardwareProfile.h"
 
/** CONFIGURATION **************************************************/
#if defined(PICDEM_FS_USB) // Configuration bits for PICDEM FS USB Demo Board (based on PIC18F4550)
#pragma config PLLDIV = 5 // (20 MHz crystal on PICDEM FS USB board)
#pragma config CPUDIV = OSC1_PLL2
#pragma config USBDIV = 2 // Clock source from 96MHz PLL/2
#pragma config FOSC = HSPLL_HS
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = OFF
#pragma config BOR = ON
#pragma config BORV = 3
#pragma config VREGEN = ON //USB Voltage Regulator
#pragma config WDT = OFF
#pragma config WDTPS = 32768
#pragma config MCLRE = ON
#pragma config LPT1OSC = OFF
#pragma config PBADEN = OFF
// #pragma config CCP2MX = ON
#pragma config STVREN = ON
#pragma config LVP = OFF
// #pragma config ICPRT = OFF // Dedicated In-Circuit Debug/Programming
#pragma config XINST = OFF // Extended Instruction Set
#pragma config CP0 = OFF
#pragma config CP1 = OFF
// #pragma config CP2 = OFF
// #pragma config CP3 = OFF
#pragma config CPB = OFF
// #pragma config CPD = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 = OFF
// #pragma config WRT2 = OFF
// #pragma config WRT3 = OFF
#pragma config WRTB = OFF // Boot Block Write Protection
#pragma config WRTC = OFF
// #pragma config WRTD = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
// #pragma config EBTR2 = OFF
// #pragma config EBTR3 = OFF
#pragma config EBTRB = OFF
 
#elif defined(PIC18F87J50_PIM) // Configuration bits for PIC18F87J50 FS USB Plug-In Module board
#pragma config XINST = OFF // Extended instruction set
#pragma config STVREN = ON // Stack overflow reset
#pragma config PLLDIV = 3 // (12 MHz crystal used on this board)
#pragma config WDTEN = OFF // Watch Dog Timer (WDT)
#pragma config CP0 = OFF // Code protect
#pragma config CPUDIV = OSC1 // OSC1 = divide by 1 mode
#pragma config IESO = OFF // Internal External (clock) Switchover
#pragma config FCMEN = OFF // Fail Safe Clock Monitor
#pragma config FOSC = HSPLL // Firmware must also set OSCTUNE<PLLEN> to start PLL!
#pragma config WDTPS = 32768
// #pragma config WAIT = OFF // Commented choices are
// #pragma config BW = 16 // only available on the
// #pragma config MODE = MM // 80 pin devices in the
// #pragma config EASHFT = OFF // family.
#pragma config MSSPMSK = MSK5
// #pragma config PMPMX = DEFAULT
// #pragma config ECCPMX = DEFAULT
#pragma config CCP2MX = DEFAULT
 
#elif defined(PIC18F46J50_PIM) || defined(PIC18F_STARTER_KIT_1)
#pragma config WDTEN = OFF //WDT disabled (enabled by SWDTEN bit)
#pragma config PLLDIV = 3 //Divide by 3 (12 MHz oscillator input)
#pragma config STVREN = ON //stack overflow/underflow reset enabled
#pragma config XINST = OFF //Extended instruction set disabled
#pragma config CPUDIV = OSC1 //No CPU system clock divide
#pragma config CP0 = OFF //Program memory is not code-protected
#pragma config OSC = HSPLL //HS oscillator, PLL enabled, HSPLL used by USB
#pragma config T1DIG = ON //Sec Osc clock source may be selected
#pragma config LPT1OSC = OFF //high power Timer1 mode
#pragma config FCMEN = OFF //Fail-Safe Clock Monitor disabled
#pragma config IESO = OFF //Two-Speed Start-up disabled
#pragma config WDTPS = 32768 //1:32768
#pragma config DSWDTOSC = INTOSCREF //DSWDT uses INTOSC/INTRC as clock
#pragma config RTCOSC = T1OSCREF //RTCC uses T1OSC/T1CKI as clock
#pragma config DSBOREN = OFF //Zero-Power BOR disabled in Deep Sleep
#pragma config DSWDTEN = OFF //Disabled
#pragma config DSWDTPS = 8192 //1:8,192 (8.5 seconds)
#pragma config IOL1WAY = OFF //IOLOCK bit can be set and cleared
#pragma config MSSP7B_EN = MSK7 //7 Bit address masking
#pragma config WPFP = PAGE_1 //Write Protect Program Flash Page 0
#pragma config WPEND = PAGE_0 //Start protection at page 0
#pragma config WPCFG = OFF //Write/Erase last page protect Disabled
#pragma config WPDIS = OFF //WPFP[5:0], WPEND, and WPCFG bits ignored
 
#elif defined(LOW_PIN_COUNT_USB_DEVELOPMENT_KIT)
// PIC18F14K50
#pragma config CPUDIV = NOCLKDIV
#pragma config USBDIV = OFF
#pragma config FOSC = HS
#pragma config PLLEN = ON
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRTEN = OFF
#pragma config BOREN = OFF
#pragma config BORV = 30
#pragma config WDTEN = OFF
#pragma config WDTPS = 32768
#pragma config MCLRE = OFF
#pragma config HFOFST = OFF
#pragma config STVREN = ON
#pragma config LVP = OFF
#pragma config XINST = OFF
#pragma config BBSIZ = OFF
#pragma config CP0 = OFF
#pragma config CP1 = OFF
#pragma config CPB = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 = OFF
#pragma config WRTB = OFF
#pragma config WRTC = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
#pragma config EBTRB = OFF
 
#elif defined(EXPLORER_16)
#ifdef __PIC24FJ256GB110__ //Defined by MPLAB when using 24FJ256GB110 device
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2)
_CONFIG2( 0xF7FF & IESO_OFF & FCKSM_CSDCMD & OSCIOFNC_ON & POSCMOD_HS & FNOSC_PRIPLL & PLLDIV_DIV2 & IOL1WAY_ON)
#elif defined(__PIC24FJ64GB004__)
_CONFIG1(WDTPS_PS1 & FWPSA_PR32 & WINDIS_OFF & FWDTEN_OFF & ICS_PGx1 & GWRP_OFF & GCP_OFF & JTAGEN_OFF)
_CONFIG2(POSCMOD_HS & I2C1SEL_PRI & IOL1WAY_OFF & OSCIOFNC_ON & FCKSM_CSDCMD & FNOSC_PRIPLL & PLL96MHZ_ON & PLLDIV_DIV2 & IESO_ON)
_CONFIG3(WPFP_WPFP0 & SOSCSEL_SOSC & WUTSEL_LEG & WPDIS_WPDIS & WPCFG_WPCFGDIS & WPEND_WPENDMEM)
_CONFIG4(DSWDTPS_DSWDTPS3 & DSWDTOSC_LPRC & RTCOSC_SOSC & DSBOREN_OFF & DSWDTEN_OFF)
#elif defined(__32MX460F512L__) || defined(__32MX795F512L__)
#pragma config UPLLEN = ON // USB PLL Enabled
#pragma config FPLLMUL = MUL_15 // PLL Multiplier
#pragma config UPLLIDIV = DIV_2 // USB PLL Input Divider
#pragma config FPLLIDIV = DIV_2 // PLL Input Divider
#pragma config FPLLODIV = DIV_1 // PLL Output Divider
#pragma config FPBDIV = DIV_1 // Peripheral Clock divisor
#pragma config FWDTEN = OFF // Watchdog Timer
#pragma config WDTPS = PS1 // Watchdog Timer Postscale
#pragma config FCKSM = CSDCMD // Clock Switching & Fail Safe Clock Monitor
#pragma config OSCIOFNC = OFF // CLKO Enable
#pragma config POSCMOD = HS // Primary Oscillator
#pragma config IESO = OFF // Internal/External Switch-over
#pragma config FSOSCEN = OFF // Secondary Oscillator Enable (KLO was off)
#pragma config FNOSC = PRIPLL // Oscillator Selection
#pragma config CP = OFF // Code Protect
#pragma config BWP = OFF // Boot Flash Write Protect
#pragma config PWP = OFF // Program Flash Write Protect
#pragma config ICESEL = ICS_PGx2 // ICE/ICD Comm Channel Select
#pragma config DEBUG = ON // Background Debugger Enable
#else
#error No hardware board defined, see "HardwareProfile.h" and __FILE__
#endif
#elif defined(PIC24F_STARTER_KIT)
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2)
_CONFIG2( 0xF7FF & IESO_OFF & FCKSM_CSDCMD & OSCIOFNC_ON & POSCMOD_HS & FNOSC_PRIPLL & PLLDIV_DIV3 & IOL1WAY_ON)
#elif defined(PIC24FJ256DA210_DEV_BOARD)
//_CONFIG1(FWDTEN_OFF & ICS_PGx2 & COE_OFF & GWRP_OFF & GCP_OFF & JTAGEN_OFF)
//_CONFIG2(POSCMOD_HS & IOL1WAY_ON & OSCIOFNC_ON & FCKSM_CSDCMD & FNOSC_PRIPLL & PLL96MHZ_ON & PLLDIV_DIV2 & IESO_OFF)
#elif defined(PIC32_USB_STARTER_KIT)
#pragma config UPLLEN = ON // USB PLL Enabled
#pragma config FPLLMUL = MUL_15 // PLL Multiplier
#pragma config UPLLIDIV = DIV_2 // USB PLL Input Divider
#pragma config FPLLIDIV = DIV_2 // PLL Input Divider
#pragma config FPLLODIV = DIV_1 // PLL Output Divider
#pragma config FPBDIV = DIV_1 // Peripheral Clock divisor
#pragma config FWDTEN = OFF // Watchdog Timer
#pragma config WDTPS = PS1 // Watchdog Timer Postscale
#pragma config FCKSM = CSDCMD // Clock Switching & Fail Safe Clock Monitor
#pragma config OSCIOFNC = OFF // CLKO Enable
#pragma config POSCMOD = HS // Primary Oscillator
#pragma config IESO = OFF // Internal/External Switch-over
#pragma config FSOSCEN = OFF // Secondary Oscillator Enable (KLO was off)
#pragma config FNOSC = PRIPLL // Oscillator Selection
#pragma config CP = OFF // Code Protect
#pragma config BWP = OFF // Boot Flash Write Protect
#pragma config PWP = OFF // Program Flash Write Protect
#pragma config ICESEL = ICS_PGx2 // ICE/ICD Comm Channel Select
#pragma config DEBUG = ON // Background Debugger Enable
 
#elif defined(UBW)
#pragma config PLLDIV = 5 // (20 MHz input)
#pragma config CPUDIV = OSC1_PLL2
#pragma config USBDIV = 2 // Clock source from 96MHz PLL/2
#pragma config FOSC = HSPLL_HS
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = OFF
#pragma config BOR = ON
#pragma config BORV = 3
#pragma config VREGEN = ON
#pragma config WDT = OFF
#pragma config WDTPS = 32768
#pragma config MCLRE = ON
#pragma config LPT1OSC = OFF
#pragma config PBADEN = OFF
#pragma config CCP2MX = ON
#pragma config STVREN = ON
#pragma config LVP = OFF
//#pragma config ICPRT = OFF // Dedicated In-Circuit Debug/Programming
#pragma config XINST = OFF // Extended Instruction Set
#pragma config CP0 = OFF
#pragma config CP1 = OFF
#pragma config CP2 = OFF
//#pragma config CP3 = OFF
#pragma config CPB = OFF
#pragma config CPD = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 = OFF
#pragma config WRT2 = OFF
//#pragma config WRT3 = OFF
#pragma config WRTB = ON // Boot Block Write Protection
#pragma config WRTC = OFF
#pragma config WRTD = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
#pragma config EBTR2 = OFF
//#pragma config EBTR3 = OFF
#pragma config EBTRB = OFF
 
#elif defined(UBW32)
#else
#error No hardware board defined, see "HardwareProfile.h" and __FILE__
#endif
 
 
 
/** VARIABLES ******************************************************/
#pragma udata
 
/** PRIVATE PROTOTYPES *********************************************/
static void InitializeSystem(void);
void USBDeviceTasks(void);
void YourHighPriorityISRCode(void);
void YourLowPriorityISRCode(void);
 
 
/** VECTOR REMAPPING ***********************************************/
#if defined(__18CXX)
//On PIC18 devices, addresses 0x00, 0x08, and 0x18 are used for
//the reset, high priority interrupt, and low priority interrupt
//vectors. However, the current Microchip USB bootloader
//examples are intended to occupy addresses 0x00-0x7FF or
//0x00-0xFFF depending on which bootloader is used. Therefore,
//the bootloader code remaps these vectors to new locations
//as indicated below. This remapping is only necessary if you
//wish to program the hex file generated from this project with
//the USB bootloader. If no bootloader is used, edit the
//usb_config.h file and comment out the following defines:
//#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER
//#define PROGRAMMABLE_WITH_USB_LEGACY_CUSTOM_CLASS_BOOTLOADER
#if defined(PROGRAMMABLE_WITH_USB_HID_BOOTLOADER)
#define REMAPPED_RESET_VECTOR_ADDRESS 0x1000
#define REMAPPED_HIGH_INTERRUPT_VECTOR_ADDRESS 0x1008
#define REMAPPED_LOW_INTERRUPT_VECTOR_ADDRESS 0x1018
#elif defined(PROGRAMMABLE_WITH_USB_MCHPUSB_BOOTLOADER)
#define REMAPPED_RESET_VECTOR_ADDRESS 0x800
#define REMAPPED_HIGH_INTERRUPT_VECTOR_ADDRESS 0x808
#define REMAPPED_LOW_INTERRUPT_VECTOR_ADDRESS 0x818
#else
#define REMAPPED_RESET_VECTOR_ADDRESS 0x00
#define REMAPPED_HIGH_INTERRUPT_VECTOR_ADDRESS 0x08
#define REMAPPED_LOW_INTERRUPT_VECTOR_ADDRESS 0x18
#endif
#if defined(PROGRAMMABLE_WITH_USB_HID_BOOTLOADER)||defined(PROGRAMMABLE_WITH_USB_MCHPUSB_BOOTLOADER)
extern void _startup (void); // See c018i.c in your C18 compiler dir
#pragma code REMAPPED_RESET_VECTOR = REMAPPED_RESET_VECTOR_ADDRESS
void _reset (void)
{
_asm goto _startup _endasm
}
#endif
#pragma code REMAPPED_HIGH_INTERRUPT_VECTOR = REMAPPED_HIGH_INTERRUPT_VECTOR_ADDRESS
void Remapped_High_ISR (void)
{
_asm goto YourHighPriorityISRCode _endasm
}
#pragma code REMAPPED_LOW_INTERRUPT_VECTOR = REMAPPED_LOW_INTERRUPT_VECTOR_ADDRESS
void Remapped_Low_ISR (void)
{
_asm goto YourLowPriorityISRCode _endasm
}
#if defined(PROGRAMMABLE_WITH_USB_HID_BOOTLOADER)||defined(PROGRAMMABLE_WITH_USB_MCHPUSB_BOOTLOADER)
//Note: If this project is built while one of the bootloaders has
//been defined, but then the output hex file is not programmed with
//the bootloader, addresses 0x08 and 0x18 would end up programmed with 0xFFFF.
//As a result, if an actual interrupt was enabled and occured, the PC would jump
//to 0x08 (or 0x18) and would begin executing "0xFFFF" (unprogrammed space). This
//executes as nop instructions, but the PC would eventually reach the REMAPPED_RESET_VECTOR_ADDRESS
//(0x1000 or 0x800, depending upon bootloader), and would execute the "goto _startup". This
//would effective reset the application.
//To fix this situation, we should always deliberately place a
//"goto REMAPPED_HIGH_INTERRUPT_VECTOR_ADDRESS" at address 0x08, and a
//"goto REMAPPED_LOW_INTERRUPT_VECTOR_ADDRESS" at address 0x18. When the output
//hex file of this project is programmed with the bootloader, these sections do not
//get bootloaded (as they overlap the bootloader space). If the output hex file is not
//programmed using the bootloader, then the below goto instructions do get programmed,
//and the hex file still works like normal. The below section is only required to fix this
//scenario.
#pragma code HIGH_INTERRUPT_VECTOR = 0x08
void High_ISR (void)
{
_asm goto REMAPPED_HIGH_INTERRUPT_VECTOR_ADDRESS _endasm
}
#pragma code LOW_INTERRUPT_VECTOR = 0x18
void Low_ISR (void)
{
_asm goto REMAPPED_LOW_INTERRUPT_VECTOR_ADDRESS _endasm
}
#endif //end of "#if defined(PROGRAMMABLE_WITH_USB_HID_BOOTLOADER)||defined(PROGRAMMABLE_WITH_USB_LEGACY_CUSTOM_CLASS_BOOTLOADER)"
 
#pragma code
//These are your actual interrupt handling routines.
#pragma interrupt YourHighPriorityISRCode
void YourHighPriorityISRCode()
{
//Check which interrupt flag caused the interrupt.
//Service the interrupt
//Clear the interrupt flag
//Etc.
#if defined(USB_INTERRUPT)
USBDeviceTasks();
#endif
} //This return will be a "retfie fast", since this is in a #pragma interrupt section
#pragma interruptlow YourLowPriorityISRCode
void YourLowPriorityISRCode()
{
//Check which interrupt flag caused the interrupt.
//Service the interrupt
//Clear the interrupt flag
//Etc.
} //This return will be a "retfie", since this is in a #pragma interruptlow section
 
#elif defined(__C30__)
#if defined(PROGRAMMABLE_WITH_USB_HID_BOOTLOADER)
/*
* ISR JUMP TABLE
*
* It is necessary to define jump table as a function because C30 will
* not store 24-bit wide values in program memory as variables.
*
* This function should be stored at an address where the goto instructions
* line up with the remapped vectors from the bootloader's linker script.
*
* For more information about how to remap the interrupt vectors,
* please refer to AN1157. An example is provided below for the T2
* interrupt with a bootloader ending at address 0x1400
*/
// void __attribute__ ((address(0x1404))) ISRTable(){
//
// asm("reset"); //reset instruction to prevent runaway code
// asm("goto %0"::"i"(&_T2Interrupt)); //T2Interrupt's address
// }
#endif
#endif
 
 
 
 
/** DECLARATIONS ***************************************************/
#pragma code
 
/******************************************************************************
* Function: void main(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: Main program entry point.
*
* Note: None
*******************************************************************/
 
#if defined(__18CXX)
void main(void)
#else
int main(void)
#endif
{
InitializeSystem();
 
#if defined(USB_INTERRUPT)
USBDeviceAttach();
#endif
 
while(1)
{
#if defined(USB_POLLING)
// Check bus status and service USB interrupts.
USBDeviceTasks(); // Interrupt or polling method. If using polling, must call
// this function periodically. This function will take care
// of processing and responding to SETUP transactions
// (such as during the enumeration process when you first
// plug in). USB hosts require that USB devices should accept
// and process SETUP packets in a timely fashion. Therefore,
// when using polling, this function should be called
// frequently (such as once about every 100 microseconds) at any
// time that a SETUP packet might reasonably be expected to
// be sent by the host to your device. In most cases, the
// USBDeviceTasks() function does not take very long to
// execute (~50 instruction cycles) before it returns.
#endif
 
// Application-specific tasks.
// Application related code may be added here, or in the ProcessIO() function.
ProcessIO();
}//end while
}//end main
 
 
/********************************************************************
* Function: static void InitializeSystem(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: InitializeSystem is a centralize initialization
* routine. All required USB initialization routines
* are called from here.
*
* User application initialization routine should
* also be called from here.
*
* Note: None
*******************************************************************/
static void InitializeSystem(void)
{
#if (defined(__18CXX) & !defined(PIC18F87J50_PIM))
ADCON1 |= 0x0F; // Default all pins to digital
#elif defined(__C30__)
#if defined(PIC24FJ256DA210_DEV_BOARD)
ANSA = 0x0000;
ANSB = 0x0000;
ANSC = 0x0000;
ANSD = 0x0000;
ANSE = 0x0000;
ANSF = 0x0000;
ANSG = 0x0000;
#else
AD1PCFGL = 0xFFFF;
#endif
#elif defined(__C32__)
AD1PCFG = 0xFFFF;
#endif
 
#if defined(PIC18F87J50_PIM) || defined(PIC18F46J50_PIM) || defined(PIC18F_STARTER_KIT_1)
//On the PIC18F87J50 Family of USB microcontrollers, the PLL will not power up and be enabled
//by default, even if a PLL enabled oscillator configuration is selected (such as HS+PLL).
//This allows the device to power up at a lower initial operating frequency, which can be
//advantageous when powered from a source which is not gauranteed to be adequate for 48MHz
//operation. On these devices, user firmware needs to manually set the OSCTUNE<PLLEN> bit to
//power up the PLL.
{
unsigned int pll_startup_counter = 600;
OSCTUNEbits.PLLEN = 1; //Enable the PLL and wait 2+ms until the PLL locks before enabling USB module
while(pll_startup_counter--);
}
//Device switches over automatically to PLL output after PLL is locked and ready.
#endif
 
#if defined(PIC18F87J50_PIM)
//Configure all I/O pins to use digital input buffers. The PIC18F87J50 Family devices
//use the ANCONx registers to control this, which is different from other devices which
//use the ADCON1 register for this purpose.
WDTCONbits.ADSHR = 1; // Select alternate SFR location to access ANCONx registers
ANCON0 = 0xFF; // Default all pins to digital
ANCON1 = 0xFF; // Default all pins to digital
WDTCONbits.ADSHR = 0; // Select normal SFR locations
#endif
 
#if defined(PIC18F46J50_PIM) || defined(PIC18F_STARTER_KIT_1)
//Configure all I/O pins to use digital input buffers.
ANCON0 = 0x7F; // all pins to digital except AN7
ANCON1 = 0xBF; // Default all pins to digital. Bandgap on.
#endif
#if defined(PIC24FJ64GB004_PIM) || defined(PIC24FJ256DA210_DEV_BOARD)
//On the PIC24FJ64GB004 Family of USB microcontrollers, the PLL will not power up and be enabled
//by default, even if a PLL enabled oscillator configuration is selected (such as HS+PLL).
//This allows the device to power up at a lower initial operating frequency, which can be
//advantageous when powered from a source which is not gauranteed to be adequate for 32MHz
//operation. On these devices, user firmware needs to manually set the CLKDIV<PLLEN> bit to
//power up the PLL.
{
unsigned int pll_startup_counter = 600;
CLKDIVbits.PLLEN = 1;
while(pll_startup_counter--);
}
 
//Device switches over automatically to PLL output after PLL is locked and ready.
#endif
 
 
// The USB specifications require that USB peripheral devices must never source
// current onto the Vbus pin. Additionally, USB peripherals should not source
// current on D+ or D- when the host/hub is not actively powering the Vbus line.
// When designing a self powered (as opposed to bus powered) USB peripheral
// device, the firmware should make sure not to turn on the USB module and D+
// or D- pull up resistor unless Vbus is actively powered. Therefore, the
// firmware needs some means to detect when Vbus is being powered by the host.
// A 5V tolerant I/O pin can be connected to Vbus (through a resistor), and
// can be used to detect when Vbus is high (host actively powering), or low
// (host is shut down or otherwise not supplying power). The USB firmware
// can then periodically poll this I/O pin to know when it is okay to turn on
// the USB module/D+/D- pull up resistor. When designing a purely bus powered
// peripheral device, it is not possible to source current on D+ or D- when the
// host is not actively providing power on Vbus. Therefore, implementing this
// bus sense feature is optional. This firmware can be made to use this bus
// sense feature by making sure "USE_USB_BUS_SENSE_IO" has been defined in the
// HardwareProfile.h file.
#if defined(USE_USB_BUS_SENSE_IO)
tris_usb_bus_sense = INPUT_PIN; // See HardwareProfile.h
#endif
// If the host PC sends a GetStatus (device) request, the firmware must respond
// and let the host know if the USB peripheral device is currently bus powered
// or self powered. See chapter 9 in the official USB specifications for details
// regarding this request. If the peripheral device is capable of being both
// self and bus powered, it should not return a hard coded value for this request.
// Instead, firmware should check if it is currently self or bus powered, and
// respond accordingly. If the hardware has been configured like demonstrated
// on the PICDEM FS USB Demo Board, an I/O pin can be polled to determine the
// currently selected power source. On the PICDEM FS USB Demo Board, "RA2"
// is used for this purpose. If using this feature, make sure "USE_SELF_POWER_SENSE_IO"
// has been defined in HardwareProfile - (platform).h, and that an appropriate I/O pin
// has been mapped to it.
#if defined(USE_SELF_POWER_SENSE_IO)
tris_self_power = INPUT_PIN; // See HardwareProfile
#endif
UserInit();
 
USBDeviceInit(); //usb_device.c. Initializes USB module SFRs and firmware
//variables to known states.
}//end InitializeSystem
 
// ******************************************************************************************************
// ************** USB Callback Functions ****************************************************************
// ******************************************************************************************************
// The USB firmware stack will call the callback functions USBCBxxx() in response to certain USB related
// events. For example, if the host PC is powering down, it will stop sending out Start of Frame (SOF)
// packets to your device. In response to this, all USB devices are supposed to decrease their power
// consumption from the USB Vbus to <2.5mA each. The USB module detects this condition (which according
// to the USB specifications is 3+ms of no bus activity/SOF packets) and then calls the USBCBSuspend()
// function. You should modify these callback functions to take appropriate actions for each of these
// conditions. For example, in the USBCBSuspend(), you may wish to add code that will decrease power
// consumption from Vbus to <2.5mA (such as by clock switching, turning off LEDs, putting the
// microcontroller to sleep, etc.). Then, in the USBCBWakeFromSuspend() function, you may then wish to
// add code that undoes the power saving things done in the USBCBSuspend() function.
 
// The USBCBSendResume() function is special, in that the USB stack will not automatically call this
// function. This function is meant to be called from the application firmware instead. See the
// additional comments near the function.
 
/******************************************************************************
* Function: void USBCBSuspend(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: Call back that is invoked when a USB suspend is detected
*
* Note: None
*****************************************************************************/
void USBCBSuspend(void)
{
//Example power saving code. Insert appropriate code here for the desired
//application behavior. If the microcontroller will be put to sleep, a
//process similar to that shown below may be used:
//ConfigureIOPinsForLowPower();
//SaveStateOfAllInterruptEnableBits();
//DisableAllInterruptEnableBits();
//EnableOnlyTheInterruptsWhichWillBeUsedToWakeTheMicro(); //should enable at least USBActivityIF as a wake source
//Sleep();
//RestoreStateOfAllPreviouslySavedInterruptEnableBits(); //Preferrably, this should be done in the USBCBWakeFromSuspend() function instead.
//RestoreIOPinsToNormal(); //Preferrably, this should be done in the USBCBWakeFromSuspend() function instead.
 
//IMPORTANT NOTE: Do not clear the USBActivityIF (ACTVIF) bit here. This bit is
//cleared inside the usb_device.c file. Clearing USBActivityIF here will cause
//things to not work as intended.
 
#if defined(__C30__)
#if 0
U1EIR = 0xFFFF;
U1IR = 0xFFFF;
U1OTGIR = 0xFFFF;
IFS5bits.USB1IF = 0;
IEC5bits.USB1IE = 1;
U1OTGIEbits.ACTVIE = 1;
U1OTGIRbits.ACTVIF = 1;
Sleep();
#endif
#endif
}
 
 
/******************************************************************************
* Function: void _USB1Interrupt(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: This function is called when the USB interrupt bit is set
* In this example the interrupt is only used when the device
* goes to sleep when it receives a USB suspend command
*
* Note: None
*****************************************************************************/
#if 0
void __attribute__ ((interrupt)) _USB1Interrupt(void)
{
#if !defined(self_powered)
if(U1OTGIRbits.ACTVIF)
{
IEC5bits.USB1IE = 0;
U1OTGIEbits.ACTVIE = 0;
IFS5bits.USB1IF = 0;
//USBClearInterruptFlag(USBActivityIFReg,USBActivityIFBitNum);
USBClearInterruptFlag(USBIdleIFReg,USBIdleIFBitNum);
//USBSuspendControl = 0;
}
#endif
}
#endif
 
/******************************************************************************
* Function: void USBCBWakeFromSuspend(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: The host may put USB peripheral devices in low power
* suspend mode (by "sending" 3+ms of idle). Once in suspend
* mode, the host may wake the device back up by sending non-
* idle state signalling.
*
* This call back is invoked when a wakeup from USB suspend
* is detected.
*
* Note: None
*****************************************************************************/
void USBCBWakeFromSuspend(void)
{
// If clock switching or other power savings measures were taken when
// executing the USBCBSuspend() function, now would be a good time to
// switch back to normal full power run mode conditions. The host allows
// a few milliseconds of wakeup time, after which the device must be
// fully back to normal, and capable of receiving and processing USB
// packets. In order to do this, the USB module must receive proper
// clocking (IE: 48MHz clock must be available to SIE for full speed USB
// operation).
}
 
/********************************************************************
* Function: void USBCB_SOF_Handler(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: The USB host sends out a SOF packet to full-speed
* devices every 1 ms. This interrupt may be useful
* for isochronous pipes. End designers should
* implement callback routine as necessary.
*
* Note: None
*******************************************************************/
void USBCB_SOF_Handler(void)
{
// No need to clear UIRbits.SOFIF to 0 here.
// Callback caller is already doing that.
}
 
/*******************************************************************
* Function: void USBCBErrorHandler(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: The purpose of this callback is mainly for
* debugging during development. Check UEIR to see
* which error causes the interrupt.
*
* Note: None
*******************************************************************/
void USBCBErrorHandler(void)
{
// No need to clear UEIR to 0 here.
// Callback caller is already doing that.
 
// Typically, user firmware does not need to do anything special
// if a USB error occurs. For example, if the host sends an OUT
// packet to your device, but the packet gets corrupted (ex:
// because of a bad connection, or the user unplugs the
// USB cable during the transmission) this will typically set
// one or more USB error interrupt flags. Nothing specific
// needs to be done however, since the SIE will automatically
// send a "NAK" packet to the host. In response to this, the
// host will normally retry to send the packet again, and no
// data loss occurs. The system will typically recover
// automatically, without the need for application firmware
// intervention.
// Nevertheless, this callback function is provided, such as
// for debugging purposes.
}
 
 
/*******************************************************************
* Function: void USBCBCheckOtherReq(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: When SETUP packets arrive from the host, some
* firmware must process the request and respond
* appropriately to fulfill the request. Some of
* the SETUP packets will be for standard
* USB "chapter 9" (as in, fulfilling chapter 9 of
* the official USB specifications) requests, while
* others may be specific to the USB device class
* that is being implemented. For example, a HID
* class device needs to be able to respond to
* "GET REPORT" type of requests. This
* is not a standard USB chapter 9 request, and
* therefore not handled by usb_device.c. Instead
* this request should be handled by class specific
* firmware, such as that contained in usb_function_hid.c.
*
* Note: None
*****************************************************************************/
void USBCBCheckOtherReq(void)
{
USBCheckUBWRequest();
}//end
 
 
/*******************************************************************
* Function: void USBCBStdSetDscHandler(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: The USBCBStdSetDscHandler() callback function is
* called when a SETUP, bRequest: SET_DESCRIPTOR request
* arrives. Typically SET_DESCRIPTOR requests are
* not used in most applications, and it is
* optional to support this type of request.
*
* Note: None
*****************************************************************************/
void USBCBStdSetDscHandler(void)
{
// Must claim session ownership if supporting this request
}//end
 
 
/******************************************************************************
* Function: void USBCBInitEP(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: This function is called when the device becomes
* initialized, which occurs after the host sends a
* SET_CONFIGURATION (wValue not = 0) request. This
* callback function should initialize the endpoints
* for the device's usage according to the current
* configuration.
*
* Note: None
*****************************************************************************/
void USBCBInitEP(void)
{
}
 
/********************************************************************
* Function: void USBCBSendResume(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: The USB specifications allow some types of USB
* peripheral devices to wake up a host PC (such
* as if it is in a low power suspend to RAM state).
* This can be a very useful feature in some
* USB applications, such as an Infrared remote
* control receiver. If a user presses the "power"
* button on a remote control, it is nice that the
* IR receiver can detect this signalling, and then
* send a USB "command" to the PC to wake up.
*
* The USBCBSendResume() "callback" function is used
* to send this special USB signalling which wakes
* up the PC. This function may be called by
* application firmware to wake up the PC. This
* function should only be called when:
*
* 1. The USB driver used on the host PC supports
* the remote wakeup capability.
* 2. The USB configuration descriptor indicates
* the device is remote wakeup capable in the
* bmAttributes field.
* 3. The USB host PC is currently sleeping,
* and has previously sent your device a SET
* FEATURE setup packet which "armed" the
* remote wakeup capability.
*
* This callback should send a RESUME signal that
* has the period of 1-15ms.
*
* Note: Interrupt vs. Polling
* -Primary clock
* -Secondary clock ***** MAKE NOTES ABOUT THIS *******
* > Can switch to primary first by calling USBCBWakeFromSuspend()
* The modifiable section in this routine should be changed
* to meet the application needs. Current implementation
* temporary blocks other functions from executing for a
* period of 1-13 ms depending on the core frequency.
*
* According to USB 2.0 specification section 7.1.7.7,
* "The remote wakeup device must hold the resume signaling
* for at lest 1 ms but for no more than 15 ms."
* The idea here is to use a delay counter loop, using a
* common value that would work over a wide range of core
* frequencies.
* That value selected is 1800. See table below:
* ==========================================================
* Core Freq(MHz) MIP RESUME Signal Period (ms)
* ==========================================================
* 48 12 1.05
* 4 1 12.6
* ==========================================================
* * These timing could be incorrect when using code
* optimization or extended instruction mode,
* or when having other interrupts enabled.
* Make sure to verify using the MPLAB SIM's Stopwatch
* and verify the actual signal on an oscilloscope.
*******************************************************************/
void USBCBSendResume(void)
{
static WORD delay_count;
USBResumeControl = 1; // Start RESUME signaling
delay_count = 1800U; // Set RESUME line for 1-13 ms
do
{
delay_count--;
}while(delay_count);
USBResumeControl = 0;
}
 
 
/*******************************************************************
* Function: BOOL USER_USB_CALLBACK_EVENT_HANDLER(
* USB_EVENT event, void *pdata, WORD size)
*
* PreCondition: None
*
* Input: USB_EVENT event - the type of event
* void *pdata - pointer to the event data
* WORD size - size of the event data
*
* Output: None
*
* Side Effects: None
*
* Overview: This function is called from the USB stack to
* notify a user application that a USB event
* occured. This callback is in interrupt context
* when the USB_INTERRUPT option is selected.
*
* Note: None
*******************************************************************/
BOOL USER_USB_CALLBACK_EVENT_HANDLER(USB_EVENT event, void *pdata, WORD size)
{
switch(event)
{
case EVENT_CONFIGURED:
USBCBInitEP();
break;
case EVENT_SET_DESCRIPTOR:
USBCBStdSetDscHandler();
break;
case EVENT_EP0_REQUEST:
USBCBCheckOtherReq();
break;
case EVENT_SOF:
USBCB_SOF_Handler();
break;
case EVENT_SUSPEND:
USBCBSuspend();
break;
case EVENT_RESUME:
USBCBWakeFromSuspend();
break;
case EVENT_BUS_ERROR:
USBCBErrorHandler();
break;
case EVENT_TRANSFER:
Nop();
break;
default:
break;
}
return TRUE;
}
/** EOF main.c ***************************************************************/
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/CleanUp.bat
0,0 → 1,92
@echo off
REM Remove files generated by compiler in this directory
REM and all subdirectories.
 
echo Removing *.$$$ files...
del *.$$$ /f /q /s
echo.
 
echo Removing *.bkx files...
del *.bkx /f /q /s
echo.
 
echo Removing *.cce files...
del *.cce /f /q /s
echo.
 
echo Removing *.cod files...
del *.cod /f /q /s
echo.
 
echo Removing *.cof files...
del *.cof /f /q /s
echo.
 
echo Removing *.err files...
del *.err /f /q /s
echo.
 
echo Removing *.hex files...
del *.hex /f /q /s
echo.
 
echo Removing *.i files...
del *.i /f /q /s
echo.
 
echo Removing *.lde files...
del *.lde /f /q /s
echo.
 
echo Removing *.lst files...
del *.lst /f /q /s
echo.
 
echo Removing *.obj files...
del *.obj /f /q /s
echo.
 
echo Removing *.o files...
del *.o /f /q /s
echo.
 
echo Removing *.rlf files...
del *.rlf /f /q /s
echo.
 
echo Removing *.sym files...
del *.sym /f /q /s
echo.
 
echo Removing *.sdb files...
del *.sdb /f /q /s
echo.
 
echo Removing *.wat files...
del *.wat /f /q /s
echo.
 
echo Removing *.mcs files...
del *.mcs /f /q /s
echo.
 
echo Removing *.mptags files...
del *.mptags /f /q /s
echo.
 
echo Removing *.tagsrc files...
del *.tagsrc /f /q /s
echo.
 
echo Removing *.map files...
del *.map /f /q /s
echo.
 
 
echo Removing *.elf files...
del *.elf /f /q /s
echo.
 
rd Objects /S /Q
 
echo Done.
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/HardwareProfile - Low Pin Count USB Development Kit.h
0,0 → 1,135
/********************************************************************
FileName: HardwareProfile - Low Pin Count USB Development Kit.h
Dependencies: See INCLUDES section
Processor: PIC18 or PIC24 USB Microcontrollers
Hardware: Low Pin Count USB Development Kit
Compiler: Microchip C18
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
2.3 09/15/2008 Broke out each hardware platform into its own
"HardwareProfile - xxx.h" file
********************************************************************/
 
#ifndef HARDWARE_PROFILE_LOW_PIN_COUNT_USB_DEVELOPMENT_KIT_H
#define HARDWARE_PROFILE_LOW_PIN_COUNT_USB_DEVELOPMENT_KIT_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.
 
//#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
 
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/******** Application specific definitions *************************/
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
 
//Uncomment the following line to make the output HEX of this
// project work with the HID Bootloader
#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER
 
/** 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 LOW_PIN_COUNT_USB_DEVELOPMENT_KIT
#define LOW_PIN_COUNT_USB_DEVELOPMENT_KIT
#define CLOCK_FREQ 48000000
/** LED ************************************************************/
#define mInitAllLEDs() LATC &= 0xF0; TRISC &= 0xF0;
#define mLED_1 LATCbits.LATC0
#define mLED_2 LATCbits.LATC1
#define mLED_3 LATCbits.LATC2
#define mLED_4 LATCbits.LATC3
#define mGetLED_1() mLED_1
#define mGetLED_2() mLED_2
#define mGetLED_3() mLED_3
#define mGetLED_4() mLED_4
 
#define mLED_1_On() mLED_1 = 1;
#define mLED_2_On() mLED_2 = 1;
#define mLED_3_On() mLED_3 = 1;
#define mLED_4_On() mLED_4 = 1;
#define mLED_1_Off() mLED_1 = 0;
#define mLED_2_Off() mLED_2 = 0;
#define mLED_3_Off() mLED_3 = 0;
#define mLED_4_Off() mLED_4 = 0;
#define mLED_1_Toggle() mLED_1 = !mLED_1;
#define mLED_2_Toggle() mLED_2 = !mLED_2;
#define mLED_3_Toggle() mLED_3 = !mLED_3;
#define mLED_4_Toggle() mLED_4 = !mLED_4;
/** SWITCH *********************************************************/
#define mInitSwitch2() //TRISAbits.TRISA3=1
//only one switch available so double duty
#define mInitSwitch3() //TRISAbits.TRISA3=1
#define sw2 PORTAbits.RA3
#define sw3 PORTAbits.RA3
#define mInitAllSwitches() mInitSwitch2();
/** POT ************************************************************/
#define mInitPOT() {TRISBbits.TRISB4=1;ADCON0=0x29;ADCON1=0;ADCON2=0x3E;ADCON2bits.ADFM = 1;}
 
#endif //HARDWARE_PROFILE_LOW_PIN_COUNT_USB_DEVELOPMENT_KIT_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/HardwareProfile - PIC18F46J50 PIM.h
0,0 → 1,130
/********************************************************************
FileName: HardwareProfile - PIC18F46J50 PIM.h
Dependencies: See INCLUDES section
Processor: PIC18 USB Microcontrollers
Hardware: PIC18F46J50 PIM
Compiler: Microchip C18
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
2.3 09/15/2008 Broke out each hardware platform into its own
"HardwareProfile - xxx.h" file
********************************************************************/
 
#ifndef HARDWARE_PROFILE_PIC18F46J50_PIM_H
#define HARDWARE_PROFILE_PIC18F46J50_PIM_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.
 
//#define USE_SELF_POWER_SENSE_IO
#define tris_self_power TRISCbits.TRISC2 // Input
#define self_power 1
 
//#define USE_USB_BUS_SENSE_IO
#define tris_usb_bus_sense TRISCbits.TRISC2 // Input
#define USB_BUS_SENSE 1
//Uncomment this to make the output HEX of this project
// to be able to be bootloaded using 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 PIC18F46J50_PIM
#define PIC18F46J50_PIM
#define CLOCK_FREQ 48000000
#define GetSystemClock() CLOCK_FREQ
#define GetInstructionClock() GetSystemClock()
 
/** LED ************************************************************/
#define mInitAllLEDs() LATE &= 0xFC; TRISE &= 0xFC;
#define mLED_1 LATEbits.LATE0
#define mLED_2 LATEbits.LATE1
#define mLED_3 mLED_1
#define mLED_4 mLED_2
#define mGetLED_1() mLED_1
#define mGetLED_2() mLED_2
#define mGetLED_3() mLED_3
#define mGetLED_4() mLED_4
 
#define mLED_1_On() mLED_1 = 1;
#define mLED_2_On() mLED_2 = 1;
#define mLED_3_On() mLED_3 = 1;
#define mLED_4_On() mLED_4 = 1;
#define mLED_1_Off() mLED_1 = 0;
#define mLED_2_Off() mLED_2 = 0;
#define mLED_3_Off() mLED_3 = 0;
#define mLED_4_Off() mLED_4 = 0;
#define mLED_1_Toggle() mLED_1 = !mLED_1;
#define mLED_2_Toggle() mLED_2 = !mLED_2;
#define mLED_3_Toggle() mLED_3 = !mLED_3;
#define mLED_4_Toggle() mLED_4 = !mLED_4;
/** SWITCH *********************************************************/
#define mInitSwitch2() TRISBbits.TRISB2=1;
#define mInitSwitch3() mInitSwitch2();
#define mInitAllSwitches() mInitSwitch2();
#define sw2 PORTBbits.RB2
#define sw3 PORTBbits.RB2
 
/** POT ************************************************************/
#define mInitPOT() {TRISAbits.TRISA0=1; \
ANCON0bits.PCFG0 = 0; \
ADCON0=0x01; \
ADCON1=0xBE;} // POT on HPC Explorer
 
#endif //HARDWARE_PROFILE_PIC18F46J50_PIM_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/HardwareProfile - PIC18F87J50 PIM.h
0,0 → 1,150
/********************************************************************
FileName: HardwareProfile - PIC18F87J50 PIM.h
Dependencies: See INCLUDES section
Processor: PIC18 USB Microcontrollers
Hardware: PIC18F87J50 PIM
Compiler: Microchip C18
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
2.3 09/15/2008 Broke out each hardware platform into its own
"HardwareProfile - xxx.h" file
********************************************************************/
 
#ifndef HARDWARE_PROFILE_PIC18F87J50_PIM_H
#define HARDWARE_PROFILE_PIC18F87J50_PIM_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.
 
/** USB ************************************************************/
//The PIC18F87J50 FS USB Plug-In Module supports the USE_USB_BUS_SENSE_IO
//feature. The USE_SELF_POWER_SENSE_IO feature is not implemented on the
//circuit board, so the USE_SELF_POWER_SENSE_IO define should always be
//commented for this hardware platform.
 
//#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 //JP1 must be in R-U position to use this feature on this board
#define tris_usb_bus_sense TRISBbits.TRISB5 // Input
#if defined(USE_USB_BUS_SENSE_IO)
#define USB_BUS_SENSE PORTBbits.RB5
#else
#define USB_BUS_SENSE 1
#endif
//Uncomment this to make the output HEX of this project
// to be able to be bootloaded using 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 PIC18F87J50_PIM
#define PIC18F87J50_PIM
#define CLOCK_FREQ 48000000
#define GetSystemClock() CLOCK_FREQ
#define GetInstructionClock() CLOCK_FREQ
/** LED ************************************************************/
#define mInitAllLEDs() {LATE &= 0xFC; TRISE &= 0xFC; LATD &= 0xF3; TRISD &= 0xF3;}
#define mLED_1 LATEbits.LATE0
#define mLED_2 LATEbits.LATE1
#define mLED_3 LATDbits.LATD2
#define mLED_4 LATDbits.LATD3
#define mGetLED_1() mLED_1
#define mGetLED_2() mLED_2
#define mGetLED_3() mLED_3
#define mGetLED_4() mLED_4
 
#define mLED_1_On() mLED_1 = 1;
#define mLED_2_On() mLED_2 = 1;
#define mLED_3_On() mLED_3 = 1;
#define mLED_4_On() mLED_4 = 1;
#define mLED_1_Off() mLED_1 = 0;
#define mLED_2_Off() mLED_2 = 0;
#define mLED_3_Off() mLED_3 = 0;
#define mLED_4_Off() mLED_4 = 0;
#define mLED_1_Toggle() mLED_1 = !mLED_1;
#define mLED_2_Toggle() mLED_2 = !mLED_2;
#define mLED_3_Toggle() mLED_3 = !mLED_3;
#define mLED_4_Toggle() mLED_4 = !mLED_4;
/** SWITCH *********************************************************/
#define mInitAllSwitches() TRISBbits.TRISB4=1;
#define mInitSwitch2() TRISBbits.TRISB4=1;
#define mInitSwitch3() TRISBbits.TRISB4=1;
#define sw2 PORTBbits.RB4
#define sw3 PORTBbits.RB4
/** POT ************************************************************/
#define mInitPOT() {TRISAbits.TRISA0=1; \
WDTCONbits.ADSHR = 1; \
ANCON0bits.PCFG0 = 1; \
WDTCONbits.ADSHR = 0; \
ADCON0=0x01; \
ADCON1=0xBE;} // POT on HPC Explorer
/** I 2 C T E M P S E N S E *************************************/
#define mInitI2CPins() TRISC |= 0x18; // RC3 and RC4 are I2C
 
#endif //HARDWARE_PROFILE_PIC18F87J50_PIM_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/HardwareProfile - PIC24F Starter Kit.h
0,0 → 1,129
/********************************************************************
FileName: HardwareProfile - PIC24F Starter Kit.h
Dependencies: See INCLUDES section
Processor: PIC24FJ256GB106
Hardware: PIC24F Starter Kit
Compiler: Microchip C30
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
2.3 09/15/2008 Broke out each hardware platform into its own
"HardwareProfile - xxx.h" file
********************************************************************/
 
#ifndef HARDWARE_PROFILE_PIC24F_STARTER_KIT_H
#define HARDWARE_PROFILE_PIC24F_STARTER_KIT_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.
 
//#define USE_SELF_POWER_SENSE_IO
#define tris_self_power TRISAbits.TRISA2 // Input
#define self_power 1
 
//#define USE_USB_BUS_SENSE_IO
#define tris_usb_bus_sense U1OTGSTATbits.SESVD //TRISBbits.TRISB5 // Input
#define USB_BUS_SENSE U1OTGSTATbits.SESVD
//Uncomment this to make the output HEX of this project
// to be able to be bootloaded using the HID bootloader
#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER
 
//If the application is going to be used with the HID bootloader
// then this will provide a function for the application to
// enter the bootloader from the application (optional)
#if defined(PROGRAMMABLE_WITH_USB_HID_BOOTLOADER)
#define EnterBootloader() __asm__("goto 0x400")
#endif
 
 
 
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/******** 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 PIC24F_STARTER_KIT
#define PIC24F_STARTER_KIT
#define CLOCK_FREQ 32000000
/** LED ************************************************************/
#define mInitAllLEDs() LATG &= 0xFE1F; TRISG &= 0xFE1F; LATF &= 0xFFCF; TRISF &= 0xFFCF; //G6,7,8,9 and F4,5
#define mGetLED_1() (TRISG & ~0x0180?1:0)
#define mGetLED_2() (TRISG & ~0x0060?1:0)
#define mGetLED_3() (TRISF & ~0x0030?1:0)
#define mGetLED_4()
 
#define mLED_1_On() TRISG |= 0x0180;
#define mLED_2_On() TRISG |= 0x0060;
#define mLED_3_On() TRISF |= 0x0030;
#define mLED_4_On()
#define mLED_1_Off() TRISG &= ~0x0180;
#define mLED_2_Off() TRISG &= ~0x0060;
#define mLED_3_Off() TRISF &= ~0x0030;
#define mLED_4_Off()
#define mLED_1_Toggle() TRISG ^= 0x0180;
#define mLED_2_Toggle() TRISG ^= 0x0060;
#define mLED_3_Toggle() TRISF ^= 0x0030;
#define mLED_4_Toggle()
/** SWITCH *********************************************************/
#define mInitSwitch2() TRISDbits.TRISD6=1;
#define mInitSwitch3() TRISDbits.TRISD7=1;
#define mInitAllSwitches() mInitSwitch2();mInitSwitch3();
#define sw2 PORTDbits.RD6
#define sw3 PORTDbits.RD7
 
/** POT ************************************************************/
#define mInitPOT() {AD1PCFGLbits.PCFG0 = 0; AD1CON2bits.VCFG = 0x0; AD1CON3bits.ADCS = 0xFF; AD1CON1bits.SSRC = 0x0; AD1CON3bits.SAMC = 0b00001; AD1CON1bits.FORM = 0b00; AD1CON2bits.SMPI = 0x0; AD1CON1bits.ADON = 1;}
 
#endif //HARDWARE_PROFILE_PIC24F_STARTER_KIT_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/HardwareProfile - PIC24FJ256GB110 PIM.h
0,0 → 1,136
/********************************************************************
FileName: HardwareProfile - PIC24FJ256GB110 PIM.h
Dependencies: See INCLUDES section
Processor: PIC24FJ256GB110
Hardware: PIC24FJ256GB110 PIM
Compiler: Microchip C30
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
2.3 09/15/2008 Broke out each hardware platform into its own
"HardwareProfile - xxx.h" file
********************************************************************/
 
#ifndef HARDWARE_PROFILE_PIC24FJ256GB110_PIM_H
#define HARDWARE_PROFILE_PIC24FJ256GB110_PIM_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.
 
//#define USE_SELF_POWER_SENSE_IO
#define tris_self_power TRISAbits.TRISA2 // Input
#define self_power 1
 
//#define USE_USB_BUS_SENSE_IO
#define tris_usb_bus_sense TRISBbits.TRISB5 // Input
#define USB_BUS_SENSE 1
//Uncomment this to make the output HEX of this project
// to be able to be bootloaded using the HID bootloader
#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER
 
//If the application is going to be used with the HID bootloader
// then this will provide a function for the application to
// enter the bootloader from the application (optional)
#if defined(PROGRAMMABLE_WITH_USB_HID_BOOTLOADER)
#define EnterBootloader() __asm__("goto 0x400")
#endif
 
 
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/******** 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 PIC24FJ256GB110_PIM
#define EXPLORER_16
#define PIC24FJ256GB110_PIM
#define CLOCK_FREQ 32000000
#define GetSystemClock() CLOCK_FREQ
#define GetInstructionClock() GetSystemClock()
/** LED ************************************************************/
#define mInitAllLEDs() LATA &= 0xF0; TRISA &= 0xF0;
#define mLED_1 LATAbits.LATA0
#define mLED_2 LATAbits.LATA1
#define mLED_3 LATAbits.LATA2
#define mLED_4 LATAbits.LATA3
 
#define mGetLED_1() mLED_1
#define mGetLED_2() mLED_2
#define mGetLED_3() mLED_3
#define mGetLED_4() mLED_4
#define mLED_1_On() mLED_1 = 1;
#define mLED_2_On() mLED_2 = 1;
#define mLED_3_On() mLED_3 = 1;
#define mLED_4_On() mLED_4 = 1;
#define mLED_1_Off() mLED_1 = 0;
#define mLED_2_Off() mLED_2 = 0;
#define mLED_3_Off() mLED_3 = 0;
#define mLED_4_Off() mLED_4 = 0;
#define mLED_1_Toggle() mLED_1 = !mLED_1;
#define mLED_2_Toggle() mLED_2 = !mLED_2;
#define mLED_3_Toggle() mLED_3 = !mLED_3;
#define mLED_4_Toggle() mLED_4 = !mLED_4;
/** SWITCH *********************************************************/
#define mInitSwitch2() TRISDbits.TRISD6=1;
#define mInitSwitch3() TRISDbits.TRISD7=1;
#define mInitAllSwitches() mInitSwitch2();mInitSwitch3();
#define sw2 PORTDbits.RD6
#define sw3 PORTDbits.RD7
 
/** POT ************************************************************/
#define mInitPOT() {AD1PCFGLbits.PCFG5 = 0; AD1CON2bits.VCFG = 0x0; AD1CON3bits.ADCS = 0xFF; AD1CON1bits.SSRC = 0x0; AD1CON3bits.SAMC = 0b10000; AD1CON1bits.FORM = 0b00; AD1CON2bits.SMPI = 0x0; AD1CON1bits.ADON = 1;}
#endif //HARDWARE_PROFILE_PIC24FJ256GB110_PIM_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/HardwareProfile - PIC32MX460F512L PIM.h
0,0 → 1,121
/********************************************************************
FileName: HardwareProfile - PIC32MX460F512L PIM.h
Dependencies: See INCLUDES section
Processor: PIC32 USB Microcontrollers
Hardware: PIC32MX460F512L PIM
Compiler: Microchip C32 (for PIC32)
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
2.3 09/15/2008 Broke out each hardware platform into its own
"HardwareProfile - xxx.h" file
********************************************************************/
 
#ifndef HARDWARE_PROFILE_PIC32MX460F512L_PIM_H
#define HARDWARE_PROFILE_PIC32MX460F512L_PIM_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.
 
//#define USE_SELF_POWER_SENSE_IO
#define tris_self_power TRISAbits.TRISA2 // Input
#define self_power 1
 
//#define USE_USB_BUS_SENSE_IO
#define tris_usb_bus_sense TRISBbits.TRISB5 // Input
#define USB_BUS_SENSE 1
 
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/******** 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 PIC32MX460F512L_PIM
#define EXPLORER_16
#define PIC32MX460F512L_PIM
 
/** LED ************************************************************/
#define mInitAllLEDs() LATA &= 0xFF03; TRISA &= 0xFF03;
#define mLED_1 LATAbits.LATA2
#define mLED_2 LATAbits.LATA3
#define mLED_3 LATAbits.LATA6
#define mLED_4 LATAbits.LATA7
#define mGetLED_1() mLED_1
#define mGetLED_2() mLED_2
#define mGetLED_3() mLED_3
#define mGetLED_4() mLED_4
 
#define mLED_1_On() mLED_1 = 1;
#define mLED_2_On() mLED_2 = 1;
#define mLED_3_On() mLED_3 = 1;
#define mLED_4_On() mLED_4 = 1;
#define mLED_1_Off() mLED_1 = 0;
#define mLED_2_Off() mLED_2 = 0;
#define mLED_3_Off() mLED_3 = 0;
#define mLED_4_Off() mLED_4 = 0;
#define mLED_1_Toggle() mLED_1 = !mLED_1;
#define mLED_2_Toggle() mLED_2 = !mLED_2;
#define mLED_3_Toggle() mLED_3 = !mLED_3;
#define mLED_4_Toggle() mLED_4 = !mLED_4;
/** SWITCH *********************************************************/
#define mInitSwitch2() TRISDbits.TRISD6=1;
#define mInitSwitch3() TRISDbits.TRISD7=1;
#define mInitAllSwitches() mInitSwitch2();mInitSwitch3();
#define sw2 PORTDbits.RD6
#define sw3 PORTDbits.RD7
 
/** POT ************************************************************/
#define mInitPOT() {AD1PCFGbits.PCFG5 = 0; AD1CON2bits.VCFG = 0x0; AD1CON3bits.ADCS = 0xFF; AD1CON1bits.SSRC = 0x0; AD1CON3bits.SAMC = 0x10; AD1CON1bits.FORM = 0x0; AD1CON2bits.SMPI = 0x0; AD1CON1bits.ADON = 1;}
 
#endif //HARDWARE_PROFILE_PIC32MX460F512L_PIM_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/HardwareProfile - UBW.h
0,0 → 1,182
/********************************************************************
FileName: HardwareProfile - UBW.h
Dependencies: See INCLUDES section
Processor: PIC18 USB Microcontrollers
Hardware: PICDEM FSUSB
Compiler: Microchip C18
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
2.3 09/15/2008 Broke out each hardware platform into its own
"HardwareProfile - xxx.h" file
01/15/2009 UBW support
********************************************************************/
 
#ifndef HARDWARE_PROFILE_UBW_H
#define HARDWARE_PROFILE_UBW_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
 
/*******************************************************************/
/******** MDD File System selection options ************************/
/*******************************************************************/
#define USE_PIC18
 
#define ERASE_BLOCK_SIZE 64
#define WRITE_BLOCK_SIZE 32
 
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/******** 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 UBW
#define UBW
#define CLOCK_FREQ 48000000
 
// Special UBW emu board by YAS
// #define YAS
 
/** LED ************************************************************/
/* On UBW, LED1 = RC0, LED2 = RC1, SW = RC2 */
 
#define mInitAllLEDs() LATC &= 0xFC; TRISC &= 0xFC;
 
#define mLED_1 LATCbits.LATC0
#define mLED_2 LATCbits.LATC1
 
#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;
 
#if defined(YAS)
#define RXTX LATBbits.LATB5
#else
#define RXTX LATAbits.LATA2
#endif
 
#define BPF_S0 LATAbits.LATA0
#define BPF_S1 LATAbits.LATA1
 
#if defined(YAS)
#define BPF_S2 LATAbits.LATA2
#endif
 
#define BPF_S0_STATE PORTAbits.RA0
#define BPF_S1_STATE PORTAbits.RA1
 
#if defined(YAS)
#define BPF_S2_STATE PORTAbits.RA2
#endif
 
#define PADDLE_DIT PORTBbits.RB6
#define PADDLE_DAH PORTBbits.RB7
 
#define LPF_0 LATAbits.LATA3
#define LPF_1 LATAbits.LATA4
#define LPF_2 LATAbits.LATA5
 
#if defined(YAS)
#else
#define LPF_3 LATBbits.LATB2
#define LPF_4 LATBbits.LATB3
#define LPF_5 LATBbits.LATB4
#define LPF_6 LATBbits.LATB5
#endif
 
 
/** S W I T C H *****************************************************/
#define mInitSwitch() TRISCbits.TRISC2 = 1;
#define UserSW PORTCbits.RC2
 
#define mLED_Both_Off() {mLED_1_Off(); mLED_2_Off();}
#define mLED_Both_On() {mLED_1_On(); mLED_2_On();}
#define mLED_Only_1_On() {mLED_1_On(); mLED_2_Off();}
#define mLED_Only_2_On() {mLED_1_Off(); mLED_2_On();}
 
 
 
 
 
 
#endif //HARDWARE_PROFILE_UBW_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/HardwareProfile - UBW32.h
0,0 → 1,203
/********************************************************************
FileName: HardwareProfile - PIC32MX460F512L PIM.h
Dependencies: See INCLUDES section
Processor: PIC18 or PIC24 USB Microcontrollers
Hardware: The code is natively intended to be used on the following
hardware platforms: PICDEM™ FS USB Demo Board,
PIC18F87J50 FS USB Plug-In Module, or
Explorer 16 + PIC24 USB PIM. The firmware may be
modified for use on other USB platforms by editing this
file (HardwareProfile.h).
Complier: Microchip C18 (for PIC18) or C30 (for PIC24)
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
 
********************************************************************/
 
#ifndef HARDWARE_PROFILE_UBW32_H
#define HARDWARE_PROFILE_UBW32_H
 
#include "Compiler.h"
 
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/******** 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.
 
/** CPU Clock Speed Assignment *************************************/
//#define RUN_AT_48MHZ
//#define RUN_AT_24MHZ
//#define RUN_AT_60MHZ
#define RUN_AT_80MHZ
 
// Various clock values
#if defined(RUN_AT_48MHZ)
#define GetSystemClock() 48000000UL
#define GetPeripheralClock() 48000000UL
#define GetInstructionClock() (GetSystemClock())
#elif defined(RUN_AT_24MHZ)
#define GetSystemClock() 24000000UL
#define GetPeripheralClock() 24000000UL
#define GetInstructionClock() (GetSystemClock())
#elif defined(RUN_AT_60MHZ)
#define GetSystemClock() (60000000ul)
#define GetPeripheralClock() (GetSystemClock())
#define GetInstructionClock() (GetSystemClock())
#elif defined(RUN_AT_80MHZ)
#define GetSystemClock() (80000000ul)
#define GetPeripheralClock() (GetSystemClock())
#define GetInstructionClock() (GetSystemClock())
#else
#error Choose a speed
#endif
 
#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER
 
/*******************************************************************/
/******** 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.
 
//#define USE_SELF_POWER_SENSE_IO
#define tris_self_power TRISAbits.TRISA2 // Input
#define self_power 1
 
//#define USE_USB_BUS_SENSE_IO
#define tris_usb_bus_sense TRISBbits.TRISB5 // Input
#define USB_BUS_SENSE 1
 
/*******************************************************************/
/******** Device revision workarounds ******************************/
/*******************************************************************/
//Uncomment this definition to allow for revision B3 silicon to work
// with this firmware.
#define PIC32MX460F512L_REV_B3_WORKAROUND
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/******** 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 UBW32
#define UBW32
 
/** LED ************************************************************/
#define mInitAllLEDs() LATE |= 0x000F; TRISE &= 0xFFF0;
#define mLED_1 LATEbits.LATE3
#define mLED_2 LATEbits.LATE2
#define mLED_3 LATEbits.LATE1
#define mLED_4 LATEbits.LATE0
 
#define mGetLED_1() mLED_1
#define mGetLED_USB() mLED_1
#define mGetLED_2() mLED_2
#define mGetLED_3() mLED_3
#define mGetLED_4() mLED_4
 
#define mLED_1_On() mLED_1 = 0;
#define mLED_USB_On() mLED_1 = 0;
#define mLED_2_On() mLED_2 = 0;
#define mLED_3_On() mLED_3 = 0;
#define mLED_4_On() mLED_4 = 0;
#define mLED_1_Off() mLED_1 = 1;
#define mLED_USB_Off() mLED_1 = 1;
#define mLED_2_Off() mLED_2 = 1;
#define mLED_3_Off() mLED_3 = 1;
#define mLED_4_Off() mLED_4 = 1;
#define mLED_1_Toggle() mLED_1 = !mLED_1;
#define mLED_USB_Toggle() mLED_1 = !mLED_1;
#define mLED_2_Toggle() mLED_2 = !mLED_2;
#define mLED_3_Toggle() mLED_3 = !mLED_3;
#define mLED_4_Toggle() mLED_4 = !mLED_4;
 
#define mLED_Both_Off() {mLED_1_Off(); mLED_2_Off();}
/** SWITCH *********************************************************/
#define mInitSwitch2() TRISEbits.TRISE7=1;
#define mInitSwitch3() TRISEbits.TRISE6=1;
#define mInitAllSwitches() mInitSwitch2();mInitSwitch3();
#define swProgram PORTEbits.RE7
#define swUser PORTEbits.RE6
 
#define UserSW swUser
#define sw2 swUser
 
#define RXTX LATAbits.LATA2
 
#define BPF_S0 LATAbits.LATA0
#define BPF_S1 LATAbits.LATA1
#define BPF_S0_STATE PORTAbits.RA0
#define BPF_S1_STATE PORTAbits.RA1
 
#define PADDLE_DIT PORTFbits.RF4
#define PADDLE_DAH PORTFbits.RF5
 
#define LPF_0 LATAbits.LATA3
#define LPF_1 LATAbits.LATA4
#define LPF_2 LATAbits.LATA5
#define LPF_3 LATAbits.LATA6
#define LPF_4 LATAbits.LATA7
#define LPF_5 LATAbits.LATA9
#define LPF_6 LATAbits.LATA10
 
 
#endif
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/UBW-I2C.c
0,0 → 1,413
 
 
/** INCLUDES *******************************************************/
 
 
#include "GenericTypeDefs.h"
#include "Compiler.h"
#include "HardwareProfile.h"
#include "USB/usb.h"
#include "usbavrcmd.h"
 
#include "user.h"
#include <math.h>
 
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
 
#if defined (UBW)
#include <delays.h>
#include <i2c.h>
#include <EEP.h>
 
#elif defined (UBW32)
#include <peripheral/i2c.h>
#include <dee_emulation/dee_emulation_pic32.h>
 
#endif
 
 
/********************************************************************
* Section B: EP0 Buffer Space
*******************************************************************/
extern volatile CTRL_TRF_SETUP SetupPkt; // 8-byte only
extern volatile BYTE CtrlTrfData[USB_EP0_BUFF_SIZE];
 
#pragma udata
 
WORD_VAL FilterCrossOver[8];
float FilterSwitchOver[7];
 
WORD_VAL LPFCrossOver[8];
float LPFSwitchOver[7];
 
#pragma code
 
void USBCheckUBWRequest(void)
{
unsigned char paddle_byte;
unsigned int eep_adr;
WORD_VAL w;
unsigned int i, j;
unsigned char IO_data;
 
#if defined (UBW32)
unsigned int value;
unsigned int number_of_filter_bytes;
#else
unsigned char number_of_filter_bytes;
#endif
 
 
 
if(SetupPkt.RequestType == USB_SETUP_TYPE_STANDARD_BITFIELD) return; // only deals with non-standard, ie user requests
command = SetupPkt.bRequest; // save the command of the user request from the setuppacket
// it will be used for subsequent data transfer
 
switch(command)
{
 
case CMD_GET_CW_KEY:
 
paddle_byte = 0x22; // 00100010
if (!PADDLE_DIT) paddle_byte &= 0xdf; // 11011111
if (!PADDLE_DAH) paddle_byte &= 0xfd; // 11111101
if (RXTX) paddle_byte |= 0x10; // PB4 is the ATTINY PTT_OUT pin 00010000
else paddle_byte &= 0xef; // 11101111
replybuf[0] = paddle_byte;
inPipes[0].pSrc.bRam = (BYTE*)&replybuf[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 1; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
case CMD_SET_USRP1: // Set RxTx and get Paddle status
paddle_byte = 0x22; // 00100010
if ( SetupPkt.W_Value.v[0] ){
RXTX = 1; // Set PTT
paddle_byte |= 0x10; // 00010000
}
else{
RXTX = 0;
paddle_byte &= 0xef; // 11101111
};
 
 
if (!PADDLE_DIT) paddle_byte &= 0xdf; // 11011111
if (!PADDLE_DAH) paddle_byte &= 0xfd; // 11111101
replybuf[0] = paddle_byte;
inPipes[0].pSrc.bRam = (BYTE*)&replybuf[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 1; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
case CMD_SET_FREQ_REG: // Control Transfer Rx of data from HOST->UBW
case CMD_SET_LO_SM:
case CMD_SET_FREQ:
case CMD_SET_XTAL:
case CMD_SET_STARTUP:
case CMD_SET_PPM:
 
wCount = SetupPkt.wLength;
outPipes[0].wCount.Val = SetupPkt.wLength;
outPipes[0].pFunc = &Read_Command_Into_Buffer;
outPipes[0].pDst.bRam = (BYTE*) &command_buffer[current_command_in].data[0];
outPipes[0].info.bits.busy = 1;
break;
 
case CMD_GET_PIN: // read ports
IO_data = 0x0d; // 00001101
if (PADDLE_DAH) IO_data |= 0x02; // PB1
if (BPF_S0_STATE) IO_data |= 0x10; // PB4
if (BPF_S1_STATE) IO_data |= 0x20; // PB5
 
replybuf[0] = IO_data;
inPipes[0].pSrc.bRam = (BYTE*)&replybuf[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 1; // Set data count
inPipes[0].info.bits.busy = 1;
break;
case CMD_SET_PORT: // set ports
IO_data = SetupPkt.W_Value.v[0];
if (!abpf_flag){
if (IO_data & 0x10) BPF_S0 = 1;
else BPF_S0 = 0;
if (IO_data & 0x20) BPF_S1 = 1;
else BPF_S1 = 0;
};
break;
 
case CMD_SET_IO: // set i/o bits
IO_data = SetupPkt.W_Index.v[0] & 0x03; // only 2 bits active 00000011
 
if (!abpf_flag) { // abpf inactive
if (IO_data & 0x01) BPF_S0 = 1; // Simulate IO_PIN1 in ATTINY
else BPF_S0 = 0;
if (IO_data & 0x02) BPF_S1 = 1; // Simulate IO_PIN2 in ATTINY
else BPF_S1 = 0;
}
 
IO_data = BPF_S0_STATE; // read back status of BPF select pins
if (BPF_S1_STATE) IO_data |= 0x02;
else IO_data &= 0x01;
 
replybuf[0] = IO_data;
replybuf[1] = 0x00;
inPipes[0].pSrc.bRam = (BYTE*)&replybuf[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 2; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
case CMD_GET_IO:
 
IO_data = BPF_S0_STATE; // status of BPF select pins
if (BPF_S1_STATE) IO_data |= 0x02;
else IO_data &= 0x01;
replybuf[0] = IO_data;
replybuf[1] = 0x00;
inPipes[0].pSrc.bRam = (BYTE*)&replybuf[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 2; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
case CMD_SET_FILTER: // Set and Read filter crossover points
i = SetupPkt.W_Index.Val;
if (i < 256){ // Rx Filter
number_of_filter_bytes = NUM_BPF * 2;
inPipes[0].pSrc.bRam = (BYTE*)&FilterCrossOver[0]; // Set source
 
if (i < NUM_BPF) {
FilterCrossOver[i].Val = SetupPkt.W_Value.Val;
if (i != (NUM_BPF-1)) FilterSwitchOver[i] = Cross2Switch(FilterCrossOver[i]);
else abpf_flag = SetupPkt.W_Value.Val;
}
}
else{ // Tx filter
number_of_filter_bytes = 16;
inPipes[0].pSrc.bRam = (BYTE*)&LPFCrossOver[0]; // Set source
 
j = i - 256;
if ( j < 8){
LPFCrossOver[j].Val = SetupPkt.W_Value.Val;
if (j != 7) LPFSwitchOver[j] = Cross2Switch(LPFCrossOver[j]);
};
};
 
// now that a filter value of filter enable/disable value is set, update the EEPROM
#if defined (UBW)
for (i = 0; i < NUM_BPF; i++){
Write_b_eep((i * 2 + F_CROSS_OVER +1), FilterCrossOver[i].v[0]);
Busy_eep();
Write_b_eep((i * 2 + F_CROSS_OVER + 1 + 1), FilterCrossOver[i].v[1]);
Busy_eep();
}
#elif defined (UBW32)
for (i =0; i < NUM_BPF; i++) DataEEWrite( FilterCrossOver[i].Val , (i + F_CROSS_OVER +1));
#endif
 
#if defined (UBW)
for (j = 0; j < 8; j++){
Write_b_eep(( j * 2 + F_CROSS_OVER +17), LPFCrossOver[j].v[0]);
Busy_eep();
Write_b_eep(( j * 2 + F_CROSS_OVER +17 + 1), LPFCrossOver[j].v[1]);
Busy_eep();
}
Write_b_eep(F_CROSS_OVER, F_CROSS_OVER_VALUE);
Busy_eep();
#elif defined (UBW32)
for (j = 0; j < 8; j++){
DataEEWrite( (unsigned int)LPFCrossOver[j].Val , (j + F_CROSS_OVER +9));
};
DataEEWrite(F_CROSS_OVER_VALUE, F_CROSS_OVER);
#endif
 
 
inPipes[0].wCount.v[0] = number_of_filter_bytes; // Set data count
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].info.bits.busy = 1;
break;
 
case CMD_SET_SI570: // SI570: write byte from register index
i2c_adr = SetupPkt.W_Value.v[0];
#if defined (UBW)
IdleI2C();
StartI2C();
IdleI2C();
WriteI2C( i2c_adr <<1);
WriteI2C( SetupPkt.W_Value.v[1]); // register = byte 3
WriteI2C( SetupPkt.W_Index.v[0]); // value to write to register
StopI2C();
IdleI2C();
#elif defined (UBW32)
IdleI2C1();
StartI2C1();
IdleI2C1();
MasterWriteI2C1( i2c_adr <<1);
MasterWriteI2C1( SetupPkt.W_Value.v[1]); // register = byte 3
MasterWriteI2C1( SetupPkt.W_Index.v[0]); // value to write to register
StopI2C1();
IdleI2C1();
#endif
 
replybuf[0] = 0; // just say no errors
inPipes[0].pSrc.bRam = (BYTE*)&replybuf[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 1; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
case CMD_GET_LO_SM: // return sub mul
for (i=0; i<4; i++) replybuf[i] = f_sub.bytes[i];
for (i=0; i<4; i++) replybuf[i+4] = f_mul.bytes[i];
inPipes[0].pSrc.bRam = (BYTE*)&replybuf[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 8; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
 
case CMD_GET_FREQ: // return set freq, ie no offset/mul
avr_freq.qw = set_frequency * (double)(1L << 21);
inPipes[0].pSrc.bRam = (BYTE*)&avr_freq.bytes[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 4; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
case CMD_GET_PPM: // return smooth tune in ppm
w.Val = Smooth_double * 1000000L;
inPipes[0].pSrc.bRam = (BYTE*)&w.v[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 2; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
case CMD_GET_STARTUP: // return init startup freq
 
#if defined(UBW)
for (i=0; i<4; i++) avr_freq.bytes[i] = Read_b_eep(i + F_INIT_FREQ +1);
#elif defined(UBW32)
for (i=0; i<4; i++) {
DataEERead(&value, (i + F_INIT_FREQ +1));
avr_freq.bytes[i] = value;
};
#endif
 
inPipes[0].pSrc.bRam = (BYTE*)&avr_freq.bytes[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 4; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
case CMD_GET_XTAL: // return fcryst
inPipes[0].pSrc.bRam = (BYTE*)&fcryst_freq.bytes[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 4; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
case CMD_GET_SI570: // SI570: read out frequency control registers
i2c_adr = SetupPkt.W_Value.v[0];
ReadRegs();
inPipes[0].pSrc.bRam = (BYTE*)&registers[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 6; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
case CMD_GET_I2C_ERR: // return # of i2c errors, set to zero always
replybuf[0] = 0; // No errors :)
inPipes[0].pSrc.bRam = (BYTE*)&replybuf[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 1; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
 
case CMD_SET_I2C_ADDR: // Reset EEPROM to default values if 255
// Otherwise just set i2c address
 
if (SetupPkt.W_Value.v[0] == 0xff){
#if defined (UBW)
Write_b_eep(F_CAL_DONE, 0xff);
Busy_eep();
Write_b_eep(F_INIT_FREQ, 0xff);
Busy_eep();
Write_b_eep(F_SMOOTH, 0xff);
Busy_eep();
Write_b_eep(F_SUB_MUL, 0xff);
Busy_eep();
Write_b_eep(F_CROSS_OVER, 0xff);
Busy_eep();
#elif defined (UBW32)
DataEEWrite( (unsigned int) 0xff, F_CAL_DONE);
DataEEWrite( (unsigned int) 0xff, F_INIT_FREQ);
DataEEWrite( (unsigned int) 0xff, F_SMOOTH);
DataEEWrite( (unsigned int) 0xff, F_SUB_MUL);
DataEEWrite( (unsigned int) 0xff, F_CROSS_OVER);
#endif
 
i2c_adr = 0x55;
}
else {
i2c_adr = SetupPkt.W_Value.v[0];
};
 
replybuf[0] = 0x00;
inPipes[0].pSrc.bRam = (BYTE*)&replybuf[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 1; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
 
 
case CMD_GET_VERSION: // return version 15.10
replybuf[0] = VERSION_MINOR;
replybuf[1] = VERSION_MAJOR;
inPipes[0].pSrc.bRam = (BYTE*)&replybuf[0]; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 2; // Set data count
inPipes[0].info.bits.busy = 1;
break;
 
default: // Command not supported
replybuf[0] = 0xff;
inPipes[0].pSrc.bRam = (BYTE*)&replybuf[0] ; // Set Source
inPipes[0].info.bits.ctrl_trf_mem = USB_EP0_RAM; // Set memory type
inPipes[0].wCount.v[0] = 1; // Set data count
inPipes[0].info.bits.busy = 1;
break;
}//end switch
 
}
 
 
void Read_Command_Into_Buffer(void)
{
 
if (command_count >= COMMAND_BUFFER_SIZE){ // buffer full
current_command_out++; // discards oldest command
if (current_command_out >= COMMAND_BUFFER_SIZE) current_command_out = 0;
command_count--; // now one command less (discarded)
};
command_buffer[current_command_in].command = command;
command_buffer[current_command_in].wCount = wCount;
// data already copied to command_buffer before this outpipe pFunc is called
current_command_in++;
if (current_command_in >= COMMAND_BUFFER_SIZE) current_command_in = 0;
command_count++;
}
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/rm18f4550 - HID Bootload.lkr
0,0 → 1,44
// File: Application_18f4550.lkr
 
// Use this linker for the USB application that will be self programmed by the HID bootloader.
// The HID bootloader project itself uses the BootModified.18f4450.lkr file instead.
 
// THIS LINKER SCRIPT HAS BEEN MODIFIED... This version is intended to be used
// with the "PROGRAMMABLE_WITH_USB_HID_BOOTLOADER" bootloader. The HID
// bootloader occupies memory ranges 0x000-0xFFF. In order for the code generated
// by this project to work with the bootloader, the linker must not put any code
// in the 0x00-0xFFF address range.
 
// This linker script was originated from the 18f4550.lkr file provided by
// the MCC18 distribution.
 
LIBPATH .
 
FILES c018i.o
FILES clib.lib
FILES p18f4550.lib
 
CODEPAGE NAME=bootloader START=0x0 END=0xFFF PROTECTED
CODEPAGE NAME=vectors START=0x1000 END=0x1029 PROTECTED
CODEPAGE NAME=page START=0x102A END=0x7FFF
CODEPAGE NAME=idlocs START=0x200000 END=0x200007 PROTECTED
CODEPAGE NAME=config START=0x300000 END=0x30000D PROTECTED
CODEPAGE NAME=devid START=0x3FFFFE END=0x3FFFFF PROTECTED
CODEPAGE NAME=eedata START=0xF00000 END=0xF000FF PROTECTED
 
ACCESSBANK NAME=accessram START=0x0 END=0x5F
DATABANK NAME=gpr0 START=0x60 END=0xFF
DATABANK NAME=gpr1 START=0x100 END=0x1FF
DATABANK NAME=gpr2 START=0x200 END=0x2FF
DATABANK NAME=gpr3 START=0x300 END=0x3FF
DATABANK NAME=usb4 START=0x400 END=0x4FF PROTECTED
DATABANK NAME=usb5 START=0x500 END=0x5FF PROTECTED
DATABANK NAME=usb6 START=0x600 END=0x6FF PROTECTED
DATABANK NAME=usb7 START=0x700 END=0x7FF PROTECTED
ACCESSBANK NAME=accesssfr START=0xF60 END=0xFFF PROTECTED
 
SECTION NAME=CONFIG ROM=config
 
STACK SIZE=0x100 RAM=gpr3
 
SECTION NAME=USB_VARS RAM=usb4
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/rm18f4550 - MCHPUSB Bootload.lkr
0,0 → 1,37
// FileName: rm18f4550.lkr
// Sample linker command file for 18F4550 with Bootloader
//
//Change History:
// Rev Date Description
// 1.0 10/30/2004 Initial release
 
LIBPATH .
 
FILES c018i.o
FILES clib.lib
FILES p18f4550.lib
 
CODEPAGE NAME=boot START=0x0 END=0x7FF PROTECTED
CODEPAGE NAME=vectors START=0x800 END=0x0x829 PROTECTED
CODEPAGE NAME=page START=0x82A END=0x7FFF
CODEPAGE NAME=idlocs START=0x200000 END=0x200007 PROTECTED
CODEPAGE NAME=config START=0x300000 END=0x30000D PROTECTED
CODEPAGE NAME=devid START=0x3FFFFE END=0x3FFFFF PROTECTED
CODEPAGE NAME=eedata START=0xF00000 END=0xF000FF PROTECTED
 
ACCESSBANK NAME=accessram START=0x0 END=0x5F
DATABANK NAME=gpr0 START=0x60 END=0xFF
DATABANK NAME=gpr1 START=0x100 END=0x1FF
DATABANK NAME=gpr2 START=0x200 END=0x2FF
DATABANK NAME=gpr3 START=0x300 END=0x3FF
DATABANK NAME=usb4 START=0x400 END=0x4FF PROTECTED
DATABANK NAME=usb5 START=0x500 END=0x5FF PROTECTED
DATABANK NAME=usb6 START=0x600 END=0x6FF PROTECTED
DATABANK NAME=usb7 START=0x700 END=0x7FF PROTECTED
ACCESSBANK NAME=accesssfr START=0xF60 END=0xFFF PROTECTED
 
SECTION NAME=CONFIG ROM=config
 
STACK SIZE=0x100 RAM=gpr3
 
SECTION NAME=USB_VARS RAM=usb4
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/rm18f4550.lkr
0,0 → 1,37
// FileName: rm18f4550.lkr
// Sample linker command file for 18F4550 with Bootloader
//
//Change History:
// Rev Date Description
// 1.0 10/30/2004 Initial release
 
LIBPATH .
 
FILES c018i.o
FILES clib.lib
FILES p18f4550.lib
 
CODEPAGE NAME=boot START=0x0 END=0x7FF PROTECTED
CODEPAGE NAME=vectors START=0x800 END=0x0x829 PROTECTED
CODEPAGE NAME=page START=0x82A END=0x7FFF
CODEPAGE NAME=idlocs START=0x200000 END=0x200007 PROTECTED
CODEPAGE NAME=config START=0x300000 END=0x30000D PROTECTED
CODEPAGE NAME=devid START=0x3FFFFE END=0x3FFFFF PROTECTED
CODEPAGE NAME=eedata START=0xF00000 END=0xF000FF PROTECTED
 
ACCESSBANK NAME=accessram START=0x0 END=0x5F
DATABANK NAME=gpr0 START=0x60 END=0xFF
DATABANK NAME=gpr1 START=0x100 END=0x1FF
DATABANK NAME=gpr2 START=0x200 END=0x2FF
DATABANK NAME=gpr3 START=0x300 END=0x3FF
DATABANK NAME=usb4 START=0x400 END=0x4FF PROTECTED
DATABANK NAME=usb5 START=0x500 END=0x5FF PROTECTED
DATABANK NAME=usb6 START=0x600 END=0x6FF PROTECTED
DATABANK NAME=usb7 START=0x700 END=0x7FF PROTECTED
ACCESSBANK NAME=accesssfr START=0xF60 END=0xFFF PROTECTED
 
SECTION NAME=CONFIG ROM=config
 
STACK SIZE=0x100 RAM=gpr3
 
SECTION NAME=USB_VARS RAM=usb4
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/usb_config.h
0,0 → 1,125
/********************************************************************
FileName: usb_config.h
Dependencies: Always: GenericTypeDefs.h, usb_device.h
Situational: usb_function_hid.h, usb_function_cdc.h, usb_function_msd.h, etc.
Processor: PIC18 or PIC24 USB Microcontrollers
Hardware: The code is natively intended to be used on the following
hardware platforms: PICDEM™ FS USB Demo Board,
PIC18F87J50 FS USB Plug-In Module, or
Explorer 16 + PIC24 USB PIM. The firmware may be
modified for use on other USB platforms by editing the
HardwareProfile.h file.
Complier: Microchip C18 (for PIC18) or C30 (for PIC24)
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
*******************************************************************/
 
/*********************************************************************
* Descriptor specific type definitions are defined in: usbd.h
********************************************************************/
 
#ifndef USBCFG_H
#define USBCFG_H
 
/** DEFINITIONS ****************************************************/
#define USB_EP0_BUFF_SIZE 8 // Valid Options: 8, 16, 32, or 64 bytes.
// Using larger options take more SRAM, but
// does not provide much advantage in most types
// of applications. Exceptions to this, are applications
// that use EP0 IN or OUT for sending large amounts of
// application related data.
#define USB_MAX_NUM_INT 1 // For tracking Alternate Setting
#define USB_MAX_EP_NUMBER 1
 
//Device descriptor - if these two definitions are not defined then
// a ROM USB_DEVICE_DESCRIPTOR variable by the exact name of device_dsc
// must exist.
#define USB_USER_DEVICE_DESCRIPTOR &device_dsc
#define USB_USER_DEVICE_DESCRIPTOR_INCLUDE extern ROM USB_DEVICE_DESCRIPTOR device_dsc
 
//Configuration descriptors - if these two definitions do not exist then
// a ROM BYTE *ROM variable named exactly USB_CD_Ptr[] must exist.
#define USB_USER_CONFIG_DESCRIPTOR USB_CD_Ptr
#define USB_USER_CONFIG_DESCRIPTOR_INCLUDE extern ROM BYTE *ROM USB_CD_Ptr[]
 
//Make sure only one of the below "#define USB_PING_PONG_MODE"
//is uncommented.
//#define USB_PING_PONG_MODE USB_PING_PONG__NO_PING_PONG
#define USB_PING_PONG_MODE USB_PING_PONG__FULL_PING_PONG
//#define USB_PING_PONG_MODE USB_PING_PONG__EP0_OUT_ONLY
//#define USB_PING_PONG_MODE USB_PING_PONG__ALL_BUT_EP0 //NOTE: This mode is not supported in PIC18F4550 family rev A3 devices
 
 
#define USB_POLLING
//#define USB_INTERRUPT
 
/* Parameter definitions are defined in usb_device.h */
#define USB_PULLUP_OPTION USB_PULLUP_ENABLE
//#define USB_PULLUP_OPTION USB_PULLUP_DISABLED
 
#define USB_TRANSCEIVER_OPTION USB_INTERNAL_TRANSCEIVER
//External Transceiver support is not available on all product families. Please
// refer to the product family datasheet for more information if this feature
// is available on the target processor.
//#define USB_TRANSCEIVER_OPTION USB_EXTERNAL_TRANSCEIVER
 
#define USB_SPEED_OPTION USB_FULL_SPEED
//#define USB_SPEED_OPTION USB_LOW_SPEED //(not valid option for PIC24F devices)
 
#define USB_SUPPORT_DEVICE
 
#define USB_NUM_STRING_DESCRIPTORS 4
 
//#define USB_INTERRUPT_LEGACY_CALLBACKS
#define USB_ENABLE_ALL_HANDLERS
//#define USB_ENABLE_SUSPEND_HANDLER
//#define USB_ENABLE_WAKEUP_FROM_SUSPEND_HANDLER
//#define USB_ENABLE_SOF_HANDLER
//#define USB_ENABLE_ERROR_HANDLER
//#define USB_ENABLE_OTHER_REQUEST_HANDLER
//#define USB_ENABLE_SET_DESCRIPTOR_HANDLER
//#define USB_ENABLE_INIT_EP_HANDLER
//#define USB_ENABLE_EP0_DATA_HANDLER
//#define USB_ENABLE_TRANSFER_COMPLETE_HANDLER
 
/** DEVICE CLASS USAGE *********************************************/
#define USB_USE_GEN
 
/** ENDPOINTS ALLOCATION *******************************************/
 
/* Generic */
#define USBGEN_EP_SIZE 64
#define USBGEN_EP_NUM 1
 
/** DEFINITIONS ****************************************************/
 
#endif //USBCFG_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/usb_descriptors.c
0,0 → 1,265
/********************************************************************
FileName: usb_descriptors.c
Dependencies: See INCLUDES section
Processor: PIC18 or PIC24 USB Microcontrollers
Hardware: The code is natively intended to be used on the following
hardware platforms: PICDEM™ FS USB Demo Board,
PIC18F87J50 FS USB Plug-In Module, or
Explorer 16 + PIC24 USB PIM. The firmware may be
modified for use on other USB platforms by editing the
HardwareProfile.h file.
Complier: Microchip C18 (for PIC18) or C30 (for PIC24)
Company: Microchip Technology, Inc.
 
Software License Agreement:
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
 
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
*********************************************************************
-usb_descriptors.c-
-------------------------------------------------------------------
Filling in the descriptor values in the usb_descriptors.c file:
-------------------------------------------------------------------
 
[Device Descriptors]
The device descriptor is defined as a USB_DEVICE_DESCRIPTOR type.
This type is defined in usb_ch9.h Each entry into this structure
needs to be the correct length for the data type of the entry.
 
[Configuration Descriptors]
The configuration descriptor was changed in v2.x from a structure
to a BYTE array. Given that the configuration is now a byte array
each byte of multi-byte fields must be listed individually. This
means that for fields like the total size of the configuration where
the field is a 16-bit value "64,0," is the correct entry for a
configuration that is only 64 bytes long and not "64," which is one
too few bytes.
 
The configuration attribute must always have the _DEFAULT
definition at the minimum. Additional options can be ORed
to the _DEFAULT attribute. Available options are _SELF and _RWU.
These definitions are defined in the usb_device.h file. The
_SELF tells the USB host that this device is self-powered. The
_RWU tells the USB host that this device supports Remote Wakeup.
 
[Endpoint Descriptors]
Like the configuration descriptor, the endpoint descriptors were
changed in v2.x of the stack from a structure to a BYTE array. As
endpoint descriptors also has a field that are multi-byte entities,
please be sure to specify both bytes of the field. For example, for
the endpoint size an endpoint that is 64 bytes needs to have the size
defined as "64,0," instead of "64,"
 
Take the following example:
// Endpoint Descriptor //
0x07, //the size of this descriptor //
USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
_EP02_IN, //EndpointAddress
_INT, //Attributes
0x08,0x00, //size (note: 2 bytes)
0x02, //Interval
 
The first two parameters are self-explanatory. They specify the
length of this endpoint descriptor (7) and the descriptor type.
The next parameter identifies the endpoint, the definitions are
defined in usb_device.h and has the following naming
convention:
_EP<##>_<dir>
where ## is the endpoint number and dir is the direction of
transfer. The dir has the value of either 'OUT' or 'IN'.
The next parameter identifies the type of the endpoint. Available
options are _BULK, _INT, _ISO, and _CTRL. The _CTRL is not
typically used because the default control transfer endpoint is
not defined in the USB descriptors. When _ISO option is used,
addition options can be ORed to _ISO. Example:
_ISO|_AD|_FE
This describes the endpoint as an isochronous pipe with adaptive
and feedback attributes. See usb_device.h and the USB
specification for details. The next parameter defines the size of
the endpoint. The last parameter in the polling interval.
 
-------------------------------------------------------------------
Adding a USB String
-------------------------------------------------------------------
A string descriptor array should have the following format:
 
rom struct{byte bLength;byte bDscType;word string[size];}sdxxx={
sizeof(sdxxx),DSC_STR,<text>};
 
The above structure provides a means for the C compiler to
calculate the length of string descriptor sdxxx, where xxx is the
index number. The first two bytes of the descriptor are descriptor
length and type. The rest <text> are string texts which must be
in the unicode format. The unicode format is achieved by declaring
each character as a word type. The whole text string is declared
as a word array with the number of characters equals to <size>.
<size> has to be manually counted and entered into the array
declaration. Let's study this through an example:
if the string is "USB" , then the string descriptor should be:
(Using index 02)
rom struct{byte bLength;byte bDscType;word string[3];}sd002={
sizeof(sd002),DSC_STR,'U','S','B'};
 
A USB project may have multiple strings and the firmware supports
the management of multiple strings through a look-up table.
The look-up table is defined as:
rom const unsigned char *rom USB_SD_Ptr[]={&sd000,&sd001,&sd002};
 
The above declaration has 3 strings, sd000, sd001, and sd002.
Strings can be removed or added. sd000 is a specialized string
descriptor. It defines the language code, usually this is
US English (0x0409). The index of the string must match the index
position of the USB_SD_Ptr array, &sd000 must be in position
USB_SD_Ptr[0], &sd001 must be in position USB_SD_Ptr[1] and so on.
The look-up table USB_SD_Ptr is used by the get string handler
function.
 
-------------------------------------------------------------------
 
The look-up table scheme also applies to the configuration
descriptor. A USB device may have multiple configuration
descriptors, i.e. CFG01, CFG02, etc. To add a configuration
descriptor, user must implement a structure similar to CFG01.
The next step is to add the configuration descriptor name, i.e.
cfg01, cfg02,.., to the look-up table USB_CD_Ptr. USB_CD_Ptr[0]
is a dummy place holder since configuration 0 is the un-configured
state according to the definition in the USB specification.
 
********************************************************************/
/*********************************************************************
* Descriptor specific type definitions are defined in:
* usb_device.h
*
* Configuration options are defined in:
* usb_config.h
********************************************************************/
#ifndef __USB_DESCRIPTORS_C
#define __USB_DESCRIPTORS_C
 
/** INCLUDES *******************************************************/
/*
#include "GenericTypeDefs.h"
#include "Compiler.h"
#include "usb_config.h"
#include "USB/usb_device.h"
*/
#include "./USB/usb.h"
 
/** CONSTANTS ******************************************************/
#if defined(__18CXX)
#pragma romdata
#endif
 
/* Device Descriptor */
ROM USB_DEVICE_DESCRIPTOR device_dsc=
{
0x12, // Size of this descriptor in bytes
USB_DESCRIPTOR_DEVICE, // DEVICE descriptor type
0x0200, // USB Spec Release Number in BCD format
0x00, // Class Code
0x00, // Subclass code
0x00, // Protocol code
USB_EP0_BUFF_SIZE, // Max packet size for EP0, see usb_config.h
0x16C0, // Vendor ID VOTI AVR USB device
0x05DC, // Product ID: obdev's free PID
0x0000, // Device release number in BCD format
0x01, // Manufacturer string index
0x02, // Product string index
0x03, // Device serial number string index
0x01 // Number of possible configurations
};
 
/* Configuration 1 Descriptor */
ROM BYTE configDescriptor1[]={
/* Configuration Descriptor */
0x09,//sizeof(USB_CFG_DSC), // Size of this descriptor in bytes
USB_DESCRIPTOR_CONFIGURATION, // CONFIGURATION descriptor type
0x20,0x00, // Total length of data for this cfg
1, // Number of interfaces in this cfg
1, // Index value of this configuration
0, // Configuration string index
_DEFAULT | _SELF, // Attributes, see usb_device.h
50, // Max power consumption (2X mA)
/* Interface Descriptor */
0x09,//sizeof(USB_INTF_DSC), // Size of this descriptor in bytes
USB_DESCRIPTOR_INTERFACE, // INTERFACE descriptor type
0, // Interface Number
0, // Alternate Setting Number
2, // Number of endpoints in this intf
0x00, // Class code
0x00, // Subclass code
0x00, // Protocol code
0, // Interface string index
/* Endpoint Descriptor */
0x07, /*sizeof(USB_EP_DSC)*/
USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
_EP01_OUT, //EndpointAddress
_BULK, //Attributes
USBGEN_EP_SIZE,0x00, //size
1, //Interval
0x07, /*sizeof(USB_EP_DSC)*/
USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
_EP01_IN, //EndpointAddress
_BULK, //Attributes
USBGEN_EP_SIZE,0x00, //size
1 //Interval
};
 
 
//Language code string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[1];}sd000={
sizeof(sd000),USB_DESCRIPTOR_STRING,{0x0409}};
 
//Manufacturer string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[12];}sd001={
sizeof(sd001),USB_DESCRIPTOR_STRING,
{'w','w','w','.','o','b','d','e','v','.',
'a','t'}};
 
//Product string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[10];}sd002={
sizeof(sd002),USB_DESCRIPTOR_STRING,
{'D','G','8','S','A','Q','-','I','2','C'}};
 
//Serial Number string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[9];}sd003={
sizeof(sd003),USB_DESCRIPTOR_STRING,
{'T','F','3','L','J','-','1','.','0'}};
 
//Array of configuration descriptors
ROM BYTE *ROM USB_CD_Ptr[]=
{
(ROM BYTE *ROM)&configDescriptor1
};
//Array of string descriptors
ROM BYTE *ROM USB_SD_Ptr[]=
{
(ROM BYTE *ROM)&sd000,
(ROM BYTE *ROM)&sd001,
(ROM BYTE *ROM)&sd002,
(ROM BYTE *ROM)&sd003
};
 
/** EOF usb_descriptors.c ***************************************************/
 
#endif
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/usbavrcmd.h
0,0 → 1,87
//************************************************************************
//**
//** Project......: Firmware USB AVR Si570 controler.
//**
//** Platform.....: ATtiny45 @ 16.5 MHz
//**
//** Licence......: This software is freely available for non-commercial
//** use - i.e. for research and experimentation only!
//**
//** Programmer...: F.W. Krom, PE0FKO
//**
//** Description..: USB commando codes
//**
//** History......: V15.12: First version
//**
//**************************************************************************
//
 
//#define CMD_ECHO_WORD 0x00
#define CMD_GET_VERSION 0x00
#define CMD_SET_DDR 0x01
#define CMD_GET_PIN 0x02
#define CMD_GET_PORT 0x03
#define CMD_SET_PORT 0x04
// 0x05 // Used in old V1.4
// 0x06 // Used in old V1.4
// 0x07 // Used in old V1.4
// 0x08 // Used in old V1.4
// 0x09 // Used in old V1.4
// 0x0A // Used in old V1.4
// 0x0B // Used in old V1.4
// 0x0C // Used in old V1.4
#define CMD_REBOOT 0x0F
// 0x10 // Used in old V1.4
// 0x11 // Used in old V1.4
#define CMD_SET_IO 0x15
#define CMD_GET_IO 0x16
#define CMD_SET_FILTER 0x17
#define CMD_SET_RX_BAND_FILTER 0x18 // V15.12
#define CMD_GET_RX_BAND_FILTER 0x19 // V15.12
#define CMD_SET_TX_BAND_FILTER 0x1A // MOBO Only
#define CMD_GET_TX_BAND_FILTER 0x1B // MOBO Only
 
#define CMD_SET_SI570 0x20 // Write byte to Si570 register
// 0x21 // Used in old V1.4
// 0x22 // Used in old V1.4
// 0x23 // Used in old V1.4
 
#define CMD_SET_FREQ_REG 0x30
#define CMD_SET_LO_SM 0x31
#define CMD_SET_FREQ 0x32
#define CMD_SET_XTAL 0x33
#define CMD_SET_STARTUP 0x34
#define CMD_SET_PPM 0x35
// 0x36 // Used in old V2.0
// 0x37 // Used in old V2.0
// 0x38 // Used in old V2.0
#define CMD_GET_LO_SM 0x39
#define CMD_GET_FREQ 0x3a
#define CMD_GET_PPM 0x3b
#define CMD_GET_STARTUP 0x3c
#define CMD_GET_XTAL 0x3d
#define CMD_GET_REGS 0x3e
#define CMD_GET_SI570 0x3f
#define CMD_GET_I2C_ERR 0x40
#define CMD_SET_I2C_ADDR 0x41
#define CMD_GET_CPU_TEMP 0x42 //
 
#define CMD_SET_USRP1 0x50
#define CMD_GET_CW_KEY 0x51
// 0x52 // Used in old V2.0
// 0x53 // Used in old V2.0
// 0x54 // Used in old V2.0
 
// Mobo command's
#define CMD_GET_FW_FEATURE 0x60 // Firmware Feature select
#define CMD_GET_ADC_INPUTS 0x61 // Read analog inputs (Temp, PA current, P_out, P_ref, Vdd)
#define CMD_RM_PA_HIGH_TEMP 0x64 // Read/Modify the PA High Temperature limit
#define CMD_RM_PA_BIAS 0x65 // Read/Modify PA bias setting related values, 5 items
#define CMD_RM_PA_SWR 0x66 // Read/Modify SWR measurement and SWR alarm related values 4 items
#define CMD_RM_ROTARY 0x67 // Read/Modify Rotatry Encoder Resolution
#define CMD_SET_BYTE_GPIO 0x6e // Write a Byte to (PCF8584) GPIO Extender
#define CMD_GET_BYTE_GPIO 0x6f // Read a Byte from (PCF8584) GPIO Extender
 
// 0xEE // Used in old V2.0
// 0xEF // Used in old V2.0
// 0xFF // Used in old V2.0
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/user.bak
0,0 → 1,197
/*********************************************************************
*
* Microchip USB C18 Firmware Version 1.2
*
*********************************************************************
* FileName: user.h
* Dependencies: See INCLUDES section below
* Processor: PIC18
* Compiler: C18 3.11+
* Company: Microchip Technology, Inc.
*
* Software License Agreement
*
* The software supplied herewith by Microchip Technology Incorporated
* (the “Company”) for its PICmicro® Microcontroller is intended and
* supplied to you, the Company’s customer, for use solely and
* exclusively on Microchip PICmicro Microcontroller products. The
* software is owned by the Company and/or its supplier, and is
* protected under applicable copyright laws. All rights are reserved.
* Any use in violation of the foregoing restrictions may subject the
* user to criminal sanctions under applicable laws, as well as to
* civil liability for the breach of the terms and conditions of this
* license.
*
* THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
* Author Date Comment
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Rawin Rojvanit 11/19/04 Original.
* Rawin Rojvanit 05/14/07 Minor updates.
********************************************************************/
 
#ifndef PICDEM_FS_DEMO_H
#define PICDEM_FS_DEMO_H
 
/** I N C L U D E S **********************************************************/
 
/** D E F I N I T I O N S ****************************************************/
 
// For custom LPF switchover points
#define ALEX
//#define K5OOR
//#define MARC
 
// YAS is defined in the HardwareProfile - UBW.h, if needed
 
#if defined(YAS)
#define NUM_BPF 8
#else
#define NUM_BPF 4
#endif
 
#define INIT_SI570_ON_STARTUP
 
#define VERSION_MAJOR 16
#define VERSION_MINOR 04
 
#define DEFAULT_I2C_ADDRESS 0x55
#define PCF8574 0x39 // A2 A1 A0 -> 0 0 1
 
#define F_CAL_DONE 0 // EEPROM position of F_CAL_DONE flag. 4 bytes follow.
#define F_CAL_DONE_VALUE 0x55
#define DEFAULT_FCRYST 114.285
 
//#if defined(UBW)
#define F_INIT_FREQ 5 // 4 bytes follow
//#elif defined(UBW32)
//#define F_INIT_FREQ 2 // fcryst 4 bytes all stored in one 32 bit slot
#endif
 
#define F_INIT_FREQ_VALUE 0x55
#define DEFAULT_INIT_FREQ 56.32
 
#if defined(UBW)
#define F_SMOOTH 10 // 2 bytes follow
#elif defined(UBW32)
#define F_SMOOTH 4 // 1 slot follow
#endif
 
#define F_SMOOTH_VALUE 0x55
#define DEFAULT_SMOOTH 3500 // ppm
 
#define F_SUB_MUL_VALUE 0x55
#define DEFAULT_SUB 0.0
#define DEFAULT_MUL 1.0
 
#if defined(UBW)
#define F_SUB_MUL 13 // 8 bytes follow
#elif defined(UBW32)
#define F_SUB_MUL 6 // 2 slots follow
#endif
 
#if defined(UBW)
#define F_CROSS_OVER 22 // 32 bytes follow
#elif defined(UBW32)
#define F_CROSS_OVER 9 // 16 words stored in 16 (unsigned int) slots
#endif
 
#define F_CROSS_OVER_VALUE 0x55
 
#if defined(UBW)
#define F_BLINK_LED 55
#elif defined(UBW32)
#define F_BLINK_LED 26
#endif
 
/** S T R U C T U R E S ******************************************************/
 
 
extern BYTE i2c_adr;
extern BYTE command;
extern BYTE replybuf[8];
extern WORD wCount;
 
#define COMMAND_BUFFER_SIZE 16
#define DATA_PACKET_SIZE 6
 
typedef struct COMMAND_BUFFER
{
BYTE command;
WORD wCount;
BYTE data[DATA_PACKET_SIZE];
} COMMAND_BUFFER_t;
 
extern COMMAND_BUFFER_t command_buffer[COMMAND_BUFFER_SIZE];
extern BYTE current_command_in, current_command_out;
extern BYTE command_count;
 
extern double set_frequency;
 
extern unsigned char tempBuf[8];
 
typedef union _avr_freq
{
unsigned long qw;
unsigned char bytes[4];
} avr_freq_t;
 
extern avr_freq_t avr_freq, fcryst_freq; //frequency [MHz]*2^21
// fcryst freq [MHz]*2^24
extern avr_freq_t f_mul; // mul for set freq in 11.21 format
 
typedef union _offset
{
long qw; // signed offset in 11.21 format
unsigned char bytes[4];
} offset_t;
 
extern offset_t f_sub;
 
extern unsigned char registers[6];
 
extern BYTE abpf_flag;
extern double Smooth_double;
extern double fcryst_double;
extern WORD_VAL FilterCrossOver[8]; // 11.5 bit value Mhz
extern float FilterSwitchOver[7];
extern WORD_VAL LPFCrossOver[8];
extern float LPFSwitchOver[7];
 
/** P U B L I C P R O T O T Y P E S *****************************************/
void UserInit(void);
void ProcessIO(void);
void Set_Freq_Handler(void);
void Set_Register_Handler(void);
void Set_Cal_Handler(void);
void Set_Init_Freq_Handler(void);
void Set_Smooth_Handler(void);
void Set_Sub_Mul_Handler(void);
 
void Reset_Si570(void);
void Freeze (void);
void Unfreeze (void);
void Prep_rd (unsigned short);
void WriteBk (void);
void NewF (void);
void SetNewFreq(void);
void ReadRegs(void);
void ReadStartUpConfiguration(void);
void RunFreqProg(double);
void SetFrequency(double);
void Set_BPF(float);
void Set_LPF(float);
float Cross2Switch(WORD_VAL);
WORD_VAL Switch2Cross(float);
double Freq_From_Register(double);
 
void Read_Command_Into_Buffer(void);
void USBCheckUserRequest(void);
void USBCheckUBWRequest(void);
 
#endif //PICDEM_FS_DEMO_H
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/user.c
0,0 → 1,1278
/********************************************************************
FileName: user.c
Dependencies: See INCLUDES section
Processor: PIC18 or PIC24 USB Microcontrollers
Hardware: The code is natively intended to be used on the following
hardware platforms: PICDEM™ FS USB Demo Board,
PIC18F87J50 FS USB Plug-In Module, or
Explorer 16 + PIC24 USB PIM. The firmware may be
modified for use on other USB platforms by editing the
HardwareProfile.h file.
Complier: Microchip C18 (for PIC18) or C30 (for PIC24)
* Company: Microchip Technology, Inc.
*
* Software License Agreement
 
The software supplied herewith by Microchip Technology Incorporated
(the “Company”) for its PIC® Microcontroller is intended and
supplied to you, the Company’s customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
* Any use in violation of the foregoing restrictions may subject the
* user to criminal sanctions under applicable laws, as well as to
* civil liability for the breach of the terms and conditions of this
* license.
*
* THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 
********************************************************************
File Description:
 
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
********************************************************************/
 
/** INCLUDES *******************************************************/
#include "usb.h"
 
#include "HardwareProfile.h"
#include "user.h"
#include "usbavrcmd.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
 
#if defined(__18CXX)
#include <delays.h>
#include <i2c.h>
#include <eep.h>
#elif defined(__PIC32MX__)
#include <peripheral/i2c.h>
#include <dee_emulation/dee_emulation_pic32.h>
#endif
 
#if defined (UBW)
#pragma romdata dataEEPROM=0xF00000
// F_CAL_DONE, 4 bytes cal data, F_INIT_FREQ, 4 bytes freq, F_SMOOTH, 2 bytes
// F_SUB_MUL, 4 bytes sub and 4 bytes mul
// F_CROSS_OVER, 16 bytes or 8 words of 7 cross over points and 1 flag for BPF
// followed by 16 bytes or 8 words of 7 cross over points and 1 flag for LPF
// F_BLINK_LED, 1 byte boolean
rom unsigned char init_data[] = {0xff, 0,0,0,0, 0xff, 0,0,0,0, 0xff, 0,0,
0xff, 0,0,0,0,0,0,0,0,
0xff, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
TRUE};
#endif
 
/** V A R I A B L E S ********************************************************/
#pragma udata
BYTE old_SW;
 
 
BYTE i2c_adr;
BYTE command;
BYTE replybuf[8];
WORD wCount;
BYTE abpf_flag;
 
COMMAND_BUFFER_t command_buffer[COMMAND_BUFFER_SIZE];
BYTE current_command_in, current_command_out;
BYTE command_count;
 
avr_freq_t avr_freq, fcryst_freq; // avr freq [MHz]*2^21
// fcryst freq [Mhz]*2^24
unsigned short R137, R135 = 0;
unsigned char registers[6];
unsigned char tempBuf[8];
unsigned char counter;
double delta_rfreq;
double rfreq, Old_rfreq;
double fcryst_double, Old_freq_double, Smooth_double;
 
double set_frequency;
avr_freq_t f_mul;
offset_t f_sub;
unsigned char validCombo;
 
 
 
#if defined(__18F14K50) || defined(__18F13K50) || defined(__18LF14K50) || defined(__18LF13K50)
#pragma udata usbram2
#elif defined(__18F2455) || defined(__18F2550) || defined(__18F4455) || defined(__18F4550)\
|| defined(__18F4450) || defined(__18F2450)\
|| defined(__18F2458) || defined(__18F2453) || defined(__18F4558) || defined(__18F4553)
#pragma udata USB_VARIABLES=0x500
#else
#pragma udata
#endif
 
 
#pragma udata
 
BOOL blinkStatusValid = TRUE;
 
 
/** P R I V A T E P R O T O T Y P E S ***************************************/
 
void BlinkUSBStatus(void);
BOOL SwitchIsPressed(void);
void ServiceRequests(void);
 
 
 
 
 
/** D E C L A R A T I O N S **************************************************/
#pragma code
 
float Cross2Switch(WORD_VAL val){ // convert from 11.5 bit format in [Mhz]
float whole, fraction;
whole = (float) (val.Val >> 5);
fraction = ((float) (val.Val & 0x001f)) / 32.0;
return (whole + fraction);
}
 
WORD_VAL Switch2Cross(float val){ // convert from float to 11.5 bit format [Mhz]
WORD_VAL w;
unsigned int i;
i = val;
w.Val = i * 32.0;
w.Val += (val - (float) i) * 32.0;
return (w);
}
 
 
void UserInit(void)
{
WORD_VAL w;
 
//#if defined (UBW)
// unsigned char i;
//#elif
unsigned int i;
unsigned int value;
//#endif
 
#if defined(UBW)
// Port A - RA0 BPF_S0, RA1 BPF_S1, RA2 RXTX, RA3-5 LPF0-2
LATA = 0x00;
TRISA = 0x00; // 00000000
 
// Turn all analog inputs into digital inputs
ADCON1 = 0x0F;
// Turn off the ADC
ADCON0bits.ADON = 0;
CMCON = 0x07; // Comparators as digital inputs
// RB0-1 for i2c, RB6-7 Paddle dit/dah, RB2-5 LPF 3-6
LATB = 0x00;
TRISB = 0xc3; // 11000011
INTCON2bits.RBPU = 0; // enable RB weak internal pullup
// Make all of PORTC inputs
LATC = 0x00;
TRISC = 0xFF;
 
mInitAllLEDs();
mInitSwitch();
old_SW = UserSW;
 
#elif defined(UBW32)
 
// gO through each I/O register, setting them all to digital i/o
// and making none of them open drain and turning off all pullups and
// setting all of the latches to zero. We have PORTA through PORTG on
// this chip. That's 7 total.
 
 
LATA = 0x0000;
TRISA = 0x0000;
ODCA = 0x0000;
LATB = 0x0000;
TRISB = 0x0000;
ODCB = 0x0000;
LATC = 0x0000;
TRISC = 0x0000;
ODCC = 0x0000;
LATD = 0x0000;
TRISD = 0x0000;
ODCD = 0x0000;
LATE = 0x0000;
TRISE = 0x0000;
ODCE = 0x0000;
LATF = 0x0000;
TRISF = 0x0030; // RF4-5 paddle input
ODCF = 0x0000;
CNPUE = 0x060000; // Pull up on CNPUE17-18, corresponding to RF4-5
LATG = 0x0000;
TRISG = 0x0000;
ODCG = 0x0000;
 
//Initialize all of the LED pins
mInitAllLEDs();
 
mInitAllSwitches();
old_SW = UserSW;
 
// Initialize Data EEPROM Emulation
if (DataEEInit()) {
mLED_4_On(); // Error occured
}
else {
mLED_4_Off();
};
 
#endif
 
i2c_adr = DEFAULT_I2C_ADDRESS;
 
// check for previous calibration, which sets fcryst, the actual crystal freq
#if defined (UBW)
if (Read_b_eep(F_CAL_DONE) != F_CAL_DONE_VALUE){ // cal not done before, use default
fcryst_freq.qw = (double) DEFAULT_FCRYST * (double) (1L << 24); // 114.285 Mhz
}
else { // cal done before, read into fcryst
for (i=0; i<4; i++) fcryst_freq.bytes[i] = Read_b_eep(i + F_CAL_DONE +1);
};
 
#elif defined (UBW32)
DataEERead(&value, F_CAL_DONE);
if ( value != F_CAL_DONE_VALUE){ // cal not done before, use default
fcryst_freq.qw = (double) DEFAULT_FCRYST * (double) (1L << 24); // 114.285 Mhz
}
else { // cal done before, read into fcryst
DataEERead(&value, (F_CAL_DONE +1));
fcryst_freq.qw = value;
};
#endif
 
// Now that fcryst is checked, set it first so that it can be used by startup freq setting
 
fcryst_double = (double) fcryst_freq.qw / (double) (1L << 24);
validCombo = 1;
command_count = 0;
current_command_in = 0;
current_command_out = 0;
Old_freq_double = 0;
 
// check for previous startup freq setting
#if defined (UBW)
if (Read_b_eep(F_INIT_FREQ) != F_INIT_FREQ_VALUE){ // not set before, use default
avr_freq.qw = (double) DEFAULT_INIT_FREQ * (double) (1L << 21);
}
else { // startup freq set before, read into avr
for (i=0; i<4; i++) avr_freq.bytes[i] = Read_b_eep(i + F_INIT_FREQ +1);
};
 
#elif defined (UBW32)
DataEERead(&value, F_INIT_FREQ);
if ( value != F_INIT_FREQ_VALUE){ // not set before, use default
avr_freq.qw = (double) DEFAULT_INIT_FREQ * (double) (1L << 21);
}
else { // set before, read
DataEERead(&value, (F_INIT_FREQ +1));
avr_freq.qw = value;
};
 
#endif
 
 
 
// check for previous smooth setting
#if defined (UBW)
if (Read_b_eep(F_SMOOTH) != F_SMOOTH_VALUE){ // not set before, use default
Smooth_double = (double) DEFAULT_SMOOTH / 1000000L; // in ppm
}
else { // set before, read
for (i=0; i<2; i++) w.v[i] = Read_b_eep(i + F_SMOOTH +1);
Smooth_double = (double) w.Val / 1000000L;
};
 
#elif defined (UBW32)
DataEERead(&value, F_SMOOTH);
if ( value != F_SMOOTH_VALUE){ // not set before, use default
Smooth_double = (double) DEFAULT_SMOOTH / 1000000L;
}
else { // set before, read
DataEERead(&value, (F_SMOOTH +1));
w.Val = value;
Smooth_double = (double) w.Val / 1000000L;
}
#endif
 
// check for previous sub mul setting
#if defined (UBW)
if (Read_b_eep(F_SUB_MUL) != F_SUB_MUL_VALUE){ // not set before, use default
f_sub.qw = (double) DEFAULT_SUB * (double) (1L << 21);
f_mul.qw = (double) DEFAULT_MUL * (double) (1L << 21);
}
else { // startup freq set before, read into avr
for (i=0; i<4; i++) f_sub.bytes[i] = Read_b_eep(i + F_SUB_MUL +1);
for (i=0; i<4; i++) f_mul.bytes[i] = Read_b_eep(i + F_SUB_MUL +5);
};
 
#elif defined (UBW32)
DataEERead(&value, F_SUB_MUL);
if ( value != F_SUB_MUL_VALUE){ // not set before, use default
f_sub.qw = (double) DEFAULT_SUB * (double) (1L << 21);
f_mul.qw = (double) DEFAULT_MUL * (double) (1L << 21);
}
else { // set before, read
DataEERead(&value, (F_SUB_MUL +1));
f_sub.qw = value;
DataEERead(&value, (F_SUB_MUL +2));
f_mul.qw = value;
};
 
#endif
 
 
 
 
 
// Check for Cross Over Points
#if defined (UBW)
if (Read_b_eep(F_CROSS_OVER) != F_CROSS_OVER_VALUE){ // not set before, use default
 
#if defined (YAS)
FilterSwitchOver[0] = (2.4 - DEFAULT_SUB) * DEFAULT_MUL * 4.0; // default BPF switchover points
FilterSwitchOver[1] = (8.5 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
FilterSwitchOver[2] = (19.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
FilterSwitchOver[3] = (19.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
FilterSwitchOver[4] = (19.0 - DEFAULT_SUB) * DEFAULT_MUL* 4.0;
FilterSwitchOver[5] = (19.0 - DEFAULT_SUB) * DEFAULT_MUL* 4.0;
FilterSwitchOver[6] = (19.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
#else
FilterSwitchOver[0] = (2.4 - DEFAULT_SUB) * DEFAULT_MUL * 4.0; // default BPF switchover points
FilterSwitchOver[1] = (8.5 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
FilterSwitchOver[2] = (19.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
#endif
for (i = 0; i < (NUM_BPF - 1); i++) FilterCrossOver[i] = Switch2Cross(FilterSwitchOver[i]);
FilterCrossOver[(NUM_BPF-1)].Val = 1; // Enabled
abpf_flag = 1;
 
#if defined (K5OOR)
LPFSwitchOver[0] = (2.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[1] = (4.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[2] = (7.45 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[3] = (15.0 - DEFAULT_SUB) * DEFAULT_MUL* 4.0;
LPFSwitchOver[4] = (21.5 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[5] = (30.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[6] = (30.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
#elif defined (ALEX)
LPFSwitchOver[0] = (2.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[1] = (4.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[2] = (9.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[3] = (11.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[4] = (14.5 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[5] = (20.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[6] = (30.0 - DEFAULT_SUB) * DEFAULT_MUL* 4.0;
#elif defined (MARC)
LPFSwitchOver[0] = (2.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[1] = (4.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[2] = (8.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[3] = (11.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[4] = (14.5 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[5] = (18.2 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[6] = (21.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
#else
#error "Must define an LPF configuration."
#endif
 
for (i = 0; i < 7; i++) LPFCrossOver[i] = Switch2Cross(LPFSwitchOver[i]);
LPFCrossOver[7].Val = 1; // Enabled
}
else { // set before, read
for (i = 0; i < NUM_BPF; i++){
w.v[0] = Read_b_eep(2 * i + F_CROSS_OVER +1);
w.v[1] = Read_b_eep(2 * i + 1 + F_CROSS_OVER + 1);
FilterCrossOver[i].Val = w.Val;
};
 
abpf_flag = FilterCrossOver[(NUM_BPF-1)].v[0];
 
for (i = 0; i < 8; i++){
w.v[0] = Read_b_eep(2 * i + F_CROSS_OVER +17);
w.v[1] = Read_b_eep(2 * i + 1 + F_CROSS_OVER + 17);
LPFCrossOver[i].Val = w.Val;
};
 
}
 
#elif defined (UBW32)
DataEERead(&value, F_CROSS_OVER);
if ( value != F_CROSS_OVER_VALUE){ // not set before, use default
FilterSwitchOver[0] = (2.4 - DEFAULT_SUB) * DEFAULT_MUL * 4.0; // default BPF switchover points
FilterSwitchOver[1] = (8.5 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
FilterSwitchOver[2] = (19.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
for (i = 0; i < 3; i++) FilterCrossOver[i] = Switch2Cross(FilterSwitchOver[i]);
FilterCrossOver[3].Val = 1; // Enabled
abpf_flag = 1;
 
#if defined (K5OOR)
LPFSwitchOver[0] = (2.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[1] = (4.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[2] = (7.45 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[3] = (15.0 - DEFAULT_SUB) * DEFAULT_MUL* 4.0;
LPFSwitchOver[4] = (21.5 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[5] = (30.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[6] = (30.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
#elif defined (ALEX)
LPFSwitchOver[0] = (2.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[1] = (4.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[2] = (9.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[3] = (11.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[4] = (14.5 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[5] = (20.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[6] = (30.0 - DEFAULT_SUB) * DEFAULT_MUL* 4.0;
#elif defined (MARC)
LPFSwitchOver[0] = (2.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[1] = (4.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[2] = (8.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[3] = (11.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[4] = (14.5 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[5] = (18.2 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
LPFSwitchOver[6] = (21.0 - DEFAULT_SUB) * DEFAULT_MUL * 4.0;
#else
#error "Must define an LPF configuration."
#endif
 
for (i = 0; i < 7; i++) LPFCrossOver[i] = Switch2Cross(LPFSwitchOver[i]);
LPFCrossOver[7].Val = 1; // Enabled
 
 
}
else { // set before, read
for (i=0; i< NUM_BPF; i++) {
DataEERead(&value, (i + F_CROSS_OVER +1));
FilterCrossOver[i].Val = value;
};
 
 
abpf_flag = FilterCrossOver[(NUM_BPF-1)].Val;
 
for (i=0; i<8; i++) {
DataEERead(&value, (i + F_CROSS_OVER +9));
LPFCrossOver[i].Val = value;
};
};
#endif // UBW32
 
for (i = 0; i < (NUM_BPF-1); i++) FilterSwitchOver[i] = Cross2Switch(FilterCrossOver[i]);
for (i = 0; i < 7; i++) LPFSwitchOver[i] = Cross2Switch(LPFCrossOver[i]);
 
// End initialising filter switchover points
 
#if defined(UBW)
blinkStatusValid = Read_b_eep(F_BLINK_LED);
#elif defined (UBW32)
DataEERead(&value, F_BLINK_LED);
blinkStatusValid = value;
#endif
 
#if defined (UBW)
OpenI2C(MASTER, SLEW_ON);// Initialize I2C module
SSPADD = 48; //400kHz Baud clock(9) @16MHz
//100kHz Baud clock(39) @16MHz
 
#elif defined (UBW32)
OpenI2C1(I2C_ON, ( GetPeripheralClock() / 400000UL - 2) );
#endif
 
// IF we don't reset Si570 on startup, it will not hang if Si570 not connected
#if defined (INIT_SI570_ON_STARTUP)
Reset_Si570();
#endif
 
// check for previous startup freq setting, if set, then set Si570 to startup freq
#if defined (UBW32)
DataEERead(&value, F_INIT_FREQ);
if ( value == F_INIT_FREQ_VALUE){
#else
if (Read_b_eep(F_INIT_FREQ) == F_INIT_FREQ_VALUE){
#endif
// avr_freq has been setup by the reading of the startup freq
set_frequency = (double) avr_freq.qw / (double)(1L << 21);
SetFrequency(set_frequency);
};
 
}//end UserInit
 
 
/******************************************************************************
* Function: void ProcessIO(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: This function is a place holder for other user routines.
* It is a mixture of both USB and non-USB tasks.
*
* Note: None
*****************************************************************************/
void ProcessIO(void)
{
if (SwitchIsPressed()){
blinkStatusValid = !blinkStatusValid; // toggle blink led
#if defined(UBW)
Write_b_eep(F_BLINK_LED, blinkStatusValid);
#elif defined(UBW32)
DataEEWrite(blinkStatusValid, F_BLINK_LED);
#endif
};
 
//Blink the LEDs according to the USB device status
if(blinkStatusValid) BlinkUSBStatus();
else mLED_Both_Off();
// User Application USB tasks
if((USBDeviceState < ADDRESS_STATE)||(USBSuspendControl==1)) return;
 
//respond to any USB commands that might have come over the bus
ServiceRequests();
 
 
}//end ProcessIO
 
 
/******************************************************************************
* Function: void ServiceRequests(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: USB traffic can be generated
*
* Overview: This function takes in the commands from the PC from the
* application and executes the commands requested
*
* Note: None
*****************************************************************************/
void ServiceRequests(void)
{
BYTE command_to_process;
 
if (command_count > 0) { // there is command in buffer
command_to_process = command_buffer[current_command_out].command;
 
switch (command_to_process){
case CMD_SET_FREQ_REG:
Set_Register_Handler();
break;
case CMD_SET_LO_SM:
Set_Sub_Mul_Handler();
break;
case CMD_SET_FREQ:
Set_Freq_Handler();
break;
case CMD_SET_XTAL:
Set_Cal_Handler();
break;
case CMD_SET_STARTUP:
Set_Init_Freq_Handler();
break;
case CMD_SET_PPM:
Set_Smooth_Handler();
break;
};
// end switch
current_command_out++;
if (current_command_out >= COMMAND_BUFFER_SIZE) current_command_out = 0;
command_count--;
} // end command_count > 0
 
 
}//end ServiceRequests
 
/********************************************************************
* Function: void BlinkUSBStatus(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: BlinkUSBStatus turns on and off LEDs
* corresponding to the USB device state.
*
* Note: mLED macros can be found in HardwareProfile.h
* USBDeviceState is declared and updated in
* usb_device.c.
*******************************************************************/
void BlinkUSBStatus(void)
{
static WORD led_count=0;
if(led_count == 0)led_count = 10000U;
led_count--;
 
 
if(USBSuspendControl == 1)
{
if(led_count==0)
{
mLED_1_Toggle();
mLED_2 = mLED_1;
}//end if
}
else
{
if(USBDeviceState == DETACHED_STATE)
{
mLED_1_Off(); mLED_2_Off();
}
else if(USBDeviceState == ATTACHED_STATE)
{
mLED_1_On(); mLED_2_On();
}
else if(USBDeviceState == POWERED_STATE)
{
mLED_1_On(); mLED_2_Off();
}
else if(USBDeviceState == DEFAULT_STATE)
{
mLED_1_Off(); mLED_2_On();
}
else if(USBDeviceState == ADDRESS_STATE)
{
if(led_count == 0)
{
mLED_1_Toggle();
mLED_2_Off();
}//end if
}
else if(USBDeviceState == CONFIGURED_STATE)
{
if(led_count==0)
{
mLED_1_Toggle();
mLED_2 = !mLED_1;
 
}//end if
}//end if(...)
}//end if(UCONbits.SUSPND...)
 
}//end BlinkUSBStatus
 
 
/******************************************************************************
* Function: BOOL SwitchIsPressed(void)
*
* PreCondition: None
*
* Input: None
*
* Output: BOOL - TRUE if the SW2 was pressed and FALSE otherwise
*
* Side Effects: None
*
* Overview: returns TRUE if the SW2 was pressed and FALSE otherwise
*
* Note: None
*****************************************************************************/
 
BOOL SwitchIsPressed(void)
{
if(UserSW != old_SW)
{
old_SW = UserSW; // Save new value
if(UserSW == 0) // If pressed
return TRUE; // Was pressed
}//end if
return FALSE; // Was not pressed
}//end SwitchIsPressed
 
void Reset_Si570()
{
#if defined (UBW)
StartI2C(); //Reset Si570 to Startup
IdleI2C();
WriteI2C(i2c_adr << 1);
WriteI2C(135); //REG 135
WriteI2C(0x01); // reset
StopI2C();
IdleI2C();
#elif defined (UBW32)
StartI2C1(); //Reset Si570 to Startup
IdleI2C1();
MasterWriteI2C1(i2c_adr << 1);
MasterWriteI2C1(135); //REG 135
MasterWriteI2C1(0x01); // reset
StopI2C1();
IdleI2C1();
#endif
 
}
 
void ReadRegs()
{
unsigned int i;
 
for(i=0;i<6;i++)
{
 
#if defined (UBW)
StartI2C();
IdleI2C();
WriteI2C(i2c_adr << 1);
WriteI2C(i+7); //specify register
RestartI2C();
IdleI2C();
WriteI2C(i2c_adr << 1 | 0x01);
registers[i] = ReadI2C();
StopI2C();
IdleI2C();
#elif defined (UBW32)
StartI2C1();
IdleI2C1();
MasterWriteI2C1(i2c_adr << 1);
MasterWriteI2C1(i+7);
RestartI2C1();
IdleI2C1();
MasterWriteI2C1(i2c_adr << 1 | 0x01);
registers[i] = MasterReadI2C1();
StopI2C1();
IdleI2C1();
#endif
}
}
 
 
void Freeze () {
Prep_rd(137); //get current value
#if defined (UBW)
R137 = ReadI2C();
#elif defined (UBW32)
R137 = MasterReadI2C1();
#endif
R137 = R137 | 0x10; //turn on freeze
WriteBk();
}
 
void Unfreeze () {
Prep_rd(137);
#if defined (UBW)
R137 = ReadI2C();
#elif defined (UBW32)
R137 = MasterReadI2C1();
#endif
R137 = R137 & 0xEF;
WriteBk();
}
 
void WriteBk () { //Write back
#if defined (UBW)
StopI2C();
IdleI2C();
StartI2C();
IdleI2C();
WriteI2C(i2c_adr<<1);
WriteI2C(137); //REG
WriteI2C(R137); // new data
StopI2C();
IdleI2C();
#elif defined (UBW32)
StopI2C1();
IdleI2C1();
StartI2C1();
IdleI2C1();
MasterWriteI2C1(i2c_adr<<1);
MasterWriteI2C1(137); //REG
MasterWriteI2C1(R137); // new data
StopI2C1();
IdleI2C1();
#endif
}
 
void Prep_rd (unsigned short r) { // get ready to read
#if defined (UBW)
StartI2C();
IdleI2C();
WriteI2C(i2c_adr<<1);
WriteI2C(r); //REG
RestartI2C();
IdleI2C();
WriteI2C(i2c_adr<<1 | 0x01);
#elif defined (UBW32)
StartI2C1();
IdleI2C1();
MasterWriteI2C1(i2c_adr<<1);
MasterWriteI2C1(r); //REG
RestartI2C1();
IdleI2C1();
MasterWriteI2C1(i2c_adr<<1 | 0x01);
#endif
}
 
void NewF () {
 
Prep_rd(135);
 
#if defined (UBW)
R135 = ReadI2C();
R135 |= 0x40; // set New Data bit
StopI2C();
IdleI2C();
StartI2C();
IdleI2C();
WriteI2C(i2c_adr<<1);
WriteI2C(135); //REG
WriteI2C(R135);
StopI2C();
IdleI2C();
#elif defined (UBW32)
R135 = MasterReadI2C1();
R135 |= 0x40; // set New Data bit
StopI2C1();
IdleI2C1();
StartI2C1();
IdleI2C1();
MasterWriteI2C1(i2c_adr<<1);
MasterWriteI2C1(135); //REG
MasterWriteI2C1(R135);
StopI2C1();
IdleI2C1();
#endif
}
 
 
 
void RunFreqProg(double f)
{
double rfreq_fraction;
unsigned long rfreq_integer_part;
unsigned long rfreq_fraction_part;
const float FDCO_MAX = 5670; //MHz
const float FDCO_MIN = 4850;
 
// Register finding the lowest DCO frequenty - code from Fred
unsigned char xHS_DIV;
unsigned int xN1;
unsigned int xN;
 
// Registers to save the found dividers
unsigned char sHS_DIV=0;
unsigned char sN1=0;
unsigned int sN=0; // Total dividing
unsigned int N0; // Total divider needed (N1 * HS_DIV)
 
// Find the total division needed.
// It is always one too low (not in the case reminder is zero, reminder not used here).
 
N0 = FDCO_MIN / (float) f;
sN = 11*128;
for(xHS_DIV = 11; xHS_DIV > 3; xHS_DIV--)
{
// Skip the unavailable divider's
if (xHS_DIV == 8 || xHS_DIV == 10)
continue;
 
// Calculate the needed low speed divider
xN1 = N0 / xHS_DIV + 1;
 
if (xN1 > 128)
continue;
 
// Skip the unavailable divider's
if (xN1 != 1 && (xN1 & 1) == 1)
xN1 += 1;
 
xN = xHS_DIV * xN1;
if (sN > xN)
{
sN = xN;
sN1 = xN1;
sHS_DIV = xHS_DIV;
}
};
 
validCombo = 0;
 
if (sHS_DIV == 0) return; // no valid dividers found
 
rfreq = f * (double) sN; // DCO freq
if ((float)rfreq > FDCO_MAX) return; // calculated DCO freq > max
 
validCombo = 1;
 
// rfreq is a 38 bit number, MSB 10 bits integer portion, and LSB 28 fraction
// in the Si570 registers, tempBuf[1] has 6 bits, and tempBuf[2] has 4 bits of the integer portion
 
rfreq /= fcryst_double; // DCO divided by fcryst
rfreq_integer_part = rfreq;
rfreq_fraction = rfreq - rfreq_integer_part;
rfreq_fraction_part = rfreq_fraction * (1L << 28);
 
sHS_DIV -= 4;
sN1 -= 1;
tempBuf[0] = (sHS_DIV << 5) | (sN1 >> 2);
tempBuf[1] = (sN1 & 3) << 6;
tempBuf[1] |= ((rfreq_integer_part >> 4) & 0x3f);
tempBuf[2] = ((rfreq_integer_part & 0x0f) << 4) | (rfreq_fraction_part >> 24);
tempBuf[3] = rfreq_fraction_part >> 16;
tempBuf[4] = rfreq_fraction_part >> 8;
tempBuf[5] = rfreq_fraction_part;
 
}
 
 
void SetNewFreq()
{ int i;
double freq_double;
double delta_freq;
 
if(validCombo)
{
 
Freeze(); // freeze DCO
 
for (i=7; i<=12; i++){ //Data to Si570
#if defined (UBW)
StartI2C();
IdleI2C();
WriteI2C(i2c_adr<<1);
WriteI2C(i); //specify register
WriteI2C(tempBuf[i-7]); // new data to registers
StopI2C();
IdleI2C();
#elif defined (UBW32)
StartI2C1();
IdleI2C1();
MasterWriteI2C1(i2c_adr<<1);
MasterWriteI2C1(i); //specify register
MasterWriteI2C1(tempBuf[i-7]); // new data to registers
StopI2C1();
IdleI2C1();
#endif
}
Unfreeze (); // thaw (unfreeze)
 
// check for smooth tune range
freq_double = Freq_From_Register(fcryst_double);
 
if (freq_double >= Old_freq_double) delta_freq = freq_double - Old_freq_double;
else delta_freq = Old_freq_double - freq_double;
 
if (((delta_rfreq / Old_rfreq ) > Smooth_double) || (delta_freq > 0.5)){
NewF (); // indicate new freq. This will cause a pause in the Si570 output
Old_rfreq = rfreq;
Old_freq_double = freq_double;
};
 
// set filters, using set freq without offset and multiplier
 
if (abpf_flag) Set_BPF((float) set_frequency);
Set_LPF((float)set_frequency);
 
}; // valid combo
}
 
double Freq_From_Register(double fcryst){ // side effects: rfreq and delta_rfreq are set
double freq_double;
unsigned char n1;
unsigned char hsdiv;
unsigned long rfreq_integer_portion, rfreq_fraction_portion;
 
// Now find out the current rfreq and freq
 
hsdiv = ((tempBuf[0] & 0xE0) >> 5) + 4;
n1 = ((tempBuf[0] & 0x1f ) << 2 ) + ((tempBuf[1] & 0xc0 ) >> 6 );
// if(n1 == 0) n1 = 1;
// else if((n1 & 1) !=0) n1 += 1;
n1 += 1;
 
rfreq_integer_portion = ((unsigned long)(tempBuf[1] & 0x3f)) << 4 |
((unsigned long)(tempBuf[2] & 0xf0)) >> 4;
 
rfreq_fraction_portion = ((unsigned long) (tempBuf[2] & 0x0f)) << 24;
rfreq_fraction_portion += ((unsigned long)(tempBuf[3])) << 16;
rfreq_fraction_portion += ((unsigned long)(tempBuf[4])) << 8;
rfreq_fraction_portion += ((unsigned long)(tempBuf[5]));
 
rfreq = (double)rfreq_integer_portion + ((double)rfreq_fraction_portion / (1L << 28));
 
if (rfreq >= Old_rfreq) delta_rfreq = rfreq - Old_rfreq;
else delta_rfreq = Old_rfreq - rfreq;
 
freq_double = fcryst * rfreq / (double) hsdiv / (double) n1;
return (freq_double);
}
 
 
 
void Set_BPF(float freq){ // note the freq used is the Si570 freq
 
#if defined(YAS)
if (freq < FilterSwitchOver[0]) {BPF_S2 = 0;BPF_S1 = 0; BPF_S0 = 0;}
else if (freq < FilterSwitchOver[1]) {BPF_S2 = 0; BPF_S1=0;BPF_S0=1;}
else if (freq < FilterSwitchOver[2]) {BPF_S2 = 0;BPF_S1=1;BPF_S0=0;}
else if (freq < FilterSwitchOver[3]) {BPF_S2 = 0; BPF_S1 = 1; BPF_S0 = 1;}
else if (freq < FilterSwitchOver[4]) {BPF_S2 = 1; BPF_S1 = 0; BPF_S0 = 0;}
else if (freq < FilterSwitchOver[5]) {BPF_S2 = 1; BPF_S1 = 0; BPF_S0 = 1;}
else if (freq < FilterSwitchOver[6]) {BPF_S2 = 1; BPF_S1 = 1; BPF_S0 = 0;}
else {BPF_S2 = 1;BPF_S1=1; BPF_S0=1;};
 
#else
if (freq < FilterSwitchOver[0]) {BPF_S1 = 0; BPF_S0 = 0;}
else if (freq < FilterSwitchOver[1]) {BPF_S1=0;BPF_S0=1;}
else if (freq < FilterSwitchOver[2]) {BPF_S1=1;BPF_S0=0;}
else {BPF_S1=1; BPF_S0=1;};
#endif
}
 
void Set_LPF(float freq){
 
unsigned char LPF_select;
 
LPF_0 = 0;
LPF_1 = 0;
LPF_2 = 0;
 
#if defined(YAS)
if (freq < LPFSwitchOver[0]) {LPF_0 = 0; LPF_1 = 0; LPF_2 = 0; LPF_select = 0x01;}
else if (freq < LPFSwitchOver[1]) {LPF_0 = 1; LPF_1 = 0; LPF_2 = 0; LPF_select = 0x02;}
else if (freq < LPFSwitchOver[2]) {LPF_0 = 0; LPF_1 = 1; LPF_2 = 0; LPF_select = 0x04;}
else if (freq < LPFSwitchOver[3]) {LPF_0 = 1; LPF_1 = 1; LPF_2 = 0; LPF_select = 0x08;}
else if (freq < LPFSwitchOver[4]) {LPF_0 = 0; LPF_1 = 0; LPF_2 = 1; LPF_select = 0x10;}
else if (freq < LPFSwitchOver[5]) {LPF_0 = 1; LPF_1 = 0; LPF_2 =1; LPF_select = 0x20;}
else if (freq < LPFSwitchOver[6]) {LPF_0 = 0; LPF_1 = 1; LPF_2 = 1; LPF_select = 0x40;}
else {LPF_0 = 1; LPF_1 = 1; LPF_2 = 1; LPF_select = 0x80;};
 
#else
LPF_3 = 0;
LPF_4 = 0;
LPF_5 = 0;
LPF_6 = 0;
 
if (freq < LPFSwitchOver[0]) {LPF_0 = 1; LPF_select = 0x01;}
else if (freq < LPFSwitchOver[1]) {LPF_1 = 1; LPF_select = 0x02;}
else if (freq <= LPFSwitchOver[2]) {LPF_2 = 1; LPF_select = 0x04;}
else if (freq < LPFSwitchOver[3]) {LPF_3 = 1; LPF_select = 0x08;}
else if (freq < LPFSwitchOver[4]) {LPF_4 = 1; LPF_select = 0x10;}
else if (freq < LPFSwitchOver[5]) {LPF_5 = 1; LPF_select = 0x20;}
else if (freq < LPFSwitchOver[6]) {LPF_6 = 1; LPF_select = 0x40;}
else {LPF_6 = 1; LPF_select = 0x80;};
 
#endif
 
 
 
// Now use i2c bus to switch LPF
#if defined (UBW)
StartI2C();
IdleI2C();
WriteI2C(PCF8574 << 1);
WriteI2C(LPF_select);
StopI2C();
IdleI2C();
#elif defined (UBW32)
StartI2C1();
IdleI2C1();
MasterWriteI2C1(PCF8574 << 1);
MasterWriteI2C1(LPF_select);
StopI2C1();
IdleI2C1();
#endif
 
 
}
 
void SetFrequency(double f)
{
// introduce the offset and mul here
RunFreqProg((f - ((double)f_sub.qw / (double)(1L << 21))) * (double)f_mul.qw/(double)(1L <<21));
SetNewFreq();
}
 
void Set_Freq_Handler(void){ // 4 byte freq value in avr_freq format
BYTE i;
if (command_buffer[current_command_out].wCount == 4){
for (i=0; i<4; i++) avr_freq.bytes[i] = command_buffer[current_command_out].data[i];
set_frequency = (double) avr_freq.qw / (double)(1L << 21);
SetFrequency(set_frequency);
}
}
void Set_Register_Handler(void){ // 6 byte register value
unsigned char i;
 
if (command_buffer[current_command_out].wCount == 6){
for (i=0; i<6; i++) tempBuf[i] = command_buffer[current_command_out].data[i];
set_frequency = Freq_From_Register(DEFAULT_FCRYST);
SetFrequency(set_frequency);
}
}
 
void Set_Cal_Handler(void){
 
// 4 bytes of fcryst freq in avr_freq format
int i;
 
if (command_buffer[current_command_out].wCount == 4){
 
for (i=0; i<4; i++)fcryst_freq.bytes[i] = command_buffer[current_command_out].data[i];
fcryst_double = (double) fcryst_freq.qw / (double)(1L << 24);
 
#if defined(UBW)
for (i=0; i<4; i++){
Write_b_eep (i+F_CAL_DONE+1, fcryst_freq.bytes[i]);
Busy_eep ();
};
#elif defined (UBW32)
DataEEWrite( (unsigned int) fcryst_freq.qw, (F_CAL_DONE + 1));
#endif
#if defined (UBW)
Write_b_eep(F_CAL_DONE, F_CAL_DONE_VALUE);
Busy_eep();
#elif defined (UBW32)
DataEEWrite(F_CAL_DONE_VALUE, F_CAL_DONE);
#endif
};
}
 
void Set_Init_Freq_Handler(void)
{
#if defined (UBW)
unsigned char i;
#else
unsigned int i;
#endif
 
if (command_buffer[current_command_out].wCount == 4){
for (i=0; i<4; i++) avr_freq.bytes[i] = command_buffer[current_command_out].data[i];
#if defined (UBW)
for (i=0; i<4; i++){
Write_b_eep((i + F_INIT_FREQ +1), avr_freq.bytes[i]);
Busy_eep();
};
#elif defined (UBW32)
DataEEWrite( (unsigned int) avr_freq.qw, (F_INIT_FREQ +1));
#endif
 
#if defined (UBW)
Write_b_eep(F_INIT_FREQ, F_INIT_FREQ_VALUE);
Busy_eep();
#elif defined (UBW32)
DataEEWrite(F_INIT_FREQ_VALUE, F_INIT_FREQ);
#endif
};
}
 
void Set_Sub_Mul_Handler(void)
{
#if defined (UBW)
unsigned char i;
#else
unsigned int i;
#endif
 
avr_freq_t old_f_mul;
offset_t old_f_sub;
double filter_value;
 
if (command_buffer[current_command_out].wCount == 8){
 
old_f_sub = f_sub; // save old values first
old_f_mul = f_mul;
 
for (i=0; i<4; i++) f_sub.bytes[i] = command_buffer[current_command_out].data[i];
for (i=0; i<4; i++) f_mul.bytes[i] = command_buffer[current_command_out].data[i+4];
#if defined (UBW)
for (i=0; i<4; i++){
Write_b_eep((i + F_SUB_MUL +1), f_sub.bytes[i]);
Busy_eep();
};
for (i=0; i<4; i++){
Write_b_eep((i + F_SUB_MUL +5), f_mul.bytes[i]);
Busy_eep();
};
#elif defined (UBW32)
DataEEWrite( (unsigned int) f_sub.qw, (F_SUB_MUL +1));
DataEEWrite( (unsigned int) f_mul.qw, (F_SUB_MUL +5));
#endif
 
#if defined (UBW)
Write_b_eep(F_SUB_MUL, F_SUB_MUL_VALUE);
Busy_eep();
#elif defined (UBW32)
DataEEWrite(F_SUB_MUL_VALUE, F_SUB_MUL);
#endif
 
// Now update the filter switchover points as well
for (i = 0; i < (NUM_BPF - 1); i++){
// get back filter_value in Mhz
filter_value = FilterSwitchOver[i] / (old_f_mul.qw / ((double) (1L << 21))) / 4 + (old_f_sub.qw / ((double) (1L << 21)));
// now convert to new translated values
FilterSwitchOver[i] = (filter_value - (f_sub.qw / (double)(1L << 21))) * (f_mul.qw / (double)(1L << 21)) * 4;
FilterCrossOver[i] = Switch2Cross(FilterSwitchOver[i]);
};
for (i = 0; i < 7; i++){
// get back filter_value in Mhz
filter_value = LPFSwitchOver[i] / (old_f_mul.qw / ((double) (1L << 21))) / 4 + (old_f_sub.qw / ((double) (1L << 21)));
// now convert to new translated values
LPFSwitchOver[i] = (filter_value - (f_sub.qw / (double)(1L << 21))) * (f_mul.qw / (double)(1L << 21)) * 4;
LPFCrossOver[i] = Switch2Cross(LPFSwitchOver[i]);
};
}; // if wCount == 8
}
 
 
 
 
void Set_Smooth_Handler(void)
{
WORD_VAL w;
unsigned int i;
 
if (command_buffer[current_command_out].wCount == 2){ // 2 bytes of Smooth Tune value in ppm
w.v[0] = command_buffer[current_command_out].data[0];
w.v[1] = command_buffer[current_command_out].data[1];
 
Smooth_double = (double) w.Val / 1000000L;
 
#if defined (UBW)
for (i=0; i<2; i++){
Write_b_eep (i+F_SMOOTH+1, w.v[i]);
Busy_eep ();
};
 
#elif defined (UBW32)
DataEEWrite( (unsigned int) w.Val, (i + F_SMOOTH + 1));
#endif
#if defined (UBW)
Write_b_eep(F_SMOOTH, F_SMOOTH_VALUE);
Busy_eep();
#elif defined (UBW32)
DataEEWrite( F_SMOOTH_VALUE, F_SMOOTH);
#endif
 
}
}
 
 
 
/** EOF user.c ***************************************************************/
/Modules/Clock/CLKGEN01B/SW/DG8SAQ synthesiser_Emulator/user.h
0,0 → 1,197
/*********************************************************************
*
* Microchip USB C18 Firmware Version 1.2
*
*********************************************************************
* FileName: user.h
* Dependencies: See INCLUDES section below
* Processor: PIC18
* Compiler: C18 3.11+
* Company: Microchip Technology, Inc.
*
* Software License Agreement
*
* The software supplied herewith by Microchip Technology Incorporated
* (the “Company”) for its PICmicro® Microcontroller is intended and
* supplied to you, the Company’s customer, for use solely and
* exclusively on Microchip PICmicro Microcontroller products. The
* software is owned by the Company and/or its supplier, and is
* protected under applicable copyright laws. All rights are reserved.
* Any use in violation of the foregoing restrictions may subject the
* user to criminal sanctions under applicable laws, as well as to
* civil liability for the breach of the terms and conditions of this
* license.
*
* THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
* Author Date Comment
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Rawin Rojvanit 11/19/04 Original.
* Rawin Rojvanit 05/14/07 Minor updates.
********************************************************************/
 
#ifndef PICDEM_FS_DEMO_H
#define PICDEM_FS_DEMO_H
 
/** I N C L U D E S **********************************************************/
 
/** D E F I N I T I O N S ****************************************************/
 
// For custom LPF switchover points
#define ALEX
//#define K5OOR
//#define MARC
 
// YAS is defined in the HardwareProfile - UBW.h, if needed
 
#if defined(YAS)
#define NUM_BPF 8
#else
#define NUM_BPF 4
#endif
 
#define INIT_SI570_ON_STARTUP
 
#define VERSION_MAJOR 16
#define VERSION_MINOR 04
 
#define DEFAULT_I2C_ADDRESS 0x55
#define PCF8574 0x39 // A2 A1 A0 -> 0 0 1
 
#define F_CAL_DONE 0 // EEPROM position of F_CAL_DONE flag. 4 bytes follow.
#define F_CAL_DONE_VALUE 0x55
#define DEFAULT_FCRYST 114.285
 
//#if defined(UBW)
#define F_INIT_FREQ 5 // 4 bytes follow
//#elif defined(UBW32)
//#define F_INIT_FREQ 2 // fcryst 4 bytes all stored in one 32 bit slot
//#endif
 
#define F_INIT_FREQ_VALUE 0x55
#define DEFAULT_INIT_FREQ 56.32
 
#if defined(UBW)
#define F_SMOOTH 10 // 2 bytes follow
#elif defined(UBW32)
#define F_SMOOTH 4 // 1 slot follow
#endif
 
#define F_SMOOTH_VALUE 0x55
#define DEFAULT_SMOOTH 3500 // ppm
 
#define F_SUB_MUL_VALUE 0x55
#define DEFAULT_SUB 0.0
#define DEFAULT_MUL 1.0
 
#if defined(UBW)
#define F_SUB_MUL 13 // 8 bytes follow
#elif defined(UBW32)
#define F_SUB_MUL 6 // 2 slots follow
#endif
 
#if defined(UBW)
#define F_CROSS_OVER 22 // 32 bytes follow
#elif defined(UBW32)
#define F_CROSS_OVER 9 // 16 words stored in 16 (unsigned int) slots
#endif
 
#define F_CROSS_OVER_VALUE 0x55
 
#if defined(UBW)
#define F_BLINK_LED 55
#elif defined(UBW32)
#define F_BLINK_LED 26
#endif
 
/** S T R U C T U R E S ******************************************************/
 
 
extern BYTE i2c_adr;
extern BYTE command;
extern BYTE replybuf[8];
extern WORD wCount;
 
#define COMMAND_BUFFER_SIZE 16
#define DATA_PACKET_SIZE 6
 
typedef struct COMMAND_BUFFER
{
BYTE command;
WORD wCount;
BYTE data[DATA_PACKET_SIZE];
} COMMAND_BUFFER_t;
 
extern COMMAND_BUFFER_t command_buffer[COMMAND_BUFFER_SIZE];
extern BYTE current_command_in, current_command_out;
extern BYTE command_count;
 
extern double set_frequency;
 
extern unsigned char tempBuf[8];
 
typedef union _avr_freq
{
unsigned long qw;
unsigned char bytes[4];
} avr_freq_t;
 
extern avr_freq_t avr_freq, fcryst_freq; //frequency [MHz]*2^21
// fcryst freq [MHz]*2^24
extern avr_freq_t f_mul; // mul for set freq in 11.21 format
 
typedef union _offset
{
long qw; // signed offset in 11.21 format
unsigned char bytes[4];
} offset_t;
 
extern offset_t f_sub;
 
extern unsigned char registers[6];
 
extern BYTE abpf_flag;
extern double Smooth_double;
extern double fcryst_double;
extern WORD_VAL FilterCrossOver[8]; // 11.5 bit value Mhz
extern float FilterSwitchOver[7];
extern WORD_VAL LPFCrossOver[8];
extern float LPFSwitchOver[7];
 
/** P U B L I C P R O T O T Y P E S *****************************************/
void UserInit(void);
void ProcessIO(void);
void Set_Freq_Handler(void);
void Set_Register_Handler(void);
void Set_Cal_Handler(void);
void Set_Init_Freq_Handler(void);
void Set_Smooth_Handler(void);
void Set_Sub_Mul_Handler(void);
 
void Reset_Si570(void);
void Freeze (void);
void Unfreeze (void);
void Prep_rd (unsigned short);
void WriteBk (void);
void NewF (void);
void SetNewFreq(void);
void ReadRegs(void);
void ReadStartUpConfiguration(void);
void RunFreqProg(double);
void SetFrequency(double);
void Set_BPF(float);
void Set_LPF(float);
float Cross2Switch(WORD_VAL);
WORD_VAL Switch2Cross(float);
double Freq_From_Register(double);
 
void Read_Command_Into_Buffer(void);
void USBCheckUserRequest(void);
void USBCheckUBWRequest(void);
 
#endif //PICDEM_FS_DEMO_H