资源简介
C8051F320的USB驱动程序,含一路ADC采集,内部温度测量,SD卡信息读取功能。

代码片段和文件信息
/*
================================================================================
File Name : main.c
Author : LiYong
Date : 2008-12-9 12:30
Version : 1.0
Description : This file contains the main entry and some harware operations
Note :
================================================================================
*/
#define _MAIN_C_
#include “mytypedef.h“
#include “usb.H“
#include “F32x_USB_Register.h“
#include “sddriver.h“
#include “C8051FMacros.H“
INT8U USB_InBuff[EP1_PACKET_SIZE];
INT8U USB_OutBuff[EP2_PACKET_SIZE];
/*Initialize the system and USB clock*/
void Clock_Init( void );
/*Handle the bootloader data*/
INT8U BootloaderHandler( void );
/*Initial the GPIOs and the crossbar*/
void GPIO_Init( void );
/*Initialize the SPI bus*/
void SPI_Init( void );
/*
================================================================================
Function name : KeyScan( )
Description : Scan the key board and returns the events
Input : None
Output : The events at the keyboard
================================================================================
*/
//P2.3 P2.4P2.5P2.6P2.7
static INT8U KeyStatus = 0xFF;
static INT8U KeyValue = 0;
#define K_NONE 0x00
#define K1_PRESS 0x01
#define K2_PRESS 0x02
#define K3_PRESS 0x03
#define K4_PRESS 0x04
#define K5_PRESS 0x05
#define K6_PRESS 0x06
#define K1_RELEASE 0x10
#define K2_RELEASE 0x20
#define K3_RELEASE 0x30
#define K4_RELEASE 0x40
#define K5_RELEASE 0x50
#define K6_RELEASE 0x60
INT8U KeyScan( void )
{
volatile INT8U btmp;
volatile INT8U x0x2;
P0 |= 0x0F;
P2 |= 0x03;
for(btmp = 0; btmp < 5; btmp ++ );
btmp = ( P0 & 0x0F ) | ( ( P2 & 0x03 ) << 4 );
if( KeyStatus == 0xFF )
{
KeyStatus = btmp;
}
if( KeyStatus == btmp )
{
return K_NONE;
}
btmp ^= KeyStatus; //找出不同的bit
KeyStatus ^= btmp; //btmp和KeyStatus交换
if( btmp & ( 1<<0 ) )
{
if( KeyStatus & ( 1<<0 ) )
{
KeyValue &= ~( 1<<3 );
return K4_RELEASE;
}
else
{
KeyValue |= ( 1<<3 );
return K4_PRESS;
}
}
if( btmp & ( 1<<1 ) )
{
if( KeyStatus & ( 1<<1 ) )
{
KeyValue &= ~( 1<<2 );
return K3_RELEASE;
}
else
{
KeyValue |= ( 1<<2 );
return K3_PRESS;
}
}
if( btmp & ( 1<<2 ) )
{
if( KeyStatus & ( 1<<2 ) )
{
KeyValue &= ~( 1<<1 );
return K2_RELEASE;
}
else
{
KeyValue |= ( 1<<1 );
return K2_PRESS;
}
}
if( btmp & ( 1<<3 ) )
{
if( KeyStatus & ( 1<<3 ) )
{
KeyValue &= ~( 1<<0 );
return K1_RELEASE;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 91545 2005-09-22 10:18 原USB_Control_MCU\APPs\C51L.LIB
文件 16194 2006-10-24 08:09 原USB_Control_MCU\APPs\c8051F320.h
文件 686 2011-01-27 12:38 原USB_Control_MCU\APPs\C8051FMacros.h
文件 10590 2011-02-21 23:47 原USB_Control_MCU\APPs\main.c
文件 3261 2011-01-27 11:37 原USB_Control_MCU\APPs\main.c.bak
文件 672 2009-04-29 18:30 原USB_Control_MCU\APPs\main.h
文件 1753 2009-03-13 11:01 原USB_Control_MCU\APPs\MyTypeDef.h
文件 5253 2008-04-20 21:54 原USB_Control_MCU\APPs\STARTUP.A51
目录 0 2013-02-16 22:03 原USB_Control_MCU\APPs
文件 18902 2013-01-27 16:00 原USB_Control_MCU\Project\List\main.lst
文件 50796 2013-01-27 16:00 原USB_Control_MCU\Project\List\sdcmd.lst
文件 8670 2013-01-27 16:00 原USB_Control_MCU\Project\List\sdcrc.lst
文件 18929 2013-01-27 16:00 原USB_Control_MCU\Project\List\sddriver.lst
文件 12135 2013-01-27 16:00 原USB_Control_MCU\Project\List\STARTUP.lst
文件 60102 2013-01-27 16:00 原USB_Control_MCU\Project\List\USB.lst
文件 94066 2013-01-27 16:00 原USB_Control_MCU\Project\List\USB_Control_MCU.m51
文件 11690 2013-01-27 16:00 原USB_Control_MCU\Project\List\USB_HID_Desc
目录 0 2013-02-16 22:03 原USB_Control_MCU\Project\List
文件 19 2011-02-21 22:12 原USB_Control_MCU\Project\Output\ExtDll.iex
文件 203 2010-03-26 11:45 原USB_Control_MCU\Project\Output\F320Bootloader.plg
文件 31183 2013-01-27 16:00 原USB_Control_MCU\Project\Output\main.obj
文件 43237 2013-01-27 16:00 原USB_Control_MCU\Project\Output\sdcmd.obj
文件 1570 2013-01-27 16:00 原USB_Control_MCU\Project\Output\sdcrc.obj
文件 36229 2013-01-27 16:00 原USB_Control_MCU\Project\Output\sddriver.obj
文件 869 2013-01-27 16:00 原USB_Control_MCU\Project\Output\STARTUP.obj
文件 52186 2013-01-27 16:00 原USB_Control_MCU\Project\Output\USB.obj
文件 161217 2013-01-27 16:00 原USB_Control_MCU\Project\Output\USB_Control_MCU
文件 24673 2013-01-27 16:00 原USB_Control_MCU\Project\Output\USB_Control_MCU.hex
文件 259 2013-01-27 16:00 原USB_Control_MCU\Project\Output\USB_Control_MCU.lnp
文件 196 2013-02-25 22:25 原USB_Control_MCU\Project\Output\USB_Control_MCU.plg
............此处省略38个文件信息
- 上一篇:微型计算机技术孙德文课后答案(三)
- 下一篇:mimo信道矩阵
相关资源
- 联想lenovo G480 USB3.0驱动程序 for win7
- TPC-ZK系列USB学生实验指导书
- usb hid调试工具
- HID调试助手
- USB.Over.Network.Server 注册机
- WPF USB 网络 串口 通信软件
- USB转串口驱动,FT232R驱动程序,最新
- WinCE下CP210x的驱动程序
- hidusage.h hidpi.h 等USB开发用头文件
- 基于JM20329的SATA转USB 1394
- 430系列单片机USBFET下载驱动
- CY7C68013A固件程序(用于摄像机采集)
- usb调试程序 对USB设备进行数据的读写
- USB 驱动 让电脑与arm进行通信
- USB助手(调试USB通信协议的工具) 源
- 基于FPGA的USB接口设计
- 枚举USB设备接口(C 源代码)
- 多普达USB Modem驱动(适用于818、828、
- SN9C291B datasheet
- 希捷公布USB外部硬盘解决方案
- USB调试模式一键设置
- USB网卡驱动 USB2.0 TO Fast Ethernet Adapte
- USB转串口(RS232/RS485/RS422)驱动程序文
- USB Type-C SPEC
- H310.B360.H370.Z390.USB WIN7 64位第三方驱动
- 300系列WIN7 USB驱动.7z
- 华硕P8H61/USB3 R2.0主板BIOS驱动 免费版
- RTL8188EVT USB WIFI无线网卡驱动 免费版
- RTL8188 USB无线网卡模块完整方案
- USB PCB布局布线要点及注意事项
评论
共有 条评论