msp430ware++ method of invocation using 1:LG3641BH driver

Source: Internet
Author: User

Msp430ware is a set of open source MSP430 layered software architecture based on C + + language to support multiple peripherals. This article will introduce the method of calling the digital tube lg3641bh driver.

1, the hardware schematic diagram
Using the digital tube lg3641bh circuit shown in the following figure, the Nixietubea driver can be directly invoked for program development.
2, the use of methods
A, adding drivers
Select the Nixietubea folder and right-click "Exclude from Build". The Nixietubea driver consists of 3 files, as shown in the following figure. Where NIXIETUBEA_CONFIG.HPP is the Nixietubea configuration file, NixieTubeA.cpp is the Nixietubea class source program, NIXIETUBEA.HPP is the Nixietubea class header file.
b, enabling peripherals
In CONFIG.HPP to enable peripheral Nixietubea, the source program is as follows:
#define EXTERNAL_MODULE_NIXIETUBEA_MODE 1

C, the driver configuration.
To view the schematic diagram, you can see the following pin correspondence.
d1--p5.4
d2--p5.3
d3--p5.2
d4--p5.1
qa--p4.5
qb--p4.7
qc--p4.2
qd--p4.4
qe--p4.6
qf--p5.0
qg--p4.1
Change the NIXIETUBEA_CONFIG.HPP configuration file according to the above correspondence and change the source program as follows:
         #define Nixietubea_d0_port PORT5           #define Nixietubea_d0_pin  pin4          #define Nixietubea_d1_port PORT5          #define nixietubea_d1_pin   PIN3          #define Nixietubea_d2_port PORT5           #define Nixietubea_d2_pin  pin2         # Define Nixietubea_d3_port PORT5          #define Nixietubea_d3_pin   PIN1          #define Nixietubea_qa_port PORT4           #define Nixietubea_qa_pin  pin5         # Define Nixietubea_qb_port PORT4          #define Nixietubea_qb_pin   PIN7 &NBsp;        #define Nixietubea_qc_port PORT4           #define Nixietubea_qc_pin  pin2          #define Nixietubea_qd_port PORT4          #define Nixietubea_qd_pin  pin4          #define Nixietubea_qe_port PORT4           #define Nixietubea_qe_pin  pin6          #define Nixietubea_qf_port PORT5          #define Nixietubea_qf_pin  pin0          #define Nixietubea_qg_port PORT4           #define Nixietubea_qg_pin  pin1          #define Nixietubea_qdp_port PORT4          #define Nixietubea_qdp_pin  pin3 & nbsp;

D, derivation of classes
In the hardware abstraction layer, the Man-machine interaction class declares the class Cdisplaysystem, derives directly from the C Nixietubea class, and its source program is as follows:
Class Cdisplaysystem:public Cnixietubea {
};

E, Declaration of objects
You can declare an object in the Chci class, and its source program is as follows:
Class Chci {public:cled Led;         Cdisplaysystem Displaysystem; };

F, other operations
Use Nixietubea need to enable 1 timer 1ms timers, Timera or Timerb can be (for example, Timerb), its startup settings in CONFIG.HPP completed, the source program is as follows: #define Internal_periphe Ral_timerb_mode 1
After the timer starts, in the Main.cpp timer interrupt function to add the display statement, the source program is as follows:
#pragma vector=timerb0_vector __interrupt void Timerb0_isr (void) {//project is set to 1ms Target.hal. Hci.         Displaysystem.display (); }

G, Call method
You can manipulate NIXIETUBEA member variables displaystring[4] and displaypoint[4 in any part of the program, where Displaystring[4] is used to set the character that the digital tube needs to display, displaypoint[4] Use to set the display of the decimal point in which the digital tube is placed. The following is the sample program, after which the digital tube will display "----" (excluding the decimal point).
Target.hal.hci.displaysystem.displaystring[0] = '-'; TARGET.HAL.HCI.DISPLAYSYSTEM.DISPLAYSTRING[1] = '-'; TARGET.HAL.HCI.DISPLAYSYSTEM.DISPLAYSTRING[2] = '-'; TARGET.HAL.HCI.DISPLAYSYSTEM.DISPLAYSTRING[3] = '-'; Target.hal.hci.displaysystem.displaypoint[0] = 0x00; TARGET.HAL.HCI.DISPLAYSYSTEM.DISPLAYPOINT[1] = 0x00; TARGET.HAL.HCI.DISPLAYSYSTEM.DISPLAYPOINT[2] = 0x00; TARGET.HAL.HCI.DISPLAYSYSTEM.DISPLAYPOINT[3] = 0x00;

3, C Nixietubea class member variables and member functions of the description
Member Variable:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.