Buy an Axon, Axon II, or Axon Mote and build a great robot, while helping to support SoR.
0 Members and 1 Guest are viewing this topic.
4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600, 1382400
why changing the clock would brick? (sorry noob question, probably)
The only sure fired way with an ATMega640 is with a clock speed of 11.0592MHz with the U2X register bit turned on, and a baud register UBRR=0 (see ATMega datasheet).That would give you 1.3824 baudThe Axon is clocked at 16Mhz and you may not want to brick your Axon in the attempt!
asked for help to know if anyone could help so I could spare my self to start reading all datasheets of every serial device there is.
Is there a way to delay the signal some seconds so I can get the bluetooth device config it self?(last hope)
I tried it but a strange thing happened when I connect the A0 to the receiver it stops responding.
I turn on the device and connect the rx to tx to make sure it is working alright,On what "device"? How are you making sure "it" is working alright - I thought you had nothing that could talk to it - hence me writing the code? You cant be talking about the Axon since I have implemented a Transmit-only-uart, it has no concept of 'receive'
baud rate 38400, 8 data bits, 1 stop bit, no parity bit, no flow control
static void send(unsigned char xmit){ unsigned char stat = SREG; unsigned char bits; asm volatile ( "cli" "\n\t" "ldi %2,10" "\n\t" "com %0" "\n\t" "sec" "\n\t"// Takes 9 cycles to send one bit"putchar0%=:" "brcc putchar1%=" "\n\t" "cbi %1,0" "\n\t" "rjmp putchar2%=" "\n\t""putchar1%=:" "sbi %1,0" "\n\t" "nop" "\n\t""putchar2%=:" // Add nops in here where// Num nops= ((F_CPU / baud) - 9)// (16MHz / 1,382,400 baud) - 9 = 3 "nop" "\n\t" "nop" "\n\t" "nop" "\n\t" "lsr %0" "\n\t" "dec %2" "\n\t" "brne putchar0%=" "\n\t" : : "r" (xmit), "I" (_SFR_IO_ADDR(PORTA)) , "r" (bits) ); SREG = stat;}
void setup() { pinMode (7, OUTPUT);}void loop () { debug_serout_IO (0xaa); }#define LO_BIT \ asm("cbi 0x0B,7"); \ asm("nop"); \ asm("nop"); \ asm("nop"); #define HI_BIT \ asm("sbi 0x0B,7"); \ asm("nop"); \ asm("nop"); \ asm("nop"); void debug_serout_IO (unsigned int val) { HI_BIT; LO_BIT; //start HI_BIT; // B1 LO_BIT; // B2 HI_BIT; // B3 LO_BIT; // B4 HI_BIT; // B5 LO_BIT; // B6 HI_BIT; // B7 LO_BIT; // B8 HI_BIT; // stop delay (5); // stop bit}
Did that really run at 1.3824MHz with all those instructions?
Webbot's send loop is 11 instruction cycles per bit, giving a baud rate of 16000000/11 = 1.4545MBaud on a standard Axon/ATMega.