Nano100BN Series BSP  V3.03.002
The Board Support Package for Nano100BN Series
NuEdu-Basic01_7_Segment.c
Go to the documentation of this file.
1 /**************************************************************************/
12 #include <stdio.h>
13 #include "Nano100Series.h"
27 /*---------------------------------------------------------------------------------------------------------*/
28 /* Porting Define */
29 /*---------------------------------------------------------------------------------------------------------*/
30 #define SEG_A_ON PA2=0
31 #define SEG_B_ON PA3=0
32 #define SEG_C_ON PA4=0
33 #define SEG_D_ON PA5=0
34 #define SEG_E_ON PA6=0
35 #define SEG_F_ON PA7=0
36 #define SEG_G_ON PD6=0
37 #define SEG_H_ON PD7=0
38 #define SEG_CONTROL1_ON PD14=1
39 #define SEG_CONTROL2_ON PD15=1
41 #define SEG_A_OFF PA2=1
42 #define SEG_B_OFF PA3=1
43 #define SEG_C_OFF PA4=1
44 #define SEG_D_OFF PA5=1
45 #define SEG_E_OFF PA6=1
46 #define SEG_F_OFF PA7=1
47 #define SEG_G_OFF PD6=1
48 #define SEG_H_OFF PD7=1
49 #define SEG_CONTROL1_OFF PD14=0
50 #define SEG_CONTROL2_OFF PD15=0
56 void Initial_SEG_GPIO(void)
57 {
58  //io initail output mode
59 
70 }
71 
77 {
79  SEG_A_OFF;
80  SEG_B_OFF;
81  SEG_C_OFF;
82  SEG_D_OFF;
83  SEG_E_OFF;
84  SEG_F_OFF;
85  SEG_G_OFF;
86  SEG_H_OFF;
87 }
88 
94 {
95  SEG_A_OFF;
96  SEG_B_OFF;
97  SEG_C_OFF;
98  SEG_D_OFF;
99  SEG_E_OFF;
100  SEG_F_OFF;
101  SEG_G_OFF;
102  SEG_H_OFF;
105 }
106 
115 void Show_Seven_Segment(unsigned char no, unsigned char number)
116 {
117  SEG_A_OFF;
118  SEG_B_OFF;
119  SEG_C_OFF;
120  SEG_D_OFF;
121  SEG_E_OFF;
122  SEG_F_OFF;
123  SEG_G_OFF;
124  SEG_H_OFF;
127 
128  switch(number)
129  {
130  case 1:
132  break;
133 
134  case 2:
136  break;
137  }
138 
139  switch(no)
140  {
141  //show 0
142  case 0:
143  SEG_A_ON;
144  SEG_B_ON;
145  SEG_C_ON;
146  SEG_D_ON;
147  SEG_E_ON;
148  SEG_F_ON;
149  break;
150 
151  //show 1
152  case 1:
153  SEG_B_ON;
154  SEG_C_ON;
155  break;
156 
157  //show 2
158  case 2:
159  SEG_A_ON;
160  SEG_B_ON;
161  SEG_G_ON;
162  SEG_E_ON;
163  SEG_D_ON;
164  break;
165 
166  //show 3
167  case 3:
168  SEG_A_ON;
169  SEG_B_ON;
170  SEG_G_ON;
171  SEG_C_ON;
172  SEG_D_ON;
173  break;
174 
175  //show 4
176  case 4:
177  SEG_F_ON;
178  SEG_B_ON;
179  SEG_G_ON;
180  SEG_C_ON;
181  break;
182 
183  //show 5
184  case 5:
185  SEG_A_ON;
186  SEG_F_ON;
187  SEG_G_ON;
188  SEG_C_ON;
189  SEG_D_ON;
190  break;
191 
192  //show 6
193  case 6:
194  SEG_A_ON;
195  SEG_F_ON;
196  SEG_E_ON;
197  SEG_G_ON;
198  SEG_C_ON;
199  SEG_D_ON;
200  break;
201 
202  //show 7
203  case 7:
204  SEG_A_ON;
205  SEG_B_ON;
206  SEG_C_ON;
207  SEG_F_ON;
208  break;
209 
210  //show 8
211  case 8:
212  SEG_A_ON;
213  SEG_B_ON;
214  SEG_C_ON;
215  SEG_D_ON;
216  SEG_E_ON;
217  SEG_F_ON;
218  SEG_G_ON;
219  break;
220 
221  //show 9
222  case 9:
223  SEG_A_ON;
224  SEG_B_ON;
225  SEG_C_ON;
226  SEG_F_ON;
227  SEG_G_ON;
228  break;
229  }
230 } /* end of group Nano130_Basic01_FUNCTIONS */
232  /* end of group NuEdu-SDK-Nano130_Basic01 */
234  /* end of group NANO100_Library */
236 
237 /*** (C) COPYRIGHT 2013 Nuvoton Technology Corp. ***/
#define SEG_D_ON
#define BIT5
Bit 5 mask of an 32 bit integer.
#define PD
Pointer to GPIO port D register structure.
void Show_Seven_Segment(unsigned char no, unsigned char number)
This function turn on 7_Segment LED to show numbers.
#define BIT7
Bit 7 mask of an 32 bit integer.
#define SEG_G_ON
#define BIT6
Bit 6 mask of an 32 bit integer.
#define BIT4
Bit 4 mask of an 32 bit integer.
#define SEG_A_OFF
#define SEG_B_ON
Nano100 series peripheral access layer header file. This file contains all the peripheral register's ...
#define SEG_B_OFF
#define SEG_CONTROL2_ON
NuEdu-Basic01 7_Segment LED driver header file for NuEdu-SDK-Nano130.
#define SEG_D_OFF
#define SEG_C_ON
#define BIT2
Bit 2 mask of an 32 bit integer.
#define SEG_E_OFF
#define SEG_CONTROL1_ON
#define SEG_F_ON
#define SEG_F_OFF
#define PA
Pointer to GPIO port A register structure.
void Close_Seven_Segment(void)
This function turn off 7_Segment LED.
#define BIT3
Bit 3 mask of an 32 bit integer.
void Initial_SEG_GPIO(void)
Set 7_Segment LED GPIO to output mode.
#define BIT15
Bit 15 mask of an 32 bit integer.
void Open_Seven_Segment(void)
This function turn on 7_Segment LED.
#define SEG_CONTROL1_OFF
#define SEG_E_ON
#define SEG_C_OFF
#define GPIO_PMD_OUTPUT
Definition: gpio.h:38
#define SEG_H_OFF
#define BIT14
Bit 14 mask of an 32 bit integer.
#define SEG_A_ON
#define SEG_CONTROL2_OFF
#define SEG_G_OFF
void GPIO_SetMode(GPIO_T *gpio, uint32_t u32PinMask, uint32_t u32Mode)
Set GPIO operation mode.
Definition: gpio.c:40