FwLib_STC8
FwLib_STC8 copied to clipboard
Have simple code GPIO input/output led ?
Hello
i try codeing gpio input/output for STC8G1K08A but i can't send output port like arduino
#include "fw_hal.h"
void GPIO_Init()
{
GPIO_P3_SetMode(GPIO_Pin_0, GPIO_Mode_Output_PP);
}
void main()
{
GPIO_Init();
SYS_SetClock();
while (1)
{
SYS_Delay(10);
}
}
can add simple basic code GPIO input/output led ?

thankyou
It's similar while the syntax/methods are different, in you code
void main()
{
GPIO_Init();
SYS_SetClock(); // Not needed if you just want to drive a led, wrong trim values may break the MCU from running.
while (1)
{
// You need to add some code here to set the pin to output high/low voltage level to make the led blink, e.g. P30 = SET
SYS_Delay(10);
}
}
I have added a simple led-blink example that run on stc8g1k08a sop8.