Facebook
From Sexy Hornbill, 8 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 276
  1. #include "MKL25Z4.h"
  2.  
  3. void Delay()
  4. {
  5.         int i;
  6.         for (i = 0; i < 1000000; i++)
  7.                 asm("nop");
  8. }
  9.  
  10. int main()
  11. {
  12.         SIM_BASE_PTR->SCGC5 |= SIM_SCGC5_PORTB_MASK;
  13.         PORTB_BASE_PTR->PCR[17] = PORT_PCR_MUX(1);
  14.  
  15.         PTB_BASE_PTR->PDDR = 1 << 17;
  16.  
  17.         for(;;)
  18.         {
  19.                 PTB_BASE_PTR->PSOR = 1 << 17;
  20.                 Delay();
  21.                 PTB_BASE_PTR->PCOR = 1 << 17;
  22.                 Delay();
  23.         }
  24.  
  25.         return 0;
  26. }