Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Standards for Commenting an Embedded Code

Status
Not open for further replies.

scorrpeio

Full Member level 5
Joined
Dec 26, 2006
Messages
286
Helped
10
Reputation
20
Reaction score
9
Trophy points
1,298
Activity points
3,496
Hello,

Is there any standard of what should be included in commenting the Embedded Code?

Right now, I am of my own, using following information in commenting...


For .c file
Code:
/************************************************************************************************
 * File Name: - UART.c
 * COPYRIGHT NOTICE: (C) 2011 <Company Name>
 * All Rights reserved
************************************************************************************************/
/*****************************************************************************************
 * File Name:    - UART.c
 * Date Created: - 25.July.2011
 * Created By:   - 
 *
 * Dependencies: - The RxBuf of MCU is mapped with the char buffer which is declared 
 *                 global in other .c file
 *                 While porting this file in other projects, care should be taken that
 *                 RxBuf of MCU should be mapped as per project requirement.
 *    
 * Description:  - 1. This file implements the driver for UART communication.
 *                 2. It has routines for Initialisation of UART, sending single byte on
 *                    UART port by polling and receiving single byte through interrupt.    
 *
 * Compiler Used: - CCS4.0
 * MCU used:      - MSP430F5418A
 * Date Modified: -
 * Modifications: -
 * Modified By:   -
*****************************************************************************************/
/////////////////////////////////////////////////////////////////////////////////////////
// INCLUDE FILES
/////////////////////////////////////////////////////////////////////////////////////////
#include "Config.h"
#include "StdTypes.h"

#include "Display.h"
#include "Slave.h"
#include "UART.h"

/////////////////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
/////////////////////////////////////////////////////////////////////////////////////////

/* The following buffer is used to store data received.*/  
UINT8_T u8Buf[];
	
/////////////////////////////////////////////////////////////////////////////////////////
// FUNCTION DEFINITIONS
/////////////////////////////////////////////////////////////////////////////////////////
/****************************************************************************************
 * Function Name- UART_CallFunc
 * Return Type- void
 * Argument List- UINT8_T u8FunctionNo
 * Calling Functions- 
 * Called Functions-  
 *   
 * Global Variables Affected- none
 *
 * Description- 
 * Note - 
****************************************************************************************/	
...

//.c file ends here

for.h file
Code:
/************************************************************************************************
 * File Name: - UART.h
 * COPYRIGHT NOTICE: (C) 2011 <Company Name>
 * All Rights reserved
************************************************************************************************/

/*****************************************************************************************
 * File Name:    - UART.h
 * Date Created: - 25.July.2011
 * Created By:   - 
 *
 * Dependencies: -
 * Description:  - This header file contains the declarations of the functions used in
 *                 UART.c File. Further the extern variables are declared here. 
 *                 The macros associated with function call also go here.
 *
 * Compiler Used: - CCS4.0
 * MCU used:      - MSP430F5418A
 * Date Modified: -
 * Modifications: -
 * Modified By:   -
*****************************************************************************************/
#ifndef UART_H_
#define UART_H_

/////////////////////////////////////////////////////////////////////////////////////////
// MACRO DEFINITIONS
/////////////////////////////////////////////////////////////////////////////////////////
/* Macros associated with Calling of Function in UART_Driver.c file */

/////////////////////////////////////////////////////////////////////////////////////////
// EXTERN VARIABLES
/////////////////////////////////////////////////////////////////////////////////////////
/* Variables Declared global in file x.c  */
...

/* Variables Declared global in file y.c  */
...

/////////////////////////////////////////////////////////////////////////////////////////
// FUNCTION DECLARATION
/////////////////////////////////////////////////////////////////////////////////////////
...

#endif /*UART_H_*/
- - - Updated - - -

Please let me know, if something more should be added in it.
 

Tahmid

Advanced Member level 5
Joined
Jun 17, 2008
Messages
4,758
Helped
1,791
Reputation
3,574
Reaction score
1,650
Trophy points
1,393
Location
Silicon Valley, California, USA (from Dhaka, Bangl
Activity points
30,545
I don't know of any standards. You should use whichever standard/format is best for you. Your commenting should be such that you (and any other co-programmers/designers) can easily understand the code whenever the code is viewed or inspected, at any later time.
 

scorrpeio

Full Member level 5
Joined
Dec 26, 2006
Messages
286
Helped
10
Reputation
20
Reaction score
9
Trophy points
1,298
Activity points
3,496
ok... I will read these books first now and if have any doubt, will revert back
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top