Ports are physical connectors that allow a computer/microcontroller to communicate with external devices.
Ex: In a simple ECG device, the sensor's output is transmit through the circuits to the port of microcontroller. The analog signal is further process in the microcontroller.
Microcontroller
https://gbembedded.wordpress.com/2015/10/26/avr-io-ports/
As see in the above URL, the port of a microcontroller can be configure as below.
Example:
Interfacing one LED to PORTC and one button to PORTD and when the button is pressed, the LED will glow.
Steps for programming:
- Configure inputs and outputs by using DDRx register.
- Setting pins as low or high by using PORTx register.
- Read the Pin value by using PINx register and perform the operation.
#include <avr/io.h> #include <util/delay.h> int main(void) } } |
Figure 2: Picture taken from https://www.flowcode.co.uk/courses/itm/index.php?n=PIC16F1937Architecture.PORTC
No comments:
Post a Comment