by Miamicanes » Tue Jun 17, 2008 12:03 am
by Miamicanes
Tue Jun 17, 2008 12:03 am
A little while ago, I connected a Mega168 to an AX-S1 as follows:
* bus ground to AVR ground (cm5's ground)
* AVR TXD to bus data (cm5's data not connected to anything, AVR's TXD connected to AX-S1's data pin )
* bus +9.6v to 5v regulator (cm5's output to regulator)
and wrote a short program that basically initialized the USART to double-speed, 1mbps (UBRR0H:L = 0:0), no pairity, 1 stop bit, and sent the following datagram to the AX-S1:
0xFF 0xFF (prelude)
0x64 (recipient = address 100)
0x04 (length = 2 argument bytes + 2)
0x03 (write data)
0x28 (buzzer frequency)
0x10 (16 = buzzer index)
0xA3 ((0x64 + 0x04 + 0x03 + 0x28 + 0x10) && 0xff )
Nothing happened. About an hour earlier, I verified that writing 0x10 to register 0x28 on the device with address=0x64 DID produce a tone using robot terminal.
At this point, I'm trying to figure out where I went wrong, starting with the easy/obvious things...
a) Did I get the datagram right, including the checksum?
b) If the AVR is 5v, do I have to do anything special with the output of its TXD pin (not counting half-duplex switching, of course... right now I'm just trying to get an experiment involving a one-way broadcast that produces an observable result to work before moving on to worry about the half-duplex issues)
A little while ago, I connected a Mega168 to an AX-S1 as follows:
* bus ground to AVR ground (cm5's ground)
* AVR TXD to bus data (cm5's data not connected to anything, AVR's TXD connected to AX-S1's data pin )
* bus +9.6v to 5v regulator (cm5's output to regulator)
and wrote a short program that basically initialized the USART to double-speed, 1mbps (UBRR0H:L = 0:0), no pairity, 1 stop bit, and sent the following datagram to the AX-S1:
0xFF 0xFF (prelude)
0x64 (recipient = address 100)
0x04 (length = 2 argument bytes + 2)
0x03 (write data)
0x28 (buzzer frequency)
0x10 (16 = buzzer index)
0xA3 ((0x64 + 0x04 + 0x03 + 0x28 + 0x10) && 0xff )
Nothing happened. About an hour earlier, I verified that writing 0x10 to register 0x28 on the device with address=0x64 DID produce a tone using robot terminal.
At this point, I'm trying to figure out where I went wrong, starting with the easy/obvious things...
a) Did I get the datagram right, including the checksum?
b) If the AVR is 5v, do I have to do anything special with the output of its TXD pin (not counting half-duplex switching, of course... right now I'm just trying to get an experiment involving a one-way broadcast that produces an observable result to work before moving on to worry about the half-duplex issues)