Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
de:examples:digi:pin [2009/04/27 14:35] nierhoffde:examples:digi:pin [2009/09/10 18:17] (current) – gelöscht mikk.leini
Line 1: Line 1:
-====== Pin Operationen ====== 
  
-Der folgende Code demonstriert den Gebrauch der Header-File "pin.h", welche den Umgang mit den Mehrzweck-Input-Output-Pins des AVRs vereinfacht. 
- 
-  * {{examples:digi:pin.h|"pin.h"}} 
- 
-===== Example ===== 
- 
-<code c> 
-#include <avr/io.h> 
-#include "pin.h" 
-  
-#define LED1    PORTPIN(C, 1) 
-#define BUTTON1 PORTPIN(C, 2) 
- 
-int main(void) 
-{ 
- unsigned char x; 
- 
- // Configuring pin as an output 
- pin_setup_output(LED1); 
- 
- // Setting pin high 
- pin_set(LED1); 
- 
- // Setting pin low 
- pin_clear(LED1); 
- 
- // Setting pin to specified state (1 or 0) 
- pin_set_to(LED1, 1); 
- 
- // Toggling pin state (from high to low and vice versa) 
- pin_toggle(LED1); 
-  
- // Configuring pin as an input 
- pin_setup_input(BUTTON1); 
- 
- // Reading input pin value 
- pin_get_value(BUTTON1, x); 
-} 
-</code> 
de/examples/digi/pin.1240842931.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0