User manual

Entwicklung eines großen Programms Seite: 61/152
© Laser & Co. Solutions GmbH Benutzerhandbuch SiSy
Damit hat das Programm nachfolgenden Quellcode:
Unit „main“
//------------------------------------------------------------------
// Titel : Grundgerüst einer einfachen ARM C Anwendung in SiSy
//------------------------------------------------------------------
// Funktion : ...
// Schaltung : ...
//------------------------------------------------------------------
// Hardware : STM32F4 Discovery
// Takt : 168 MHz
// Sprache : ARM C
// Datum : ...
// Version : ...
// Autor : ...
//------------------------------------------------------------------
#include <stddef.h>
#include <stdlib.h>
#include "stm32f4xx.h"
//#include "stm32f30x.h"
//#include "stm32f0xx.h"
#include "init.h"
#include "delay.h"
#include "sysTick.h"
#include "main.h"
int main(void)
{
SystemInit();
initApplication();
GPIO_SetBits(GPIOD,GPIO_Pin_12);
do{
// Eingabe
// Ausgabe
// Verarbeitung
GPIO_ToggleBits(GPIOD,GPIO_Pin_12);
delay(10000000);
} while (true);
return 0;
}
Unit init.cc
#include "init.h"
void initApplication()
{
SysTick_Config(SystemCoreClock/100);
// weitere Initialisierungen durchführen
/* GPIOG Periph clock enable */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
/* Configure PG6 and PG8 in output pushpull mode */
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOD, &GPIO_InitStructure);
}