by vloki » Tue Jul 01, 2014 9:11 am
vloki wrote:- main and basic initialization
- Code: Select all
//##############################################################################
// filename: uC-Quick_demo_main.c
//
// main file for demo projects
//
//##############################################################################
//
// Author: V.SchK
// Company: HS-Ulm
//
// Revision: 1.0
// Date: September. 2012
// Assembled using C18 3.40+
//
// todo - add comments ;-)
// -
//
//##############################################################################
#include "uCQ_2013.h"
#include "demo_functions.h"
//--- P R I V A T E P R O T O T Y P E S --------------------------------------
//void __init();
//##############################################################################
// Function: void __main(void)
// called from the c18 startup code
// PreCondition: None
// Input:
// Output:
// Side Effects:
// Overview: Es kann jeweils nur eine Funktion in main ausgeführt werden
// da die Demofunktionen praktisch komplett eigenständige Pro-
// gramme mit eigener while(1){...} Schleife sind
//##############################################################################
void main()
{
#ifdef __XC8 // XC8 compiler IDE MAKRO
__init(); // C18 calls this function in startup code
#endif
// while (1) {...}
TestLEDs(); // LEDs in Debug-Mode (single step) ON/OFF
// ButtonLEDs(); // ENC_BTN switch on LED_1/2/3/4
// ButtonsChangeLEDs(); // Buttons toggle the LEDs
// TTL_ST_toLED(); // determining of logic levels
// Blink_Counter(); // timing based on counter loop
// Blink_Timer(); // timing using a timer module
// Blink_Interrupt(); TODO // timing with timer and CCP modules (IR)
// EncoderLEDs(); // Encoder "rotates" LEDs
// EncoderLCD(); // Encoder -> LCD
// AnalogLEDs(); // ADC (poti) display at LEDs
// AnalogLCD(); // ADC (poti) -> LCD
// Analog_Out(); // Analog signal out (buttons)
// Signal_Out(); // Analog signal out (array)
// Sound_PWM(); // sound out at speaker using PWM module
// RS232_TX(); // Send serial data
// RS232_RX(); // Receive serial data
// MiniRS232(); // Serial communication (both Directions)
// USrangeFinder(); TODO //
// TimeMeasure(); // measure time betw. two pos. edges [us]
// FreqMess(); TODO // measure frequency (1s)
// ClockMenu(); // LCD Clock with menu for setting
// BoardTest(); // function test (all) components
// Add On Boards ///////////////////////////////////////////////////////////////
// Test_MPU6000();
// Test_GPS();
// TestRadar();
}
//##############################################################################
// Function: void __init(void)
// called from the c18 startup code
// PreCondition: None
// Input:
// Output:
// Side Effects:
// Overview:
//##############################################################################
void __init()
{
OSCCONbits.IRCF = IRCF_4MHZ;
// OSCCONbits.IRCF = IRCF_16MHZ;
// OSCTUNEbits.PLLEN = 1; // ->64MHz
ANSELA = 0x00; // all pins digital IO
ANSELB = 0x00;
ANSELC = 0x00;
}
Last edited by
vloki on Tue Jul 01, 2014 9:19 am, edited 1 time in total.