Advertisement
Guest User

Untitled

a guest
Mar 13th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #define PORTB_BASE_ADD ((volatile uint8_t *)0x36)
  2.  
  3. typedef uint8_t u8 ;
  4. typedef struct  
  5. {
  6.   //every port arrangement is AVR 8-bit is as flow :  PIN (base) - DDR (dir) - PORT(out)
  7.  
  8.     u8 port_in ;
  9.     u8 port_dir ;
  10.     u8 port_out ;
  11. }GPIO_PORT , *GPIO_PORT_PTR;
  12.  
  13. #define PORT_B (*(GPIO_PORT_PTR)PORTB_BASE_ADD)
  14.  
  15. int main(void)
  16. {
  17.     PORT_B.port_dir = 0xFF ;
  18.     PORT_B.port_out = 0x50 ;
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement