Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. /*
  2. * IRSensorBoard.c
  3. *
  4. * Created: 1/08/2017 12:34:02 PM
  5. * Author : Jon Connor
  6. */
  7.  
  8. #define F_CPU 1000000UL
  9. #include <avr/io.h>
  10. #include <util/delay.h>
  11.  
  12.  
  13. /*PINOUTS
  14. PA0-4 Sensor 1-5 analog inputs
  15. PA5 Vcc input
  16. PA6/PA7 Sensor voltage select outputs. Active LOW
  17. PB0-3 Sensor 1-4 enable outputs. Active HIGH
  18. PC5 Sensor 5 enable output. Active HIGH
  19. PC0 indicator LED output.
  20. PC1/PC4 I2C Clock/Data lines
  21.  
  22. */
  23. int main(void)
  24. {
  25. PORTA |= (0<<PORTA7) | (1<<PORTA6); //one power source on for now, doing this before setting outputs
  26. DDRA |= (1<<PORTA7) | (1<<PORTA6);
  27.  
  28. DDRB |= ((1<<PORTB0) | (1<<PORTB1) | (1<<PORTB2) | (1<<PORTB3));
  29.  
  30.  
  31. while (1)
  32. {
  33.  
  34. PORTB &= !(1<<PORTB0);
  35. PORTB |= (1<<PORTB1);
  36. _delay_ms(50);
  37. PORTB &= !(1<<PORTB1);
  38. PORTB |= (1<<PORTB2);
  39. _delay_ms(50);
  40. PORTB &= !(1<<PORTB2);
  41. PORTB |= (1<<PORTB3);
  42. _delay_ms(50);
  43. PORTB &= !(1<<PORTB3);
  44. PORTB |= (1<<PORTB0);
  45. _delay_ms(50);
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement