Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 778 → Rev 777

/Spektrum-Diversity/Software/Hex-Files/fuses.txt
File deleted
/Spektrum-Diversity/Software/Hex-Files/diversity.hex
File deleted
/Spektrum-Diversity/Software/diversity.c
1,31 → 1,26
// *************************************************************
// ** 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 **
// *************************************************************
// ************************************************************
// ** 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 **
// ************************************************************
 
#include <avr/io.h>
#include <avr/interrupt.h>
37,21 → 32,11
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;
60,7 → 45,6
}
 
 
 
void Binding(void) // Binding sequence for DX7
{
unsigned char i = 0;
81,63 → 65,42
}
 
 
 
void Testing(void) // Self Test
{
unsigned char i = 0;
unsigned char error = 0;
unsigned char i = 0;
 
DDRB = 0b11110000; // Port B Output for satellites, Input for feedback
DDRB = 0b11110000; // PORT B OUTPUT FOR SATELLITES, INPUT FOR FEEDBACK
PORTB = 0b00000000;
 
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++;
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 = 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 -> LED flashes at 1 Hz
if (error == 0) // When no error occured, flash around
{
LED_ON;
_delay_ms(100);
LED_OFF;
_delay_ms(900);
_delay_ms(100);
}
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;
145,15 → 108,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, LED on
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
 
for (i=0;i<4;i++) active[i] = 0; // Reset active-array
 
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
if (!(PIND & (1<<PD6))) Binding(); // Initiate Binding when Bind-Button is pressed
 
TCCR1B = ( 1 << CS10 ); // Timer1 Prescaler = 1 -> 8,192 msec
TIMSK = ( 1 << TOIE1 ); // Timer1 Overflow Interrupt Enable
169,10 → 132,11
TimerEvent = 0;
}
}
 
LED_OFF;
 
ResetTimer();
while(1) // Check active satellites for 5 seconds
while(1) // Check active satellites for 3 seconds
{
if (TimerEvent == 20) LED_ON; // Blink (slower) while waiting...
if (TimerEvent == 40)
196,7 → 160,7
}
}
if (j == 16) break; // 16 * 40 * 8ms = ~5sec
if (j == 9) break; // 9 * 40 * 8ms = ~3sec
}
 
LED_OFF;
209,7 → 173,7
LED_ON;
_delay_ms(100);
LED_OFF;
_delay_ms(400);
_delay_ms(200);
}
}
 
218,15 → 182,16
 
while(1) // Main-Loop
{
for (i=0;i<4;i++) active[i] = 0; // Reset active-array
ResetTimer();
 
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)
{
 
239,9 → 204,10
}
}
 
 
if (active[sat] == 0) // Detect fail on active satellite
{
LED_ON; // Failure-LED ON
LED_ON; // Failure-LED ON (never goes off again)
for (i=0;i<4;i++) // Select lowest active satellite
{
if (active[i] == 1)
253,7 → 219,8
}
}
 
if (!(PIND & (1<<PD6))) LED_OFF; // Reset Failure-LED when Bind-Button is pressed
 
}
 
}
 
/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="262 71 1328 776" LineCol="8 0" State="Maximized"/></Files></AVRWorkspace>
<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>
/Spektrum-Diversity/Hardware/partlist.txt
File deleted
/Spektrum-Diversity/Hardware/bestellen.txt
New file
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/diversity.sch
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Spektrum-Diversity/Hardware/fuses.txt
New file
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
/Spektrum-Diversity/Hardware/top.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/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