A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: 8192
Message: Function create_function() is deprecated
Filename: geshi/geshi.php
Line Number: 4751
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/Jenja/www/mcpaste.de/www/system/core/Exceptions.php:272)
Filename: view/raw.php
Line Number: 2
// Lösung zur Aufgabe Termin4
// Aufgabe 4
//****************************
// Zeiger auf Peripherie
// Messen der aufgelegten Masse
//
// von: Manfred Pester
// vom: 06. August 2003
#include "../h/pio.h"
#include "../h/tc.h"
#include "../h/pmc.h"
// für die Initialisierung der Zähler
#define TC_INIT TC_CLKS_MCK2 | TC_LDBSTOP | TC_CAPT | TC_LDRA_RISING_EDGE | TC_LDRB_RISING_EDGE
// Teiler 32?
int MessungderMasse(void);
void PIO_Init(void)
{
StructPMC* pmcbase = PMC_BASE;
StructPIO* piobaseA = PIOA_BASE;
StructPIO* piobaseB = PIOB_BASE;
pmcbase->PMC_PCER = 0x6000; // PIOA, PIOB
piobaseA->PIO_PDR = 0x090; // p4 p7
}
void Timer_Init(void)
{
StructPMC* pmcbase = PMC_BASE;
StructTC* tcbase4 = TCB4_BASE;
StructTC* tcbase5 = TCB5_BASE;
pmcbase->PMC_PCER = 0x00f00; // Clock Timer5, Timer4 einschalten
// Timer4:
tcbase4->TC_CCR = TC_CLKDIS; // CCR= CounterControlRegister; TC_CLKDIS=0x2
tcbase4->TC_CMR = TC_INIT; // Timer Counter Mode Register
tcbase4->TC_CCR = TC_CLKEN; // 0x1
tcbase4->TC_CCR = TC_SWTRG; // 0x4
// Timer5:
tcbase5->TC_CCR = TC_CLKDIS; // CCR= CounterControlRegister; TC_CLKDIS=0x2
tcbase5->TC_CMR = TC_INIT; // Timer Counter Mode Register
tcbase5->TC_CCR = TC_CLKEN; // 0x1
tcbase5->TC_CCR = TC_SWTRG; // 0x4
}
int main(void)
{
StructPIO* piobaseB = PIOB_BASE;
volatile int Masse = 0;
PIO_Init();
Timer_Init();
int i=0;
while(i < 4){
Masse = Masse + MessungderMasse();
i++;
}
Masse = Masse >> 2;
return 0;
}
int MessungderMasse(void){
StructPMC* pmcbase = PMC_BASE;
StructPIO* piobaseA = PIOA_BASE;
StructPIO* piobaseB = PIOB_BASE;
StructTC* tcbase4 = TCB4_BASE;
StructTC* tcbase5 = TCB5_BASE;
volatile int captureRA1;
volatile int captureRB1;
volatile int capturediff1;
volatile float Periodendauer1;
volatile int captureRA2;
volatile int captureRB2;
volatile int capturediff2;
volatile float Periodendauer2;
// Periodendauer der Waagensignale messen
// Signal an TIOA4 ca. 16kHz entspricht ca. einer Periodendauer von 62,5us
// durch den Teiler von 32 ergeben sich ca. 2ms
// Zähler mit positiver Flanke starten
tcbase4->TC_CCR = TC_SWTRG;
tcbase5->TC_CCR = TC_SWTRG;
while (!( tcbase4->TC_SR & 0x40)); // Capture Register B wurde geladen (RB Loading Status) Messung abgeschlossen
captureRA1 = tcbase4->TC_RA; // Speichert TC_RA (1. Gemesser wert) in Variable
captureRB1 = tcbase4->TC_RB;
while (!( tcbase5->TC_SR & 0x40)); // Capture Register B wurde geladen (Messung abgeschlossen
captureRA2 = tcbase5->TC_RA;
captureRB2 = tcbase5->TC_RB;
capturediff2 = captureRB2 - captureRA2;
Periodendauer2 = capturediff2; // Zeit in us
capturediff1 = captureRB1 - captureRA1;
Periodendauer1 = capturediff1; // Zeit in us
volatile int masse;
volatile int C1 = 2000;
volatile int C2 = 0;
masse = (C1 * ((Periodendauer1/Periodendauer2)-1))-C2;
return masse;
}
A PHP Error was encountered
Severity: 8192
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
Filename: database/DB_driver.php
Line Number: 1876