ATY_LIB
V2_102_230218
ATY_LIB for general devices or ALGO
Loading...
Searching...
No Matches
blink_stc8g1k08a.c
Go to the documentation of this file.
1
// Copyright 2021 IOsetting <iosetting(at)outlook.com>
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
/***
16
* Demo: STC8G1K08A LED Blink
17
*
18
* Pin connection:
19
*
20
* ___
21
* P5.4 -| |- P3.3 <-- LED --> 4.7KR -> GND
22
* 3.3V -> VCC -| |- P3.2 <-- LED --> 4.7KR -> GND
23
* P5.5 -| |- TX
24
* GND -> GND -|___|- RX
25
*
26
*
27
* test-board: Minimum System; test-MCU: STC8G1K08A
28
*/
29
30
#include "
fw_hal.h
"
31
32
void
GPIO_Init
(
void
)
33
{
34
// P3.2, P3.3
35
GPIO_P3_SetMode
(
GPIO_Pin_2
|
GPIO_Pin_3
,
GPIO_Mode_Output_PP
);
36
}
37
38
int
main
(
void
)
39
{
40
GPIO_Init
();
41
42
while
(1)
43
{
44
/* Set by bit, P32 outputs high and P33 outputs low */
45
P32 =
SET
;
46
P33 =
RESET
;
51
SYS_Delay
(500);
52
53
/* Set by bit, P32 outputs low and P33 outputs high */
54
P32 =
RESET
;
55
P33 =
SET
;
60
SYS_Delay
(500);
61
}
62
}
main
int main(void)
Definition:
blink_stc8g1k08a.c:38
GPIO_Init
void GPIO_Init(void)
Definition:
blink_stc8g1k08a.c:32
GPIO_P3_SetMode
#define GPIO_P3_SetMode(__PINS__, __MODE__)
Definition:
fw_gpio.h:89
GPIO_Pin_2
@ GPIO_Pin_2
Definition:
fw_gpio.h:47
GPIO_Pin_3
@ GPIO_Pin_3
Definition:
fw_gpio.h:48
GPIO_Mode_Output_PP
@ GPIO_Mode_Output_PP
Definition:
fw_gpio.h:24
fw_hal.h
SYS_Delay
void SYS_Delay(uint16_t t)
Definition:
fw_sys.c:65
RESET
@ RESET
Definition:
fw_types.h:84
SET
@ SET
Definition:
fw_types.h:85
ATY_LIB
FwLib_STC8
demo
gpio
led_blink
blink_stc8g1k08a.c
Generated by
1.9.6