求助··蓝牙手柄上ATmega8L-8PU最简单下载方法
如题最近在研究手机用蓝牙手柄
资料查了几天几夜但ATmega8L-8PU上下载程序难倒了没有单片机经验拿HEX文件找人烧可行否?
该图属网上收集不知道作者 冒犯了
请帮助下如果你能烧录我购买也成
QQ 389731523 硬件你都弄好了吗?
烧录的文件有了吗? 公孙林 发表于 2012-5-6 05:34 static/image/common/back.gif
硬件你都弄好了吗?
烧录的文件有了吗?
烧录代码有了
代码:
#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的烧两个来我直接买吧 hah6969zw 发表于 2012-5-6 10:11 static/image/common/back.gif
烧录代码有了
代码:
这不是烧写的HEX文件,只是源代码,还需要编译器编译后才能生成HEX烧写文件,如果你的电脑带25针的打印机座的话,可以自己做条下载线给ATmega8L下载程序!网上搜索自制ISP下载线就可以找到,希望对你有帮助!
PLA 发表于 2012-5-6 19:43 static/image/common/back.gif
这不是烧写的HEX文件,只是源代码,还需要编译器编译后才能生成HEX烧写文件,如果你的电脑带25针的打印机 ...
有HEX文件了但是下载可能有问题 我回了个帖子,弘毅的8L贴,有详细图解,搜下atmega8l
帮thomas补充下链接http://www.geek-workshop.com/forum.php?mod=viewthread&tid=230,里面的回帖有。。 hah6969zw 发表于 2012-5-6 22:56 static/image/common/back.gif
有HEX文件了但是下载可能有问题
看你的原理图上没有晶振应该用的是内部晶振,不知道是几M,在熔丝位里设置相应的频率,电路图上单片机的2脚与蓝牙模块的1脚是不是也应该连上! 怎么看代码像51用的? thomas 发表于 2012-5-7 09:25 static/image/common/back.gif
我回了个帖子,弘毅的8L贴,有详细图解,搜下atmega8l
很详细啊谢谢 弘毅 发表于 2012-5-7 09:36 static/image/common/back.gif
帮thomas补充下链接http://www.geek-workshop.com/forum.php?mod=viewthread&tid=230,里面的回帖有。。
谢谢 准备买个usbisp去 PLA 发表于 2012-5-7 11:05 static/image/common/back.gif
看你的原理图上没有晶振应该用的是内部晶振,不知道是几M,在熔丝位里设置相应的频率,电路图上单片机的 ...
只要个数据和电源3只脚可以了吧 PLA 发表于 2012-5-7 11:05 static/image/common/back.gif
看你的原理图上没有晶振应该用的是内部晶振,不知道是几M,在熔丝位里设置相应的频率,电路图上单片机的 ...
只要个数据和电源3只脚可以了吧 hah6969zw 发表于 2012-5-7 21:42 static/image/common/back.gif
只要个数据和电源3只脚可以了吧
6pin~~~VCC和GND,还有4根数据传输线。 本帖最后由 PLA 于 2012-5-11 22:04 编辑
单片机的TXD和RXD与蓝牙模块的TXD和RXD要相互交叉连接!用ISP给单片机下载程序需要6条线,分别是电源+、-、MOSI、MISO、SCK、RESET。自制ISP下载线请看:http://www.86dianzi.com/thread-2905-1-1.html
页:
[1]