PIC12: General purpose I/O (GPIO) GPIO on PIC12F675 6 inputs/outputs (GP0 – GP5) 1 pin input only(GP3) note the precedence of analog functions Depending on which peripherals are enabled, some or all of the pins may not be available as general purpose I/O optional weak pull-ups Associated registry TRISIO – configuring the data direction: 1 = GPIO pin configured as an input (tri-stated), 0 = GPIO pin configured as an output. GPIO – read / write the digital values from/to the particular pin PIC12: General purpose I/O (GPIO) [src.athaj.cz] 1 z 2 27.3.2013 11:59 WPU – enable/disable weak pull-ups ANSEL – configure the analog/digital function Others: IOC, CMCON Using GPIO in C char c; /* init */ CMCON = 7; // disable comparator ANSEL = 0; // disble analog functions TRISIO = 0; // set all pins as output TRIS2 = 1; // set GP2 as input /* main program */ c = 0b01010101; // define pattern GPIO = c; // assign pattern to GPIO GPIO4 = 0; // assign value to a single LED c = GPIO2; // either 0 or 1 will be assigned auth/picembc/pic12_gpio.txt — Last modified: 2013/03/26 20:24 by res PIC12: General purpose I/O (GPIO) [src.athaj.cz] 2 z 2 27.3.2013 11:59