Advertisement
gchart

Dual channel driver test

Aug 21st, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. #define F_CPU 4800000UL
  2.  
  3. #include <avr/io.h>
  4. #include <util/delay.h>
  5.  
  6. #define LED_LOW_PIN   PB0
  7. #define LED_HIGH_PIN  PB1
  8.  
  9. int main(void)
  10. {  
  11.     // set the two AMC7135 channels as output
  12.     DDRB = (1 << LED_LOW_PIN) | (1 << LED_HIGH_PIN);
  13.    
  14.     // loop forever
  15.     while(1) {
  16.         PORTB = (1 << LED_LOW_PIN); // Low channel on
  17.         _delay_ms(3000); // wait 3 seconds
  18.        
  19.         PORTB = (1 << LED_HIGH_PIN); // High channel on
  20.         _delay_ms(3000); // wait 3 seconds
  21.        
  22.         PORTB = (1 << LED_LOW_PIN) | (1 << LED_HIGH_PIN); // Both channels on
  23.         _delay_ms(3000); // wait 3 seconds
  24.     }
  25.  
  26.     return 0; // Standard Return Code
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement