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: 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

MPSTermin4 - mcpaste

MPSTermin4

Von MC_J, 10 Jahre vorher, geschrieben in C, aufgerufen 1'686 mal.
URL https://mcpaste.de/view/179e91ca Einbetten
Paste herunterladen oder Rohtext anzeigen
  1. // Lösung zur Aufgabe Termin4
  2. // Aufgabe 4
  3. //****************************
  4. // Zeiger auf Peripherie
  5. // Messen der aufgelegten Masse
  6. //
  7. // von: Manfred Pester
  8. // vom: 06. August 2003
  9.  
  10. #include "../h/pio.h"
  11. #include "../h/tc.h"
  12. #include "../h/pmc.h"
  13.  
  14. // für die Initialisierung der Zähler
  15. #define TC_INIT TC_CLKS_MCK2 | TC_LDBSTOP | TC_CAPT | TC_LDRA_RISING_EDGE | TC_LDRB_RISING_EDGE
  16. // Teiler 32?
  17. int MessungderMasse(void);
  18.  
  19.  
  20. void PIO_Init(void)
  21. {
  22.         StructPMC* pmcbase = PMC_BASE;
  23.         StructPIO* piobaseA = PIOA_BASE;
  24.         StructPIO* piobaseB = PIOB_BASE;
  25.         pmcbase->PMC_PCER = 0x6000;             // PIOA, PIOB
  26.         piobaseA->PIO_PDR = 0x090;        // p4 p7
  27.        
  28. }
  29.  
  30. void Timer_Init(void)
  31. {
  32.         StructPMC* pmcbase = PMC_BASE;
  33.         StructTC* tcbase4 = TCB4_BASE;
  34.         StructTC* tcbase5 = TCB5_BASE;
  35.         pmcbase->PMC_PCER = 0x00f00; // Clock Timer5, Timer4 einschalten
  36.         // Timer4:
  37.         tcbase4->TC_CCR = TC_CLKDIS;    // CCR= CounterControlRegister; TC_CLKDIS=0x2
  38.         tcbase4->TC_CMR = TC_INIT;        // Timer Counter Mode Register
  39.         tcbase4->TC_CCR = TC_CLKEN;        // 0x1
  40.         tcbase4->TC_CCR = TC_SWTRG;        // 0x4
  41.         // Timer5:
  42.         tcbase5->TC_CCR = TC_CLKDIS;    // CCR= CounterControlRegister; TC_CLKDIS=0x2
  43.         tcbase5->TC_CMR = TC_INIT;        // Timer Counter Mode Register
  44.         tcbase5->TC_CCR = TC_CLKEN;        // 0x1
  45.         tcbase5->TC_CCR = TC_SWTRG;        // 0x4
  46. }
  47.  
  48. int main(void)
  49. {
  50.         StructPIO* piobaseB = PIOB_BASE;
  51.         volatile int Masse = 0;
  52.        
  53.         PIO_Init();    
  54.         Timer_Init();
  55.        
  56.                 int i=0;
  57.                 while(i < 4){
  58.                         Masse = Masse + MessungderMasse();
  59.                         i++;
  60.                 }
  61.                 Masse = Masse >> 2;
  62.        
  63.         return 0;
  64. }
  65.  
  66.  
  67.  
  68. int MessungderMasse(void){
  69.  
  70.         StructPMC* pmcbase = PMC_BASE;
  71.         StructPIO* piobaseA = PIOA_BASE;
  72.         StructPIO* piobaseB = PIOB_BASE;
  73.         StructTC* tcbase4 = TCB4_BASE;
  74.         StructTC* tcbase5 = TCB5_BASE;
  75.  
  76.  
  77. volatile int captureRA1;
  78. volatile int captureRB1;
  79. volatile int capturediff1;
  80. volatile float Periodendauer1;
  81.  
  82. volatile int captureRA2;
  83. volatile int captureRB2;
  84. volatile int capturediff2;
  85. volatile float Periodendauer2;
  86.  
  87.  
  88.  
  89. // Periodendauer der Waagensignale messen
  90. // Signal an TIOA4 ca. 16kHz entspricht ca. einer Periodendauer von 62,5us
  91. // durch den Teiler von 32 ergeben sich ca. 2ms
  92. // Zähler mit positiver Flanke starten
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99. tcbase4->TC_CCR = TC_SWTRG;
  100. tcbase5->TC_CCR = TC_SWTRG;
  101.  
  102.  
  103. while (!( tcbase4->TC_SR & 0x40)); // Capture Register B wurde geladen (RB Loading Status) Messung abgeschlossen
  104. captureRA1 = tcbase4->TC_RA; // Speichert TC_RA (1. Gemesser wert) in Variable
  105. captureRB1 = tcbase4->TC_RB;
  106.  
  107. while (!( tcbase5->TC_SR & 0x40)); // Capture Register B wurde geladen (Messung abgeschlossen
  108. captureRA2 = tcbase5->TC_RA;
  109. captureRB2 = tcbase5->TC_RB;
  110.  
  111. capturediff2 = captureRB2 - captureRA2;
  112. Periodendauer2 = capturediff2; // Zeit in us
  113. capturediff1 = captureRB1 - captureRA1;
  114. Periodendauer1 = capturediff1; // Zeit in us  
  115.    
  116.      
  117.     volatile int masse;
  118.     volatile int C1 = 2000;
  119.     volatile int C2 = 0;
  120.    
  121. masse = (C1 * ((Periodendauer1/Periodendauer2)-1))-C2;    
  122.  
  123.     return masse;
  124. }

Antwort auf "MPSTermin4"

Hier kannst Du auf den Paste von oben antworten

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