/Spektrum-Diversity/Hardware/bestellen.txt |
---|
0,0 → 1,3 |
http://de.farnell.com/jst-japan-solderless-terminals/s3b-zr-lf-sn/stiftleiste-horizontal-3pol/dp/9491821 |
http://de.farnell.com/microchip/mcp1826s-3002e-db/ldo-3-0v-1a-sot-223-3/dp/1578422 |
http://de.farnell.com/tyco-electronics-alcoswitch/fsm2jsma/taster-mikro-fsm2jsma-h-4-3mm-smd/dp/3801287 |
/Spektrum-Diversity/Hardware/bottom.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/Spektrum-Diversity/Hardware/diversity.brd |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/Spektrum-Diversity/Hardware/diversity.sch |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/Spektrum-Diversity/Hardware/fuses.txt |
---|
0,0 → 1,4 |
high 0xDD |
low 0xD4 |
ext 0xFF |
/Spektrum-Diversity/Hardware/schematic.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/Spektrum-Diversity/Hardware/top.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/Spektrum-Diversity/Software/diversity.aps |
---|
0,0 → 1,0 |
<AVRStudio><MANAGEMENT><ProjectName>diversity</ProjectName><Created>23-Jul-2010 13:27:06</Created><LastEdit>26-Jul-2010 16:05:03</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>23-Jul-2010 13:27:06</Created><Version>4</Version><Build>4, 18, 0, 670</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\diversity.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>D:\Pendsa\diversity\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>JTAGICE mkII</CURRENT_TARGET><CURRENT_PART>ATmega128.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>diversity.c</SOURCEFILE><OTHERFILE>default\diversity.lss</OTHERFILE><OTHERFILE>default\diversity.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>attiny2313</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>diversity.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\Programme\WinAVR-20081205\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\Programme\WinAVR-20081205\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><ProjectFiles><Files><Name>D:\Pendsa\diversity\diversity.c</Name></Files></ProjectFiles><IOView><usergroups/><sort sorted="0" column="0" ordername="1" orderaddress="1" ordergroup="1"/></IOView><Files><File00000><FileId>00000</FileId><FileName>diversity.c</FileName><Status>1</Status></File00000></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> |
/Spektrum-Diversity/Software/diversity.aws |
---|
0,0 → 1,0 |
<AVRWorkspace><IOSettings><CurrentRegisters><WATCHDOG><register register="WDTCR" group="WATCHDOG" display="1" locked="0"/></WATCHDOG></CurrentRegisters></IOSettings><part name="ATmega128"/><Files><File00000 Name="D:\Pendsa\diversity\diversity.c" Position="262 71 1328 776" LineCol="165 66" State="Maximized"/></Files></AVRWorkspace> |
/Spektrum-Diversity/Software/diversity.c |
---|
0,0 → 1,193 |
// ************************************************************ |
// ** Spektrum Diversity - use up to 8 satellite receivers ** |
// ************************************************************ |
// ** Target: An Atmel ATtiny2313 (RC-Oscillator @ 8 MHz) ** |
// ** controls a 74HC151 Multiplexer ** |
// ************************************************************ |
// ** It monitors the data from 8 satellite receivers and ** |
// ** connects a valid one to the output via the multiplexer ** |
// ************************************************************ |
// ** LED-Modes during startup (in chronological order) ** |
// ** ************************ ** |
// ** LED fast blink: Waiting for first datapulse ** |
// ** LED slow blink: Waiting 3 seconds while counting sat's ** |
// ** LED flashes: Indicates the number of active sat's ** |
// ** ** |
// ** LED-Modes during operation ** |
// ** ************************** ** |
// ** LED OFF: Everything is fine ** |
// ** LED ON: FAILURE - The first selected sat had lost sync ** |
// ************************************************************ |
// ** (c) 2010-0xFFFF Stefan Pendsa ** |
// ** License: don't know - use it and have fun ** |
// ************************************************************ |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <util/delay.h> |
#define LED_OFF PORTD |= 1 << PORTD3 |
#define LED_ON PORTD &= ~(1 << PORTD3) |
volatile unsigned int TimerEvent; |
void SelectSat(unsigned char sat) |
{ |
/* |
Re-Assignment due to easier routing on layout: sat -> mux-channel# -> mux-input (seen from µC) |
0 -> 2 -> 2 |
1 -> 1 -> 4 |
2 -> 0 -> 0 |
3 -> 3 -> 6 |
4 -> 4 -> 1 |
5 -> 5 -> 5 |
6 -> 6 -> 3 |
7 -> 7 -> 7 |
*/ |
if (sat == 0) sat = 2; |
else if (sat == 1) sat = 4; |
else if (sat == 2) sat = 0; |
else if (sat == 3) sat = 6; |
else if (sat == 4) sat = 1; |
else if (sat == 5) sat = 5; |
else if (sat == 6) sat = 3; |
else if (sat == 7) sat = 7; |
PORTD = (PORTD & 0b00001000) | sat; |
} |
void ResetTimer(void) |
{ |
TCNT1H = 0; |
TCNT1L = 0; |
TimerEvent = 0; |
} |
ISR(TIMER1_OVF_vect) // Triggered every 4,096 msec |
{ |
TimerEvent++; |
} |
int main(void) |
{ |
unsigned char i = 0; |
unsigned int j = 0; |
unsigned char active[8]; |
unsigned char sat = 9; |
DDRB = 0b00000000; // PORT A INPUT FOR SATELLITES |
DDRD = 0b00001111; // PORT B OUTPUT FOR MUX AND LED |
PORTB = 0b11111111; // PORT A PULLUP's FOR (unused) SATELLITES |
TCCR1B = ( 1 << CS10 ); // Timer1 Prescaler 1 = 4,096 msec |
TIMSK = ( 1 << TOIE1 ); // Timer1 Overflow Interrupt Enable |
sei(); // Global Interrupts enable |
for (i=0;i<8;i++) active[i] = 0; // Reset active-array |
ResetTimer(); |
while(PINB == 255) // Wait for first signal (SYNC to frame) |
{ |
if (TimerEvent == 10) LED_ON; // Blink while waiting... |
if (TimerEvent == 20) |
{ |
LED_OFF; |
TimerEvent = 0; |
} |
} |
LED_OFF; |
ResetTimer(); |
while(1) // Check active satellites for 3 seconds |
{ |
if (TimerEvent == 20) LED_ON; // Blink (slower) while waiting... |
if (TimerEvent == 40) |
{ |
LED_OFF; |
TimerEvent = 0; |
j++; |
} |
for (i=0;i<8;i++) |
{ |
if (!(PINB & (1<<i))) |
{ |
active[i] = 1; |
if (sat == 9) // Select first active satellite (only once) |
{ |
sat = i; |
SelectSat(i); |
} |
} |
} |
if (j == 9) break; // 9 * 40 * 8ms = ~3sec |
} |
LED_OFF; |
_delay_ms(1000); |
for (i=0;i<8;i++) // Flash once for every active satellite |
{ |
if (active[i] == 1) |
{ |
LED_ON; |
_delay_ms(200); |
LED_OFF; |
_delay_ms(200); |
} |
} |
while(1) // Main-Loop |
{ |
ResetTimer(); |
while(PINB == 255) // Wait for first signal (SYNC to frame) |
{ |
if (TimerEvent > 3) break; // (max. 3*8=24ms) |
} |
for (i=0;i<8;i++) active[i] = 0; // Reset active-array |
ResetTimer(); |
while(TimerEvent < 1) // Check active satellites (for 1*8=8ms) |
{ |
for (i=0;i<8;i++) |
{ |
if (!(PINB & (1<<i))) |
{ |
active[i] = 1; |
} |
} |
} |
if (active[sat] == 0) // Detect fail on active satellite |
{ |
LED_ON; // Failure-LED ON (never goes off again) |
for (i=0;i<8;i++) // Select lowest active satellite |
{ |
if (active[i] == 1) |
{ |
sat = i; |
SelectSat(sat); |
break; |
} |
} |
} |
} |
} |