⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 funckey.c

📁 本人编写的无线电话程序,给予PIC18C801设计,包括了uCOS的移植以及菜单,自己设计的拼音注入法,完整地一级汉字库,希望对大家有所帮助
💻 C
字号:
/* File name: funcKey.c                                                                              */
/* Description:                                                                                      */
/*   This file includes function to scan the keypad                                                  */
/* State:                                                                                            */
/*   Under test with test1.mcp                                          2003.1.16                    */

//#include <p18cxxx.h>
#include "includes.h"

#define PINPUT	1
#define POUTPUT	0

#define KSI0	LATHbits.LATH4
#define KSI1	LATFbits.LATF2
#define KSI2	LATFbits.LATF6
#define KSI3	LATFbits.LATF7
#define KSI4	LATAbits.LATA1

#define KSO0	PORTFbits.RF0
#define KSO1	PORTFbits.RF1
#define KSO2	PORTHbits.RH7
#define KSO3	PORTHbits.RH6
#define KSO4	PORTHbits.RH5

/*
#define KEY_0	'0'
#define KEY_1	'1'
#define KEY_2	'2'
#define KEY_3	'3'
#define KEY_4	'4'
#define KEY_5	'5'
#define KEY_6	'6'
#define KEY_7	'7'
#define KEY_8	'8'
#define KEY_9	'9'
#define KEY_STAR	0x2a
#define KEY_CROSS	0x23

#define KEY_SEND	0x70
#define KEY_C		0x71
#define KEY_HANDFREE	0x72
#define KEY_REDIAL	0x73

#define KEY_UP		0x74
#define KEY_DOWN	0x75
#define KEY_FUNC1	0x76
#define KEY_FUNC2	0x77
#define KEY_F0	0x78
#define KEY_F1	0x79
#define KEY_F2	0x7a
#define KEY_F3	0x7b
#define KEY_F4	0x7c

#define KEY_NULL	0x00
*/

#pragma code MYCODE

//This function set pins used in key scan to correct output/input
void Do_Key_Init(void){
	//Set KSIx as output
	//TRISHbits.TRISH4 = POUTPUT;
	//TRISFbits.TRISF2 = POUTPUT;
	//TRISFbits.TRISF6 = POUTPUT;
	//TRISFbits.TRISF7 = POUTPUT;
	//TRISGbits.TRISG0 = POUTPUT;
	//Set KSOx as input
	//TRISFbits.TRISF0 = PINPUT;
	//TRISFbits.TRISF1 = PINPUT;
	//TRISHbits.TRISH7 = PINPUT;
	//TRISHbits.TRISH6 = PINPUT;
	//TRISHbits.TRISH5 = PINPUT;
	//Set KSIx to default value
	KSI0 = 1;
	KSI1 = 1;
	KSI2 = 1;
	KSI3 = 1;
	KSI4 = 1;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -