Bar Logo 4kW dsPIC33C PSFB DC-DC DA (Part-No. )
 
Content
     
Loading...
Searching...
No Matches

This is where the framing/deframing and transmission happens for UART frames. More...

+ Collaboration diagram for UART Communication:

Data Structures

struct  UART_MSG_RX_OBJ
 UART msg receive object. More...
 
struct  UART_MSG_TX_OBJ
 UART msg Transmit object. More...
 

Macros

#define PBV_CRC_POLYNOM   0x8005
 Standard PBV CRC Polynomial. For documentation, as it is not used in calculation in this file.
 
#define PBV_CRC_POLYNOM_REV   0xA001
 Reversed polynomial. needed for odd byte in the data stream.
 
#define PBV_ReadyToSend   UART1_IsTxReady
 linking functions with UART mcc driver functions
 
#define PBV_Write   UART1_Write
 linking functions with UART mcc driver functions
 
#define PBV_IsRxReady   UART1_IsRxReady
 linking functions with UART mcc driver functions
 
#define PBV_Read   UART1_Read
 linking functions with UART mcc driver functions
 

Typedefs

typedef struct UART_MSG_RX_OBJ UART_MSG_RX_OBJ_t
 UART msg receive object.
 
typedef struct UART_MSG_TX_OBJ UART_MSG_TX_OBJ_t
 UART msg Transmit object.
 

Functions

void PBV_UART_Init (PBV_Datatype_TX_t *Board_To_PBV, PBV_Datatype_TX_t *Board_To_PBVAscii, PBV_Datatype_RX_t *Pbv_To_Board)
 
uint8_t PBV_UART_Receive_from_GUI ()
 implements the state machine for UART Frame receiving from PBV.
 
uint8_t PBV_UART_Transmit_Ascii_to_GUI ()
 
uint8_t PBV_UART_Transmit_to_GUI ()
 

Variables

UART_MSG_TX_OBJ_t PBV_UART_Object_TX
 UART object for numeric tx.
 
UART_MSG_RX_OBJ_t PBV_UART_Object_RX
 UART object for numeric rx.
 
UART_MSG_TX_OBJ_t PBV_UART_Object_ASCII
 UART object for ascii tx.
 

Detailed Description

This is where the framing/deframing and transmission happens for UART frames. The fundamental difference between this and CAN-FD frames is that CAN-FD defines a strategy for framing and deframing data, and PBV follows that strategy. UART is a point to point byte by byte transfer of data. To build a frame on top of it, another layer is needed where the data is framed/deframed and trasnmitted. It defines an additional statemachine

Macro Definition Documentation

◆ PBV_CRC_POLYNOM

#define PBV_CRC_POLYNOM   0x8005

Definition at line 23 of file app_PBV_UART.c.

◆ PBV_CRC_POLYNOM_REV

#define PBV_CRC_POLYNOM_REV   0xA001

Definition at line 30 of file app_PBV_UART.c.

◆ PBV_IsRxReady

#define PBV_IsRxReady   UART1_IsRxReady

Definition at line 51 of file app_PBV_UART.c.

◆ PBV_Read

#define PBV_Read   UART1_Read

Definition at line 58 of file app_PBV_UART.c.

◆ PBV_ReadyToSend

#define PBV_ReadyToSend   UART1_IsTxReady

Definition at line 37 of file app_PBV_UART.c.

◆ PBV_Write

#define PBV_Write   UART1_Write

Definition at line 44 of file app_PBV_UART.c.

Typedef Documentation

◆ UART_MSG_RX_OBJ_t

UART RX Object data type

◆ UART_MSG_TX_OBJ_t

UART TX Object data type

Function Documentation

◆ PBV_UART_Init()

void PBV_UART_Init ( PBV_Datatype_TX_t * Board_To_PBV,
PBV_Datatype_TX_t * Board_To_PBVAscii,
PBV_Datatype_RX_t * Pbv_To_Board )
Parameters
PBV_Datatype_TX_t* - ptr to numerical data
PBV_Datatype_TX_t* - ptr to ascii data
PBV_Datatype_TX_t* - ptr to received data ( for completeness, not used now)
Returns
void

initializes UART objects with application objects. Also initializes uartActiveTx and uartActiveTxAscii

Definition at line 171 of file app_PBV_UART.c.

◆ PBV_UART_Receive_from_GUI()

uint8_t PBV_UART_Receive_from_GUI ( )
Returns
int (1: ready to receive, 2: Receiving, 0: Received successfully, -1: CRC error)

implements the state machine for message RX. maintains internal state machine states as defined in RCV_<STATES>

< local copy created to pass to CRC function. TODO: could use the UART RX object, i.e. data, and header as they are stored regardless. but the CRC implementation would then require some work.

< calculating CRC. data for CRC [header][data]

Definition at line 197 of file app_PBV_UART.c.

◆ PBV_UART_Transmit_Ascii_to_GUI()

uint8_t PBV_UART_Transmit_Ascii_to_GUI ( )
Returns
int

implements the state machine for ascii TX

Definition at line 327 of file app_PBV_UART.c.

◆ PBV_UART_Transmit_to_GUI()

uint8_t PBV_UART_Transmit_to_GUI ( )
Returns
int

implements the state machine for numerical TX

Definition at line 410 of file app_PBV_UART.c.

Variable Documentation

◆ PBV_UART_Object_ASCII

UART_MSG_TX_OBJ_t PBV_UART_Object_ASCII

Definition at line 159 of file app_PBV_UART.c.

◆ PBV_UART_Object_RX

UART_MSG_RX_OBJ_t PBV_UART_Object_RX

Definition at line 153 of file app_PBV_UART.c.

◆ PBV_UART_Object_TX

UART_MSG_TX_OBJ_t PBV_UART_Object_TX

Definition at line 147 of file app_PBV_UART.c.