LTlib LaurTec Library  4.0.1
Open Source C Library for Microchip Microcontrollers based on XC8 Compiler
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
module_IO.h File Reference
#include "LTlib.h"

Go to the source code of this file.

Macros

#define IO_PORTA   0x01
 
#define IO_PORTB   0x02
 
#define IO_PORTC   0x03
 
#define IO_PORTD   0x04
 
#define IO_PORTE   0x05
 
#define IO_BIT0   0x01
 
#define IO_BIT1   0x02
 
#define IO_BIT2   0x04
 
#define IO_BIT3   0x08
 
#define IO_BIT4   0x10
 
#define IO_BIT5   0x20
 
#define IO_BIT6   0x40
 
#define IO_BIT7   0x80
 
#define IO_ALL_PORT_OUTPUT   0x00
 
#define IO_ALL_PORT_INPUT   0xFF
 
#define IO_BIT0_IN   0x01
 
#define IO_BIT1_IN   0x02
 
#define IO_BIT2_IN   0x04
 
#define IO_BIT3_IN   0x08
 
#define IO_BIT4_IN   0x10
 
#define IO_BIT5_IN   0x20
 
#define IO_BIT6_IN   0x40
 
#define IO_BIT7_IN   0x80
 
#define IO_BIT0_OUT   0x00
 
#define IO_BIT1_OUT   0x00
 
#define IO_BIT2_OUT   0x00
 
#define IO_BIT3_OUT   0x00
 
#define IO_BIT4_OUT   0x00
 
#define IO_BIT5_OUT   0x00
 
#define IO_BIT6_OUT   0x00
 
#define IO_BIT7_OUT   0x00
 

Functions

void IO_set_all_ports_as_inputs (void)
 
void IO_set_port_direction (unsigned char mcu_port, port_size port_direction)
 
void IO_write_port (unsigned char mcu_port, port_size port_data)
 
port_size IO_read_port (unsigned char mcu_port)
 
port_size IO_read_port_bit (unsigned char mcu_port, port_size bit_mask)
 

Macro Definition Documentation

#define IO_ALL_PORT_INPUT   0xFF

Definition at line 73 of file module_IO.h.

#define IO_ALL_PORT_OUTPUT   0x00

Definition at line 72 of file module_IO.h.

#define IO_BIT0   0x01

Definition at line 63 of file module_IO.h.

#define IO_BIT0_IN   0x01

Definition at line 75 of file module_IO.h.

#define IO_BIT0_OUT   0x00

Definition at line 84 of file module_IO.h.

#define IO_BIT1   0x02

Definition at line 64 of file module_IO.h.

#define IO_BIT1_IN   0x02

Definition at line 76 of file module_IO.h.

#define IO_BIT1_OUT   0x00

Definition at line 85 of file module_IO.h.

#define IO_BIT2   0x04

Definition at line 65 of file module_IO.h.

#define IO_BIT2_IN   0x04

Definition at line 77 of file module_IO.h.

#define IO_BIT2_OUT   0x00

Definition at line 86 of file module_IO.h.

#define IO_BIT3   0x08

Definition at line 66 of file module_IO.h.

#define IO_BIT3_IN   0x08

Definition at line 78 of file module_IO.h.

#define IO_BIT3_OUT   0x00

Definition at line 87 of file module_IO.h.

#define IO_BIT4   0x10

Definition at line 67 of file module_IO.h.

#define IO_BIT4_IN   0x10

Definition at line 79 of file module_IO.h.

#define IO_BIT4_OUT   0x00

Definition at line 88 of file module_IO.h.

#define IO_BIT5   0x20

Definition at line 68 of file module_IO.h.

#define IO_BIT5_IN   0x20

Definition at line 80 of file module_IO.h.

#define IO_BIT5_OUT   0x00

Definition at line 89 of file module_IO.h.

#define IO_BIT6   0x40

Definition at line 69 of file module_IO.h.

#define IO_BIT6_IN   0x40

Definition at line 81 of file module_IO.h.

#define IO_BIT6_OUT   0x00

Definition at line 90 of file module_IO.h.

#define IO_BIT7   0x80

Definition at line 70 of file module_IO.h.

#define IO_BIT7_IN   0x80

Definition at line 82 of file module_IO.h.

#define IO_BIT7_OUT   0x00

Definition at line 91 of file module_IO.h.

#define IO_PORTA   0x01

Definition at line 57 of file module_IO.h.

#define IO_PORTB   0x02

Definition at line 58 of file module_IO.h.

#define IO_PORTC   0x03

Definition at line 59 of file module_IO.h.

#define IO_PORTD   0x04

Definition at line 60 of file module_IO.h.

#define IO_PORTE   0x05

Definition at line 61 of file module_IO.h.

Function Documentation

port_size IO_read_port ( unsigned char  mcu_port)

This function reads the data from the port.

Parameters
mcu_portPort from which you want to read the data.
Returns
Data from the selected port
Note
For the port name use the defined constants to allow future improvements.
To properly use the function you need to call the IO_set_all_ports_as_inputs first. Indeed this function handles all the Analog inputs.

Definition at line 307 of file module_IO.c.

References IO_PORTA, IO_PORTB, IO_PORTC, IO_PORTD, and IO_PORTE.

port_size IO_read_port_bit ( unsigned char  mcu_port,
port_size  bit_mask 
)

This function reads bit from the selected port.

Parameters
mcu_portPort from which you want to read the data.
bit_maskSelected bit to be read out of the port.
Returns
Bit data from the selected port
Note
For the port name use the defined constants to allow future improvements.
To properly use the function you need to call the IO_set_all_ports_as_inputs first. Indeed this function handles all the Analog inputs.

Definition at line 356 of file module_IO.c.

References IO_PORTA, IO_PORTB, IO_PORTC, IO_PORTD, and IO_PORTE.

void IO_set_all_ports_as_inputs ( void  )

This function initialize all the PORTs as inputs

Parameters
void
Returns
void

Definition at line 47 of file module_IO.c.

void IO_set_port_direction ( unsigned char  mcu_port,
port_size  port_direction 
)

This function set the MCU port direction.

Parameters
mcu_portport for which you want to enable the pull-up resistors
port_directionEach bit set the proper bit direction
Returns
void
Note
For the port name use the defined constants to allow future improvements.
To properly use the function you need to call the IO_set_all_ports_as_inputs first. Indeed this function handles all the Analog inputs.

Definition at line 168 of file module_IO.c.

References IO_PORTA, IO_PORTB, IO_PORTC, IO_PORTD, and IO_PORTE.

void IO_write_port ( unsigned char  mcu_port,
port_size  port_data 
)

This function writes the data to the port.

Parameters
mcu_portPort to which you want to write the data.
port_dataData to be sent out
Returns
void
Note
For the port name use the defined constants to allow future improvements.
To properly use the function you need to call the IO_set_all_ports_as_inputs first. Indeed this function handles all the Analog inputs.

Definition at line 217 of file module_IO.c.

References IO_PORTA, IO_PORTB, IO_PORTC, IO_PORTD, and IO_PORTE.