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

MPSTermin3 - mcpaste

MPSTermin3

Von MC_J, 10 Jahre vorher, geschrieben in C, aufgerufen 1'941 mal.
URL https://mcpaste.de/view/e9fafcb3 Einbetten
Paste herunterladen oder Rohtext anzeigen
  1. // Lösung zu Termin3
  2. // Aufgabe 1
  3. // von:
  4. // vom:
  5. //
  6.  
  7. #include "../h/pmc.h"
  8. #include "../h/tc.h"
  9. #include "../h/pio.h"
  10. #include "../h/aic.h"
  11.  
  12. void taste_irq_handler (void) __attribute__ ((interrupt));
  13.  
  14. // Interruptserviceroutine für die Tasten SW1 und SW2
  15. void taste_irq_handler (void)
  16. {
  17.   StructPIO* piobaseA = PIOA_BASE;
  18.   StructPIO* piobaseB   = PIOB_BASE;            // Basisadresse PIO B
  19.   StructAIC* aicbase  = AIC_BASE;               // Basisadresse des Advanced interrupt controllers
  20.        
  21. // ab hier entsprechend der Aufgabestellung ergänzen
  22. // *************************************************
  23.         if(!(piobaseB->PIO_PDSR & KEY1))
  24.         {
  25.        
  26.         piobaseA->PIO_PER  = (1<<PIOTIOA3) ;    // Pinport A3 enable
  27.        
  28.         }
  29.         if(!(piobaseB->PIO_PDSR & KEY2))
  30.         {
  31.        
  32.         piobaseA->PIO_PDR  = (1<<PIOTIOA3);
  33.        
  34.         }
  35.        
  36.        
  37.         aicbase->AIC_EOICR = piobaseB->PIO_ISR; //Ende der Interruptserviceroutine
  38. }
  39.  
  40. // Timer3 initialisieren
  41. void Timer3_init( void )
  42. {
  43.   StructTC* timerbase3  = TCB3_BASE;            // Basisadressse TC Block 1
  44.   StructPIO* piobaseA   = PIOA_BASE;            // Basisadresse PIO B
  45.  
  46.         timerbase3->TC_CCR = TC_CLKDIS;                 // Disable Clock
  47.  
  48.  // Initialize the mode of the timer 3
  49.   timerbase3->TC_CMR =
  50.     TC_ACPC_CLEAR_OUTPUT  |    //ACPC    : Register C clear TIOA
  51.     TC_ACPA_SET_OUTPUT    |    //ACPA    : Register A set TIOA
  52.     TC_WAVE               |    //WAVE    : Waveform mode
  53.     TC_CPCTRG             |    //CPCTRG  : Register C compare trigger enable
  54.     TC_CLKS_MCK8;              //TCCLKS  : MCKI / 8
  55.  
  56.   // Initialize the counter:
  57.   timerbase3->TC_RA = 31250;    //50% High
  58.   timerbase3->TC_RC = 62500;    //
  59.  
  60.   // Start the timer :
  61.   timerbase3->TC_CCR = TC_CLKEN ;                               // Timer Enable
  62.   timerbase3->TC_CCR = TC_SWTRG ;                               // Softwaretrigger
  63.   piobaseA->PIO_PER  = (1<<PIOTIOA3) ;  // Pinport A3 enable
  64.   piobaseA->PIO_OER  = (1<<PIOTIOA3) ;  // Outputenable
  65.   piobaseA->PIO_CODR = (1<<PIOTIOA3) ;  // Clear output data register -> kein anderes signal liegt an
  66. }
  67.  
  68. int main(void)
  69. {
  70.  
  71.         StructPMC* pmcbase      = PMC_BASE;                     // Basisadresse des PMC
  72.         StructPIO* piobaseA     = PIOA_BASE;            // Basisadresse PIO A
  73.         StructPIO* piobaseB     = PIOB_BASE;            // Basisadresse PIO B
  74.         StructAIC* aicbase      = AIC_BASE;
  75.         pmcbase->PMC_PCER       = 0x6200;       // Peripheral Clocks einschalten für PIOB, Timer3
  76.        
  77. // ab hier entsprechend der Aufgabestellung ergänzen
  78. //**************************************************
  79.  
  80.         Timer3_init();
  81.         piobaseA->PIO_PDR = (1<<PIOTIOA3);
  82.         piobaseB->PIO_PER = KEY1 | KEY2;
  83. /*########### Interrupt Service Routine ausführbar machen ################*/  
  84.         aicbase->AIC_IDCR = 1 << 14;
  85.         aicbase->AIC_ICCR = 1 << 14;
  86.         aicbase->AIC_SVR[PIOB_ID] = (unsigned int)taste_irq_handler;
  87.         aicbase->AIC_SMR[PIOB_ID] = 0x7;
  88.         aicbase->AIC_IECR = 1 << 14;
  89.         piobaseB->PIO_IER = KEY1 | KEY2;
  90.        
  91.         while(1)
  92.         {
  93.  
  94.         }
  95.         aicbase->AIC_IDCR = 1 << 14; // Interrupt PIOB ausschalten
  96.         aicbase->AIC_ICCR = 1 << 14; // Interrupt PIOB löschen
  97.         return 0;
  98. }

Antwort auf "MPSTermin3"

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