求助··蓝牙手柄上ATmega8L-8PU最简单下载方法
如题最近在研究手机用蓝牙手柄
资料查了几天几夜但ATmega8L-8PU上下载程序难倒了没有单片机经验拿HEX文件找人烧可行否?
该图属网上收集不知道作者 冒犯了
请帮助下如果你能烧录我购买也成
QQ 389731523
烧录代码有了
代码:
#include <avr/io.h>
#include <avr/iom8.h>
#include <avr/macros.h>
void Delay_mS(unsigned int Time) {
unsigned char n;
while(Time > 0) {
for(n = 1; n < 187; n++) {
asm("nop");
}
Time--;
}
}
void port_init(void) {
PORTB = 0xff;
DDRB= 0x00;
PORTC = 0xff; //m103 output only
DDRC= 0x00;
PORTD = 0xff;
DDRD= 0x00;
}
void uart0_init(void) {
UCSRB = 0x00; //disable while setting baud rate
UCSRA = 0x02;
UCSRC = BIT(URSEL) | 0x06;
UBRRL = 0x67; //set baud rate low (9600)
UBRRH = 0x00; //set baud rate high
UCSRB = 0x18;
}
void init_devices(void) {
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
uart0_init();
MCUCR = 0x00;
GICR= 0x00;
TIMSK = 0x00; //timer interrupt sources
SEI(); //re-enable interrupts
//all peripherals are now initialized
}
void uart0_putChar(unsigned char ch) {
while(!(UCSRA & (1 << UDRE)))
;
UDR = ch;
}
int main (void) {
unsigned short preKey = 0xFFFF;
unsigned short tmp = 0xFFFF;
init_devices();
tmp = ((PINB | 0xFFC1) >> 1) & (((0xFFE0 | PINC) << 5) | 0b1111110000011111);
preKey = tmp;
while(1) {
tmp = ((PINB | 0xFFC1) >> 1) & (((0xFFE0 | PINC) << 5) | 0b1111110000011111);
if(preKey != tmp) {
Delay_mS(30);
if(preKey != tmp) {
preKey = tmp;
uart0_putChar(0xf0);
uart0_putChar(~(preKey >> 8));
uart0_putChar(~preKey);
uart0_putChar(0x0f);
}
}
}
return 0;
}
要不有ATmega8L-8PU的烧两个来我直接买吧{:soso_e127:} 可以查看这个帖子里的回帖
http://www.geek-workshop.com/forum.php?mod=viewthread&tid=230
页:
[1]