Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 777 → Rev 778

/Spektrum-Diversity/Software/diversity.aws
1,0 → 0,0
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA128"/><Files><File00000 Name="D:\Pendsa\diversity\Software\diversity.c" Position="268 96 1110 580" LineCol="139 0"/></Files></AVRWorkspace>
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATmega128"/><Files><File00000 Name="D:\Pendsa\diversity\Software\diversity.c" Position="262 71 1328 776" LineCol="8 0" State="Maximized"/></Files></AVRWorkspace>
/Spektrum-Diversity/Software/diversity.c
1,26 → 1,31
// ************************************************************
// ** Spektrum Diversity - use up to 4 satellite receivers **
// ************************************************************
// ** Target: An Atmel ATtiny2313 (RC-Oscillator @ 8 MHz) **
// ** controls a 74HC151 Multiplexer **
// ************************************************************
// ** It monitors the data from 4 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 **
// ************************************************************
// *************************************************************
// ** Spektrum Diversity - use up to 4 satellite receivers **
// *************************************************************
// ** Target: An Atmel ATtiny2313 (RC-Oscillator @ 8 MHz) **
// ** controls a 74HC151 Multiplexer **
// *************************************************************
// ** It monitors the data from 4 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 **
// ** **
// ** LED-Modes during Self-Test **
// ** ************************** **
// ** LED flashes at 1 Hz: Everything is fine **
// ** LED flashes some times: FAILURE **
// *************************************************************
// ** (c) 2010-0xFFFF Stefan Pendsa **
// ** License: don't know - use it and have fun **
// *************************************************************
 
#include <avr/io.h>
#include <avr/interrupt.h>
32,11 → 37,21
volatile unsigned int TimerEvent;
 
 
 
ISR(TIMER1_OVF_vect) // Triggered every 8,192 msec
{
TimerEvent++;
}
 
 
 
void SelectSat(unsigned char sat)
{
PORTD = (PORTD & 0b00000001) | (sat<<3); // Select the Input for 74HC151
}
 
 
 
void ResetTimer(void)
{
TCNT1H = 0;
45,6 → 60,7
}
 
 
 
void Binding(void) // Binding sequence for DX7
{
unsigned char i = 0;
65,42 → 81,63
}
 
 
 
void Testing(void) // Self Test
{
unsigned char error = 0;
unsigned char i = 0;
unsigned char error = 0;
 
DDRB = 0b11110000; // PORT B OUTPUT FOR SATELLITES, INPUT FOR FEEDBACK
PORTB = 0b00000000;
DDRB = 0b11110000; // Port B Output for satellites, Input for feedback
 
for(i=0;i<4;i++) // Test muxxing of High+Low on every Sat-Input
{
SelectSat(i);
PORTB |= 1 << (i+4);
if (!(PINB & (1<<PB3))) error++;
PORTB &= ~(1 << (i+4));
if (PINB & (1<<PB3)) error++;
}
PORTB = 0b01010000; // Test Pattern
SelectSat(0);
if (!(PINB & (1<<PB3))) error++;
SelectSat(1);
if (PINB & (1<<PB3)) error++;
SelectSat(2);
if (!(PINB & (1<<PB3))) error++;
SelectSat(3);
if (PINB & (1<<PB3)) error++;
 
PORTB = 0b10100000; // Another (inverted) Test Pattern
SelectSat(0);
if (PINB & (1<<PB3)) error++;
SelectSat(1);
if (!(PINB & (1<<PB3))) error++;
SelectSat(2);
if (PINB & (1<<PB3)) error++;
SelectSat(3);
if (!(PINB & (1<<PB3))) error++;
 
DDRB = 0b00000000; // Port B Input again
 
while(1) // Never return
{
if (error == 0) // When no error occured, flash around
if (error == 0) // When no error occured -> LED flashes at 1 Hz
{
LED_ON;
_delay_ms(100);
LED_OFF;
_delay_ms(100);
_delay_ms(900);
}
else
{
for (i=0;i<error;i++) // When error occured -> Flash once for every error
{
LED_ON;
_delay_ms(100);
LED_OFF;
_delay_ms(400);
}
_delay_ms(1000);
}
 
}
 
}
 
 
ISR(TIMER1_OVF_vect) // Triggered every 8,192 msec
{
TimerEvent++;
}
 
 
int main(void)
{
unsigned char i = 0;
108,15 → 145,15
unsigned char active[4];
unsigned char sat = 4;
 
DDRB = 0b00000000; // PORT B INPUT FOR SATELLITES AND FEEDBACK
DDRD = 0b0011001; // PORT D OUTPUT FOR MUX AND LED, INPUT FOR SWITCH & TEST
PORTB = 0b11110000; // PORT B PULLUP's FOR (unused) SATELLITES
PORTD = 0b1100001; // PORT D PULLUP's FOR SWITCH & TEST
DDRB = 0b00000000; // Port B Input for satellites and feedback
DDRD = 0b0011001; // Port D Output for MUX and LED, Input for Switch & Test
PORTB = 0b11110000; // Port B Pullup's for (unused) satellites
PORTD = 0b1100001; // Port D Pullup's for Switch & Test, LED on
 
for (i=0;i<4;i++) active[i] = 0; // Reset active-array
 
if (!(PIND & (1<<PD5))) Testing(); // Initiate Self-Test when Test-Pad is low
if (!(PIND & (1<<PD6))) Binding(); // Initiate Binding when Bind-Button is pressed
if (!(PIND & (1<<PD5))) Testing(); // Initiate Self-Test when Test-Pad is low
 
TCCR1B = ( 1 << CS10 ); // Timer1 Prescaler = 1 -> 8,192 msec
TIMSK = ( 1 << TOIE1 ); // Timer1 Overflow Interrupt Enable
132,11 → 169,10
TimerEvent = 0;
}
}
 
LED_OFF;
 
ResetTimer();
while(1) // Check active satellites for 3 seconds
while(1) // Check active satellites for 5 seconds
{
if (TimerEvent == 20) LED_ON; // Blink (slower) while waiting...
if (TimerEvent == 40)
160,7 → 196,7
}
}
if (j == 9) break; // 9 * 40 * 8ms = ~3sec
if (j == 16) break; // 16 * 40 * 8ms = ~5sec
}
 
LED_OFF;
173,7 → 209,7
LED_ON;
_delay_ms(100);
LED_OFF;
_delay_ms(200);
_delay_ms(400);
}
}
 
182,16 → 218,15
 
while(1) // Main-Loop
{
for (i=0;i<4;i++) active[i] = 0; // Reset active-array
 
ResetTimer();
 
while((PINB & 0b11110000) == 0b11110000) // Wait for first signal (SYNC to frame)
{
if (TimerEvent > 3) break; // (max. 3*8=24ms)
}
for (i=0;i<4;i++) active[i] = 0; // Reset active-array
ResetTimer();
 
while(TimerEvent < 1) // Check active satellites (for 1*8=8ms)
{
 
204,10 → 239,9
}
}
 
 
if (active[sat] == 0) // Detect fail on active satellite
{
LED_ON; // Failure-LED ON (never goes off again)
LED_ON; // Failure-LED ON
for (i=0;i<4;i++) // Select lowest active satellite
{
if (active[i] == 1)
219,8 → 253,7
}
}
 
 
if (!(PIND & (1<<PD6))) LED_OFF; // Reset Failure-LED when Bind-Button is pressed
}
 
}
 
/Spektrum-Diversity/Software/Hex-Files/fuses.txt
New file
0,0 → 1,10
Fuse-Bits:
----------
Hi 0xDD
Low 0xD4
Ext 0xFF
 
Programming Examples:
---------------------
avrdude -p t2313 -P COM1 -c ponyser -U lfuse:w:0xD4:m -U hfuse:w:0xDD:m -U efuse:w:0xFF:m -U flash:w:diversity.hex
avrdude -p t2313 -P COM1 -c avr910 -b 115200 -U lfuse:w:0xD4:m -U hfuse:w:0xDD:m -U efuse:w:0xFF:m -U flash:w:diversity.hex
/Spektrum-Diversity/Software/Hex-Files/diversity.hex
New file
0,0 → 1,64
:1000000012C02AC029C028C027C027C025C024C0CC
:1000100023C022C021C020C01FC01EC01DC01CC0E4
:100020001BC01AC019C011241FBECFEDCDBF10E0F8
:10003000A0E6B0E0EAEEF3E002C005900D92A03633
:10004000B107D9F710E0A0E6B0E001C01D92A236DA
:10005000B107E1F7C6D0C7C1D3CF1F920F920FB639
:100060000F9211248F939F93809160009091610073
:10007000019690936100809360009F918F910F9003
:100080000FBE0F901F90189592B3880F880F880F9E
:100090009170982B92BB08951DBC1CBC10926100FE
:1000A00010926000089580EF87BB20E233E068EC97
:1000B00070E048EC50E0CB010197F1F7215030405F
:1000C000C1F718BACA010197F1F780EF88BBFA01AE
:1000D0003197F1F718BAFA013197F1F788BBFA01B5
:1000E0003197F1F718BAFA013197F1F788BBCA01D5
:1000F0000197F1F780E197E228EC30E0F9013197C0
:10010000F1F70197D9F717BA089580EF87BB80E51B
:1001100088BB82B3817082BB26B32695269526952F
:100120002095217082B38170886082BBB3992F5F64
:1001300082B38170806182BBB39B2F5F82B3817079
:10014000886182BBB3992F5F80EA88BB82B38170DC
:1001500082BBB3992F5F82B38170886082BBB39BEF
:100160002F5F82B38170806182BBB3992F5F82B3AE
:100170008170886182BBB39B2F5F17BA48EC50E057
:10018000222399F428EC30E0909888EE93E0F9016E
:100190003197F1F70197D9F7909A88E293E2F90144
:1001A0003197F1F70197D9F7EFCF30E0909888EECB
:1001B00093E0FA013197F1F70197D9F7909A80EA25
:1001C0009FE0FA013197F1F70197D9F73F5F3217B6
:1001D00068F380E197E2FA013197F1F70197D9F7D7
:1001E000CFCF0F931F93DF93CF9300D000D0CDB725
:1001F000DEB717BA89E181BB80EF88BB81E682BB9D
:1002000019821A821B821C82859B7FDF869B4BDFB3
:1002100081E08EBD80E889BF78941DBC1CBC0EC0F7
:1002200080916000909161000A9709F49098809104
:10023000600090916100449729F4909A10926100B7
:100240001092600086B3807F803F51F3909A1DBC6E
:100250001CBC109261001092600060E074E0DE014E
:10026000119611E08091600090916100449709F42B
:1002700090988091600090916100889731F4909AF5
:1002800010926100109260006F5F40E050E086B312
:1002900090E04C5F5F4F042E02C0959587950A94BD
:1002A000E2F74450504080FD11C0FD01E40FF51FFE
:1002B0001083743059F482B39A0173E0220F331F14
:1002C0007A95E1F78170822B82BB742F4F5F5F4F6D
:1002D00044305105E1F6603129F6909A80E197E2C9
:1002E00028EC30E0F9013197F1F70197D9F78E0149
:1002F0000F5F1F4FD80128EC30E0AE014B5F5F4F1E
:100300008C91813081F4909888EE93E0F9013197D7
:10031000F1F70197D9F7909A80EA9FE0F9013197B8
:10032000F1F70197D9F71196A417B50749F761E0DE
:10033000DE01119619821A821B821C821DBC1CBC14
:10034000109261001092600006C080916000909150
:100350006100049720F486B3807F803FB1F31DBC19
:100360001CBC109261001092600013C0F80124E0E0
:1003700030E086B390E0022E02C0959587950A94EE
:10038000E2F780FF60832F5F3F4F319628303105C1
:1003900081F78091600090916100892B39F3FD0114
:1003A000E70FF11D80818823D1F4909840E050E060
:1003B000FD01E40FF51F8081813061F482B39A0161
:1003C00093E0220F331F9A95E1F78170822B82BB55
:1003D000742F05C04F5F5F4F4430510549F7869930
:0A03E000A9CF909AA7CFF894FFCFA1
:00000001FF
/Spektrum-Diversity/Hardware/bestellen.txt
File deleted
/Spektrum-Diversity/Hardware/fuses.txt
File deleted
/Spektrum-Diversity/Hardware/bottom.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Spektrum-Diversity/Hardware/diversity.brd
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Spektrum-Diversity/Hardware/diversity.sch
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Spektrum-Diversity/Hardware/partlist.txt
New file
0,0 → 1,26
Qty. Part Value Case Link
========================================================================================================================================================
 
1x R1 330 0805 http://www.reichelt.de/?ACTION=3;ARTICLE=32880;PROVID=2402
http://de.farnell.com/vishay-draloric/crcw0805330rfkea/widerstand-0805-330r-1/dp/1469918
 
2x C1,C2 1µF 0805 http://www.reichelt.de/?ACTION=3;ARTICLE=89729;PROVID=2402
http://de.farnell.com/multicomp/mcca000543/mlcc-08055v-16v-1uf/dp/1759422
 
2x C3,C4 100nF 0805 http://www.reichelt.de/?ACTION=3;ARTICLE=31879;PROVID=2402
http://de.farnell.com/multicomp/mcca000387/mlcc-08055v-50v-100nf/dp/1759266
 
1x LED1 red 0805 http://www.reichelt.de/?ACTION=3;ARTICLE=31437;PROVID=2402
http://de.farnell.com/kingbright/kp-2012ec/led-smd-0805-rot/dp/8529949
 
1x IC1 MCP1826S-3002E/DB SOT-223 http://de.farnell.com/microchip/mcp1826s-3002e-db/ldo-3-0v-1a-sot-223-3/dp/1578422
 
1x IC2 ATtiny2313-20SU SO20W http://www.reichelt.de/?ACTION=3;ARTICLE=54968;PROVID=2402
http://de.farnell.com/atmel/attiny2313-20su/8bit-2k-flash-mcu-2313-soic20/dp/9171606
 
1x IC3 74HC151D SO16 http://www.reichelt.de/?ACTION=3;ARTICLE=18642;PROVID=2402
http://de.farnell.com/texas-instruments/sn74hc151d/logik-8-to-1-datenwahl-mux-16soic/dp/1740181
 
5x S0-S4 JST S3B-ZR RM1.5 http://de.farnell.com/jst-japan-solderless-terminals/s3b-zr-lf-sn/stiftleiste-horizontal-3pol/dp/9491821
 
1x BIND Tyco FSM2JSMA 6x6mm http://de.farnell.com/tyco-electronics-alcoswitch/fsm2jsma/taster-mikro-fsm2jsma-h-4-3mm-smd/dp/3801287
/Spektrum-Diversity/Hardware/schematic.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Spektrum-Diversity/Hardware/top.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream