?? gpio.c
字號:
//*****************************************************************************
// Filename: main.c
// Version: 0.01
// Description: EQH-01
// Returns : void
//-----------------------------------------------------------------------------
// Revision History:
// Auther:屈宵軍
// 0.01, R. qxj, 01/15/05, - Original release
//*****************************************************************************
#include <csl.h>
#include <csl_gpio.h>
#include <tms320.h>
/*********************8根通用IO引腳作為繼電器輸出和鍵盤輸入*******************/
int key1=0xFF,key2=0xFF,key3=0xFF;
void GPIO1_control(void);
void Relay(void)
{
uint k=0,m=0;
for(k=0;k<3;k++)
{
GPIO1_control();
for(m=0;m<100;m++)
{
Delay(3000);
}
GPIO_pinWrite (GPIO_PIN1, 0);
for(m=0;m<100;m++)
{
Delay(3000);
}
}
}
void GPIO1_control(void)
{
GPIO_pinEnable (GPIO_PIN1);
GPIO_pinDirection (GPIO_PIN1, GPIO_OUTPUT);
GPIO_pinWrite (GPIO_PIN1, 1); /* sets io pin1 to "1" */
}
/***************************************************************************/
void Key_Pin(void)
{
GPIO_pinEnable (GPIO_PIN3);
GPIO_pinDirection (GPIO_PIN3, GPIO_INPUT);
GPIO_pinEnable (GPIO_PIN4);
GPIO_pinDirection (GPIO_PIN4, GPIO_INPUT);
GPIO_pinEnable (GPIO_PIN6);
GPIO_pinDirection (GPIO_PIN6, GPIO_INPUT);
GPIO_pinWrite (GPIO_PIN3, 1); /* sets io pin1 to "1" */
GPIO_pinWrite (GPIO_PIN4, 1); /* sets io pin1 to "1" */
GPIO_pinWrite (GPIO_PIN6, 1); /* sets io pin1 to "1" */
}
void GET_KEY(void)
{
key1=GPIO_pinRead (GPIO_PIN3); // y(0)
key2=GPIO_pinRead (GPIO_PIN4); // y(1)
key3=GPIO_pinRead (GPIO_PIN6); // y(2)
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -