Switch to Dark mode for better experience π
arsdever / lcd Goto Github PK
View Code? Open in Web Editor NEWAn LCD module simulator based on HD44780 microcontroller simulation
Home Page: https://arsdever/github.io/lcd
License: MIT License
An LCD module simulator based on HD44780 microcontroller simulation
Home Page: https://arsdever/github.io/lcd
License: MIT License
Provide a widget that will allow the user to see the logs from the components. It will enable the user to troubleshoot the issues they are facing.
The app sometimes just crashes when the mouse is hovering at the log viewer widget when the app is started. The mouse position may have nothing to do with the actual crash. One of the causes is the internal pointer
of the data is pointing to an invalid address when it's being interpreted as a string
Start the application while having the mouse pointer at the place where the log viewer widget should be spawned.
There is no crash.
To keep the consistency please rename the enum lcd_controller::address_mode
to address_mode_enum
Sets the interface data length. Data is sent or received in 8-bit lengths (DB7 to DB0) when DL is 1,
and in 4-bit lengths (DB7 to DB4) when DL is 0.When 4-bit length is selected, data must be sent or
received twice.
Sets the number of display lines.
Sets the character font.
Note: Perform the function at the head of the program before executing any instructions (except for the
read busy flag and address instruction). From this point, the function set instruction cannot be
executed unless the interface data length is changed.
Table 8
N | F | No. of Display Lines | Character Font | Duty Factor | Remarks |
---|---|---|---|---|---|
0 | 0 | 1 | 5 Γ 8 dots | 1/8 | |
0 | 1 | 1 | 5 Γ 10 dots | 1/11 | |
1 | * | 2 | 5 Γ 8 dots | 1/16 | Cannot display two lines for 5 Γ 10 dot character font |
Note: * Indicates donβt care
The code lacks in-code documentation and it's necessary to be added. It will not only improve the development process of the other contributors but also can be used later for the documentation generation process. Proper guidelines should be defined on where and how to put the in-code documentation and the format which needs to be followed.
The code is properly documented with in-code documentation.
As for now, connections (non Qt) are made by holding a pointer of the callback function and calling it back as required. A better solution is needed for handling that behavior, which will enable multiple connections to a single event and availability to be disconnected when required.
Improve the visuals of the widget by implementing the following
Introduce some tests which covers the basic functionality of the class, including:
On the graphical interface it'd be convenient to see the state of the pins as the time passes.
The following icons are required for the log viewer widget
info
log messageswarning
log messageserror
log messagesclear all
buttonAs the HD44780
datasheet states, it's possible to have 2 types of interfaces to interact with the display:
4 bit
8 bit
The 8 bit
one is already implemented, but 4 bit
one is missing.
It's possible to manipulate the display using 4 bit
interface and the display behaves as the datasheet specifies.
Return home sets DDRAM address 0 into the address counter, and returns the display to its original status
if it was shifted. The DDRAM contents do not change.
The cursor or blinking go to the left edge of the display (in the first line if 2 lines are displayed).
Cursor or display shift shifts the cursor position or display to the right or left without writing or reading
display data (Table 7). This function is used to correct or search the display. In a 2-line display, the cursor
moves to the second line when it passes the 40th digit of the first line. Note that the first and second line
displays will shift at the same time.
When the displayed data is shifted repeatedly each line moves only horizontally. The second line display
does not shift into the first line position.
The address counter (AC) contents will not change if the only action performed is a display shift.
S/C | R/L | Details |
---|---|---|
0 | 0 | Shifts the cursor position to the left. (AC is decremented by one.) |
0 | 1 | Shifts the cursor position to the right. (AC is incremented by one.) |
1 | 0 | Shifts the entire display to the left. The cursor follows the display shift. |
1 | 1 | Shifts the entire display to the right. The cursor follows the display shift. |
In order to better diagnose/debug the behavior of the module, a step
functionality is needed. This functionality will allow the customer to run the simulation with discrete steps and investigate the state of the module (CGRAM, DDRAM and etc).
The voltage
text on pin tooltip
gets an outline.
Steps to reproduce the behavior:
The voltage text is updated without any outlines
any
-
952a83a
Set DDRAM address sets the DDRAM address binary AAAAAAA into the address counter.
Data is then written to or read from the MPU for DDRAM.
However, when N is 0 (1-line display), AAAAAAA can be 00H to 4FH. When N is 1 (2-line display),
AAAAAAA can be 00H to 27H for the first line, and 40H to 67H for the second line.
Read data from CG or DDRAM reads 8-bit binary data DDDDDDDD from CG or DDRAM.
The previous designation determines whether CG or DDRAM is to be read. Before entering this read
instruction, either CGRAM or DDRAM address set instruction must be executed. If not executed, the first
read data will be invalid. When serially executing read instructions, the next address data is normally read
from the second read. The address set instructions need not be executed just before this read instruction
when shifting the cursor by the cursor shift instruction (when reading out DDRAM). The operation of the
cursor shift instruction is the same as the set DDRAM address instruction.
After a read, the entry mode automatically increases or decreases the address by 1. However, display shift
is not executed regardless of the entry mode.
Note:
The address counter (AC) is automatically incremented or decremented by 1 after the write
instructions to CGRAM or DDRAM are executed. The RAM data selected by the AC cannot be
read out at this time even if read instructions are executed. Therefore, to correctly read data,
execute either the address set instruction or cursor shift instruction (only with DDRAM), then just
before reading the desired data, execute the read instruction from the second time the read
instruction is sent.
Increments (I/D = 1) or decrements (I/D = 0) the DDRAM address by 1 when a character code is
written into or read from DDRAM.
The cursor or blinking moves to the right when incremented by 1 and to the left when decremented by 1.
The same applies to writing and reading of CGRAM.
Shifts the entire display either to the right (I/D = 0) or to the left (I/D = 1) when S is 1. The display does
not shift if S is 0.
If S is 1, it will seem as if the cursor does not move but the display does. The display does not shift when
reading from DDRAM. Also, writing into or reading out from CGRAM does not shift the display.
The logging of the base should be improved in the way that it better uses the flexibility of the logger, so it uses the log levels in a more accurate way. As for now, lcd_controller
traces every time it has an incoming signal and some high level debugging is missing in order to filter out necessary and unnecessary information.
Further refine this task and add subtasks as needed:
The build process throws some warnings. It's needed to clean those warnings and bump up the warning level and prepare the build to treat the warnings as errors for clean coding.
No warnings are thrown when the app is built.
There are 2 types of timers:
realtime_timer
step_timer
fps
in the scheduler's loop. With that, the scheduler tick will be triggered with custom frequency, and with each tick, a dedicated amount of timesteps may be simulated.It's possible to set real-time simulation speed and simulation accuracy.
The build pipeline should also build for linux
machines.
linux
build also takes placeIn case someone wants to contribute to the repository, it would be handy to have a script which would prepare the environment for the developer automatically.
In order to further develop the project, we will need a better way of connecting a port to another one. This will also improve the way the pinout visualization implementation is given.
Read busy flag and address reads the busy flag (BF) indicating that the system is now internally operating
on a previously received instruction. If BF is 1, the internal operation is in progress. The next instruction
will not be accepted until BF is reset to 0. Check the BF status before the next write operation. At the same
time, the value of the address counter in binary AAAAAAA is read out. This address counter is used by
both CG and DDRAM addresses, and its value is determined by the previous instruction. The address
contents are the same as for instructions set CGRAM address and set DDRAM address.
Create a prototypes file for each one of the projects which will contain the forward declarations of the classes and typedefs of their pointer types in that project.
// <project_name>_prototypes.h
class project_class;
using project_class_ptr = std::shared_ptr<project_class>;
using project_class_wptr = std::weak_ptr<project_class>;
using project_class_uptr = std::unique_ptr<project_class>;
Boost tests are not found by the Visual Studio
. Also, when running cmake test
it doesn't see any tests. For that purpose, it's needed to improve the test framework.
cmake test
executes the test app and reports the results.
To enable the user to see the log messages, a log viewer widget is required.
Create a custom tooltip widget, which will show up when the mouse is hovering a pin. This tooltip should show some information about the pin, such as:
Provide a way to the user to change the simulation speed from the GUI (something like a slider).
Clear display writes space code 20H (character pattern for character code 20H must be a blank pattern) into
all DDRAM addresses. It then sets DDRAM address 0 into the address counter, and returns the display to
its original status if it was shifted. In other words, the display disappears and the cursor or blinking goes to
the left edge of the display (in the first line if 2 lines are displayed). It also sets I/D to 1 (increment mode)
in entry mode. S of entry mode does not change
The implementation of qt_timer
is missing. Either remove this class at all or implement it.
pin
class from port
classpin
class by adding name
, index
, connections
fields into itWhen logging some information about a simulation specifically, it's needed to use the simulation as a time reference for the logging. This way the tracking of a certain issue might become way easier.
The project needs to be built for linux
OS as well.
linux
machine.Cursor or display shift shifts the cursor position or display to the right or left without writing or reading
display data (Table 7). This function is used to correct or search the display. In a 2-line display, the cursor
moves to the second line when it passes the 40th digit of the first line. Note that the first and second line
displays will shift at the same time.
When the displayed data is shifted repeatedly each line moves only horizontally. The second line display
does not shift into the first line position.
The address counter (AC) contents will not change if the only action performed is a display shift.
S/C | R/L | Details |
---|---|---|
0 | 0 | Shifts the cursor position to the left. (AC is decremented by one.) |
0 | 1 | Shifts the cursor position to the right. (AC is incremented by one.) |
1 | 0 | Shifts the entire display to the left. The cursor follows the display shift. |
1 | 1 | Shifts the entire display to the right. The cursor follows the display shift. |
Set CGRAM address sets the CGRAM address binary AAAAAA into the address counter.
Data is then written to or read from the MPU for CGRAM.
The display is on when D is 1 and off when D is 0. When off, the display data remains in DDRAM, but
can be displayed instantly by setting D to 1.
The cursor is displayed when C is 1 and not displayed when C is 0. Even if the cursor disappears, the
function of I/D or other specifications will not change during display data write. The cursor is displayed
using 5 dots in the 8th line for 5 Γ 8 dot character font selection and in the 11th line for the 5 Γ 10 dot
character font selection (Figure 13).
The character indicated by the cursor blinks when B is 1 (Figure 13). The blinking is displayed as
switching between all blank dots and displayed characters at a speed of 409.6-ms intervals when fcp or fOSC
is 250 kHz. The cursor and blinking can be set to display simultaneously. (The blinking frequency changes
according to fOSC or the reciprocal of fcp. For example, when fcp is 270 kHz, 409.6 Γ 250/270 = 379.2 ms.)
The UI must be able to request all the necessary information for drawing from the controller. E.g. whether or not display, cursor are on and etc.
The tests should be run on github
events to maintain the code quality. This will prevent later issues and bugs from being introduced.
Also, the code coverage report will exploit untested places and also will indicate the code quality.
tests
badge is shown in the main readme fileWrite data to CG or DDRAM writes 8-bit binary data DDDDDDDD to CG or DDRAM.
To write into CG or DDRAM is determined by the previous specification of the CGRAM or DDRAM
address setting. After a write, the address is automatically incremented or decremented by 1 according to
the entry mode. The entry mode also determines the display shift.
The goal is to have a running pipeline, which will build and test the project to make sure that no commit will break the builds. Later it will be used to avoid direct pushes to the main branch.
debug
/release
, x86
/x64
)github
pipeline job to run the script and report the resultsmacOS
Note 1:
arm
andarmv8
are planned for the future
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.