Académique Documents
Professionnel Documents
Culture Documents
Version 1.0
DDC Firmware
Author: ANUPAM
Disclaimers
The information contained in this document is the proprietary and exclusive property of Allgreen
Ecotech except as otherwise indicated. No part of this document, in whole or in part, may be
reproduced, stored, transmitted, or used for design purposes without the prior written permission
of Allgreen Ecotech.
The information contained in this document is subject to change without notice.
The information in this document is provided for informational purposes only. Allgreen Ecotech
specifically disclaims all warranties, express or limited, including, but not limited, to the implied
warranties of merchantability and fitness for a particular purpose, except as provided for in a
separate software license agreement.
Privacy Information
This document may contain information of a sensitive nature. This information should not be given
to persons other than those who are involved in the BMS project or who will become involved
during the lifecycle.
Version History
REVISION CHART
Version
Author(s)
Description of Version
Date
Completed
Contents
Contents.................................................................................................................................................. 3
1.
Introduction ............................................................................................................................. 4
1.1.
Document Overview............................................................................................................. 4
1.2.
Scope ................................................................................................................................... 4
2.
2.1.
Background Information....................................................................................................... 4
2.2.
2.3.
Lcd_drv.C ............................................................................................................................. 5
2.4.
2.5.
Interface .............................................................................................................................. 7
2.6.
2.7.
Lcd_app.c ............................................................................................................................. 8
3.
3.1.
3.2.
3.3.
3.4.
Interface ............................................................................................................................ 12
4.
1.
Introduction
Provide a brief introduction to the firmware developer about the different module of the BMS
firmware and the concept of that module.
1.1. Document Overview
1.2. Scope
This document is entirely for the firmware development of the BMS project. All concepts are
designed only for BMS project.
2. LCD Module
This section will give an idea about the interface of 20x4 LCD with our RCM6710 based
hardware.
2.1. Background Information
To design this module a developer should have the knowledge of LCD data and command. Also
pin description of the LCD.
We will use the LCD in 4bit mode to save the I/P line of the controller. Total 8 GPIO will be used
to control the LCD.
void PulseEnablePin ()
+---------------------------------------+
| Prototype: void PulseEnablePin ()
| Return Type:
| Arguments:
void
None
void LCD_Init();
+---------------------------------------+
| Prototype: void LCD_Init();
| Return Type:
| Arguments:
void
None
2.5.
Interface
A single function will be used for the entire application. This api will handle the user
interface. Only the string and location should be passed.
void write_string_to_lcd ( unsigned char x , unsigned char y , unsigned char* str , int
len )
+---------------------------------------+
| Prototype: void Go_Location_X_Y(unsigned char loc_X,unsigned char loc_Y)
| Return Type:
void
| Arguments: Locations (X & Y), where X can be within 1 to 4 and Y can be
within 1 to 20.String to be displayed. Length of the string.
| Description: This function displays a string passed at the location X & Y.
This function makes use of Go_Location_X_Y() function.
+---------------------------------------+
2.6.
2.7.
Lcd_app.c
This is an application based file and contains all the functions needed for our application. The
different parameters to be displayed on the LCD are categorized in Pages. A Page refers to the
data on the 20x4 LCD that gets displayed at a time.
Parameter
Companys profile &
Date-Time
Analog Inputs 1,2,3,4
Page no
1
2
8
3
4
5
6
7
3.1.
Here are many methods depending on how you connect your keypad with your controller, but
the basic logic is same. We make the columns as i/p and we drive the rows making them o/p,
this whole procedure of reading the keyboard is called scanning.
In order to detect which key is pressed from the matrix, we make row lines low one by one and
read the columns. Lets say we first make Row1 low, then read the columns. If any of the key in
row1 is pressed will make the corresponding column as low i.e. if second key is pressed in
Row1, then column2 will give low. So we come to know that key 2 of Row1 is pressed. This is
how scanning is done.
So to scan the keypad completely, we need to make rows low one by one and read the
columns. If any of the buttons is pressed in a row, it will take the corresponding column to a
low state which tells us that a key is pressed in that row. If button 1 of a row is pressed then
Column 1 will become low, if button 2 then column2 and so on...
The state machine is initialized to start with fast scan which outputs zeroes to all rows
and detects all keys at the same time. When a key is pressed, a low level is applied to
the corresponding column and causes a PIO interrupt to detect the first edge. Once any key is
detected, debouncing is started. The attempt to press a key on a physical keypad and have this
10
activity detected can fail as a result of several noise sources, glitches, spikes, etc., to mention
some of the possible causes of debounce problems. The timer is used to eliminate all noise of
less than a few milliseconds. Normally this is dependent on the mechanical characteristics of
the keys. 20ms programmable debouncing time is fine for this.
After debouncing is completed, a detailed scan is executed. A second fast scan is done to assure
that any detection made during the first fast scan stage was not just noise.
(Refer to Figure below.) Then, rows are configured as inputs. When a key is pressed a high level
is applied in the corresponding row. .
3.2.
11
/*
+-----------------------------------------------+
| Prototype: unsigned char get_key(void);
|
| Return Type: unsigned char
|
| Arguments: None
|
| Description: To read key from the keypad,
|
+-----------------------------------------------+
*/
12
13