SHARE
TWEET

фыы

a guest Apr 22nd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <hidef.h>      /* common defines and macros */
  2. #include "derivative.h"      /* derivative-specific definitions */
  3.  
  4.  
  5.  
  6. unsigned int CHECK = 0;
  7. unsigned int DIRECT = 0;
  8. unsigned int b = 0;
  9. unsigned int DIR = 0;/*
  10. unsigned int bit_0 = 0;
  11. unsigned int bit_1 = 0;
  12. unsigned int bit_2 = 0;
  13. unsigned int bit_3 = 0;*/
  14.  
  15. unsigned int bits4 = 0;
  16.  
  17. void main()
  18. {
  19.   DDRP = 0xF0;
  20.   DDRB = 0xF0;
  21.  
  22.   PUCR |= 0x02;
  23.  
  24.   TSCR2 = 0x83;
  25.   DIRECT=12536;
  26.   TSCR1 = 0x80;
  27.   PORTB = 0xFF;
  28.  
  29.   EnableInterrupts;
  30.   for (;;)
  31.   {}
  32. }
  33.  
  34. interrupt 16 void TOF()
  35. {
  36.   TFLG2 = 0x80;
  37.   CHECK=PORTAB;
  38.   /*bit_0 = (PORTAB & 1);  
  39.   bit_1 = (PORTAB & 2) >> 1;
  40.   bit_2 = (PORTAB & 4) >> 2;
  41.   bit_3 = (PORTAB & 8) >> 3;*/
  42.  
  43.   bits4 = PORTAB & 15;
  44.   PORTB = bits4 << 4;
  45.  
  46.    /*if (bit_0){
  47.       PORTB=0x7F;
  48.    }*/
  49.    
  50.   // TODO: get byts [0,1,2,3];
  51.   //if ((CHECK==12543)||(CHECK==12463)){
  52.   // PORTB=0x00;
  53.   //}
  54.   // if ((CHECK==12542)||(CHECK==12462)){
  55.    // PORTB=0x70;
  56.  // }
  57.   //  if ((CHECK==12542)||(CHECK==12462)){
  58.  //   PORTB=0x70;
  59.   //}
  60.  
  61. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top