USBHUDSTM32103X系列代码默认是RBt6,最简单也最 实用的发送接收,改VIDPID,报告ID
stm103源码实用,发送接收数据,USB可修改文件在在desc.c endp.c中,希望你熟悉usb-hid
stm103源码实用,发送接收数据,USB可修改文件在在desc.c endp.c中,希望你熟悉usb-hid
#include <hidef.h> #include <mc9s12xs128.h> #include <stdio.h> #include "LQprintp.h" #include "LQinit.h" #include "LQ12864.h" #pragma LINK_INFO DERIVATIVE "mc9s12dg128b" void Dly_ms(int ms) { int ii,jj; if (ms<1) ms=1; for(ii=0;ii<ms;ii++) for(jj=0;jj<2770;jj++); //32MHz--1ms } //----------------------------------------------------- byte Scan_Key(void) { Dly_ms(10); if(PORTE_PE7==0) return 'o'; // OK else if(PORTE_PE6==0) return 'c'; // ESC else if(PORTE_PE5==0) return 'd'; // DOWN else if(PORTE_PE4==0) return 'r'; // RIGHT else if(PORTE_PE3==0) return 'l'; // LEFT else if(PORTE_PE2==0) return 'u'; // UP
//现象:PB灯闪动,周期是INTVERAL*(0.01)ms,可用来记时. //demo by whut_wj #include <hidef.h> /* common defines and macros */ #include <MC9S12XS128.h> /* derivative information */ #pragma LINK_INFO DERIVATIVE "mc9s12xs128" #define INTVERAL 100 void SetBusClock(void) { CLKSEL=0X00; //disengage PLL to system PLLCTL_PLLON=1; //turn on PLL SYNR=2; REFDV=1; //pllclock=2*osc*(1+SYNR)/(1+REFDV)=48MHz; _asm(nop); //BUS CLOCK=24M _asm(nop); while(!(CRGFLG_LOCK==1)); //when pll is steady
不错的代码,来的看看,pit定时,学习资料xs128#include <hidef.h> #include <mc9s12xs128.h> #include <stdio.h> #include "LQprintp.h" #include "LQinit.h" #include "LQ12864.h" #pragma LI