📄 dev_io.c
字号:
//-----------------------------------------------------------------------------
// File: gpio.c
// Contents: main module of a simple non-renumerating firmware example
// 本程序的目的是演示如何使用端口的GPIO方式。
// 稍加修改即可实现跑马灯
//-----------------------------------------------------------------------------
// Copyright 2003, Cypress Semiconductor Corporation
//-----------------------------------------------------------------------------
#include "fx2.h"
#include "fx2regs.h"
void gpio_Init();
main()
{
int i;
gpio_Init(); // Initialize GPIO
while(TRUE)
{
if(i++ >1000)
i= 0;
}
}
void gpio_Init()
{
//配置ABD端口为输出模式,若为输入模式,则置为0
OEA = 0xFF;
OEB = 0xFF;
OED = 0xFF;
//输出值为全高电平
IOA = 0xFF;
IOB = 0xff;
IOD = 0xff;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -