Advertisement
Felanpro

time4io.c

Feb 27th, 2022
1,150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <stdint.h>
  2. #include <pic32mx.h>
  3. #include "mipslab.h"
  4.  
  5. int getsw( void )
  6. {
  7.     int switchStatus;
  8.     switchStatus = (PORTD >> 8) & 0x0f; //Extract bits 8 through 11
  9.  
  10.     return switchStatus;
  11. }
  12.  
  13. int getbtns( void )
  14. {
  15.     int btnStatus;
  16.     btnStatus = (PORTD >> 5) & 0x07; //Extract bits 7, 5 and 6 (0111 = 0x7)
  17.  
  18.     return btnStatus;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement