1. bsaid
  2. Stabilita letadla

Commits

bsaid  committed bf4c4a1

RC 4 channels capture with PWM control.
Problem with usart external interrupt.

  • Participants
  • Parent commits 4095188
  • Branches default

Comments (0)

Files changed (10)

File firmware/YuniflyLibraries/RCcapture.hpp

View file
  • Ignore whitespace
+//include libraries
+#ifndef YuniflyRCcapture
+#define YuniflyRCcapture
+
+
+#define RCmotor 5
+#define RCservoL 4
+#define RCservoR 7
+#define RCswitch 0
+
+int RCrec[8] = {0,0,0,0,0,0,0,0};
+volatile int countTimer = 0;
+
+
+void initRCcapture()
+{
+	TIMSK |= (1<<TOIE1);
+
+	PORTE |= (1<<7) | (1<<4) | (1<<5);//pull-up on
+	PORTD |= (1<<0) | (1<<1);
+
+	// use pin to PE7; The rising edge between two samples of INT7 generates an interrupt request
+	EICRA = (1<<ISC01) | (1<<ISC00) | (1<<ISC11) | (1<<ISC10);
+	EICRB = (1<<ISC71) | (1<<ISC70) | (1<<ISC41) | (1<<ISC40) | (1<<ISC51) | (1<<ISC50);//set edge
+	EIMSK = (1<<INT7) | (1<<INT4) | (1<<INT5) | (1<<INT1) | (1<<INT0);//enable interrupts
+}
+
+
+ISR (INT0_vect)
+{ 
+    static int32_t time = 0;
+	static int32_t overflows = 0;
+
+	if(overflows == countTimer)
+		RCrec[0] = TCNT1 - time;
+
+	time = TCNT1;
+	overflows = countTimer;
+
+	if(EICRA & (1<<ISC00))
+		EICRA &= ~(1<<ISC00);
+	else
+		EICRA |= (1<<ISC00);
+}
+
+ISR (INT1_vect)
+{ 
+    static int32_t time = 0;
+	static int32_t overflows = 0;
+
+	if(overflows == countTimer)
+		RCrec[1] = TCNT1 - time;
+
+	time = TCNT1;
+	overflows = countTimer;
+
+	if(EICRA & (1<<ISC10))
+		EICRA &= ~(1<<ISC10);
+	else
+		EICRA |= (1<<ISC10);
+}
+
+ISR (INT4_vect)
+{ 
+    static int32_t time = 0;
+	static int32_t overflows = 0;
+
+	if(overflows == countTimer)
+		RCrec[4] = TCNT1 - time;
+
+	time = TCNT1;
+	overflows = countTimer;
+
+	if(EICRB & (1<<ISC40))
+		EICRB &= ~(1<<ISC40);
+	else
+		EICRB |= (1<<ISC40);
+}
+
+ISR (INT5_vect)
+{ 
+    static int32_t time = 0;
+	static int32_t overflows = 0;
+
+	if(overflows == countTimer)
+		RCrec[5] = TCNT1 - time;
+
+	time = TCNT1;
+	overflows = countTimer;
+
+	if(EICRB & (1<<ISC50))
+		EICRB &= ~(1<<ISC50);
+	else
+		EICRB |= (1<<ISC50);
+}
+
+ISR (INT7_vect)
+{ 
+    static int32_t time = 0;
+	static int32_t overflows = 0;
+
+	if(overflows == countTimer)
+		RCrec[7] = TCNT1 - time;
+
+	time = TCNT1;
+	overflows = countTimer;
+
+	if(EICRB & (1<<ISC70))
+		EICRB &= ~(1<<ISC70);
+	else
+		EICRB |= (1<<ISC70);
+}
+
+ISR (TIMER1_OVF_vect)
+{ 
+    countTimer++;
+}
+
+
+#endif

File firmware/YuniflyLibraries/fastPWM.hpp

View file
  • Ignore whitespace
 
 void initFastPWM(uint32_t overflowValue = 20000, int initValue = 0)
 {	
+	DDRB = 0xF7;	//todo: set correct values
+	PORTB = 0xF7;	//todo: define correct PWM pins
+	//DDRE = 0xFF;
+	//PORTE = 0xFF;
+	
 	ICR1 = overflowValue;
 	ICR3 = overflowValue;
 	
 	TCCR1A = (1<<CS11) | (1<<WGM11) | (1<<COM1A1) | (1<<COM1B1) | (1<<COM1C1);
 	TCCR1B = (1<<CS11) | (1<<WGM12) | (1<<WGM13);
 
-	TCCR3A = (1<<CS31) | (1<<WGM31) | (1<<COM3A1) | (1<<COM3B1) | (1<<COM3C1);
-	TCCR3B = (1<<CS31) | (1<<WGM32) | (1<<WGM33);
+	//todo: kolize s RC prijimacem, doresim podle finalniho zpusobu parsovani RC prijimace
+	//TCCR3A = (1<<CS31) | (1<<WGM31) | (1<<COM3A1) | (1<<COM3B1) | (1<<COM3C1);
+	//TCCR3B = (1<<CS31) | (1<<WGM32) | (1<<WGM33);
 
 	for(int i=0;i<6;i++)	//only 6 PWMs (constant)
 	{

File firmware/YuniflyLibraries/firmware.aps

View file
  • Ignore whitespace
-<AVRStudio><MANAGEMENT><ProjectName>firmware</ProjectName><Created>30-Sep-2011 18:15:16</Created><LastEdit>08-Oct-2011 22:06:36</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>30-Sep-2011 18:15:16</Created><Version>4</Version><Build>4, 15, 0, 623</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\firmware.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>D:\Beda\Aktualni data\Yunifly\Yunifly\YuniflyLibraries\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR Simulator</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>firmware.c</SOURCEFILE><OTHERFILE>default\firmware.lss</OTHERFILE><OTHERFILE>default\firmware.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega128</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>firmware.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS><OPTION><FILE>firmware.c</FILE><OPTIONLIST></OPTIONLIST></OPTION></OPTIONS><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2   -x c++  -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:\WinAVR-20100110\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20100110\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><ProjectFiles><Files><Name>D:\Beda\Aktualni data\Yunifly\Yunifly\YuniflyLibraries\firmware.c</Name></Files></ProjectFiles><IOView><usergroups/><sort sorted="0" column="0" ordername="1" orderaddress="1" ordergroup="1"/></IOView><Files><File00000><FileId>00000</FileId><FileName>firmware.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>uart.hpp</FileName><Status>1</Status></File00001><File00002><FileId>00002</FileId><FileName>accelerometer.hpp</FileName><Status>1</Status></File00002><File00003><FileId>00003</FileId><FileName>paralTransmitter.hpp</FileName><Status>1</Status></File00003><File00004><FileId>00004</FileId><FileName>fastPWM.hpp</FileName><Status>1</Status></File00004><File00005><FileId>00005</FileId><FileName>led.hpp</FileName><Status>1</Status></File00005></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
+<AVRStudio><MANAGEMENT><ProjectName>firmware</ProjectName><Created>30-Sep-2011 18:15:16</Created><LastEdit>29-Oct-2011 19:44:12</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>30-Sep-2011 18:15:16</Created><Version>4</Version><Build>4, 15, 0, 623</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\firmware.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>D:\Beda\Aktualni data\Yunifly\Yunifly\YuniflyLibraries\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR Simulator</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>firmware.c</SOURCEFILE><OTHERFILE>default\firmware.lss</OTHERFILE><OTHERFILE>default\firmware.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega128</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>firmware.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS><OPTION><FILE>firmware.c</FILE><OPTIONLIST></OPTIONLIST></OPTION></OPTIONS><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2   -x c++  -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:\WinAVR-20100110\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20100110\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><ProjectFiles><Files><Name>D:\Beda\Aktualni data\Yunifly\Yunifly\YuniflyLibraries\firmware.c</Name></Files></ProjectFiles><IOView><usergroups/><sort sorted="0" column="0" ordername="0" orderaddress="0" ordergroup="0"/></IOView><Files><File00000><FileId>00000</FileId><FileName>firmware.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>uart.hpp</FileName><Status>1</Status></File00001><File00002><FileId>00002</FileId><FileName>accelerometer.hpp</FileName><Status>1</Status></File00002><File00003><FileId>00003</FileId><FileName>paralTransmitter.hpp</FileName><Status>1</Status></File00003><File00004><FileId>00004</FileId><FileName>fastPWM.hpp</FileName><Status>1</Status></File00004><File00005><FileId>00005</FileId><FileName>led.hpp</FileName><Status>1</Status></File00005><File00006><FileId>00006</FileId><FileName>stabilization.hpp</FileName><Status>1</Status></File00006></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>

File firmware/YuniflyLibraries/firmware.aws

View file
  • Ignore whitespace
-<AVRWorkspace><IOSettings><CurrentRegisters><AD_CONVERTER><register register="ADC" group="AD_CONVERTER" display="1" locked="0"/></AD_CONVERTER><AD_CONVERTER><register register="ADCSRA" group="AD_CONVERTER" display="1" locked="0"/></AD_CONVERTER><AD_CONVERTER><register register="ADMUX" group="AD_CONVERTER" display="1" locked="0"/></AD_CONVERTER></CurrentRegisters></IOSettings><part name="ATMEGA128"/><Files><File00000 Name="D:\Beda\Aktualni data\Yunifly\Yunifly\YuniflyLibraries\firmware.c" Position="186 76 984 722" LineCol="62 0"/><File00001 Name="D:\Beda\Aktualni data\Yunifly\Yunifly\YuniflyLibraries\uart.hpp" Position="506 787 666 814" LineCol="0 0"/><File00002 Name="D:\Beda\Aktualni data\Yunifly\Yunifly\YuniflyLibraries\accelerometer.hpp" Position="281 179 1071 795" LineCol="7 0"/><File00003 Name="D:\Beda\Aktualni data\Yunifly\Yunifly\YuniflyLibraries\paralTransmitter.hpp" Position="330 167 1120 783" LineCol="18 0"/><File00004 Name="D:\Beda\Aktualni data\Yunifly\Yunifly\YuniflyLibraries\fastPWM.hpp" Position="346 787 506 814" LineCol="102 1"/><File00005 Name="D:\Beda\Aktualni data\Yunifly\Yunifly\YuniflyLibraries\led.hpp" Position="186 787 346 814" LineCol="0 0"/></Files></AVRWorkspace>
+<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA128"/><Files><File00000 Name="D:\Beda\Aktualni data\Yunifly\Yunifly\YuniflyLibraries\firmware.c" Position="176 44 1512 824" LineCol="38 0" State="Maximized"/></Files></AVRWorkspace>

File firmware/YuniflyLibraries/firmware.c

View file
  • Ignore whitespace
 #include "fastPWM.hpp"
 #include "accelerometer.hpp"
 #include "paralTransmitter.hpp"
+#include "RCcapture.hpp"
 
 #include "stabilization.hpp"
 
 
 void run()
 {
-	rs232.init(38400);
-	rs2321.init(115200);
+	initLEDs();
+	initFastPWMServo();
+	initRCcapture();
 
-	_delay_ms(10);
-	debug << endl << "ok..." << endl;
-	debug.wait();
-	
 	blink();
 
 	for(;;)
 	{
+		/*_delay_ms(100);
+		for(int j=0;j<8;j++)
+		{
+			debug.wait();
+			debug << (((RCrec[j]-500)>>3)-128) << " ";
+		}
+		debug.wait();
+		debug << endl;*/
+
+		_delay_ms(1);
+		setFastPWM(0, RCrec[RCservoL]);
+		setFastPWM(1, RCrec[RCservoR]);
+		setFastPWM(2, RCrec[RCmotor]);
+		debug << (((RCrec[RCmotor]-500)>>3)-128) << endl;
+		debug.wait();
 	}
-	//initLEDs();
-	//initFastPWM();
-	//firstAccCalibration();
-	//blink();
-	//testRangePWM();
-	//blink();
-
-	//BTRCinit();	//todo: uncomment or delete with declaration; set concurent access
-	//accInit();	//todo: uncomment or delete with declaration; set concurent access
-	/*int accPropConst = 200;
-	
-	for(;;)
-	{
-		//set constant for proporcional accelerometer driving
-		if(buttons[1])
-		{
-			accPropConst = RCchannels[3];
-		}
-		
-		for(int i=0;i<5;i++)	//todo: set asynchronic cycle for reading faster accelerometer uart line
-		{
-			while(!BTRCupdate());
-		}
-
-		//driving by accelerometers and transmitter (in user option)
-		wantAcc[2] = RCchannels[2]/8;	//motor
-		wantAcc[0] = -RCchannels[1]/8 + RCchannels[0]/8;	//servo0
-		wantAcc[1] = -RCchannels[1]/8 - RCchannels[0]/8;	//servo1
-		computeAcc[2] = 0;	//motor is not driven by accelerometer
-		computeAcc[0] = -accData[3]*accReverzCorrection[3]/accPropConst + accData[4]*accReverzCorrection[4]/accPropConst;	//accelerometer stabilization for servo0
-		computeAcc[1] = -accData[3]*accReverzCorrection[3]/accPropConst - accData[4]*accReverzCorrection[4]/accPropConst;	//accelerometer stabilization for servo1
-
-		for(int i=0;i<5;i++)	//todo: set asynchronic cycle for reading faster accelerometer uart line
-		{
-			while(!accUpdate());
-		}
-
-		for(int i=0;i<channels;i++)
-		{
-			if(drivenByAcc[i] && buttons[0])
-			{
-				setFastPWM( servosPosition[i], wantAcc[i] - computeAcc[i] );
-			}
-			else
-			{
-				setFastPWM( servosPosition[i], wantAcc[i] );
-			}
-		}
-
-		if(buttons[0])
-			clearLed();
-		else
-			setLed();
-
-		//toggleLed();
-	}*/
 }

File firmware/YuniflyLibraries/led.hpp

View file
  • Ignore whitespace
 #ifndef YuniflyLEDs
 #define YuniflyLEDs
 
+
 void initLEDs()
 {
-	DDRB = 0xF7;	//todo: set correct values
-	PORTB = 0xF7;	//todo: define LED ports externally
-	DDRE = 0xFF;
-	PORTE = 0xFF;
+	DDRD |= (1<<5);
+	PORTD |= (1<<5);
+	DDRE |= (1<<6);
+	PORTE |= (1<<6);
 }
 
 

File firmware/YuniflyLibraries/stabilization.hpp

View file
  • Ignore whitespace
 		position = 0;
 	}	
 
-	int limited(int value, int min = 0, int max = historyLength)
+	int limited(int value, int min = 0, int max = historyLength)	//todo: this function is incorrect
 	{
 		value -= min;
 		value = value % (max-min);
 	{
 		return history[limited(position-stepsAgo)][index];
 	}
+
+	int getDifference(int stepsAgo, int index)
+	{
+		return getValue(stepsAgo, index) - getValue(stepsAgo-1, index);
+	}
 };
 
 
 class Tstabilization
 {
 	TaccHistory history;
-	int lastDifference[accNumberOfChannels];
+	TaccHistory differences;
+
+	int gravity;
 
 public:
 
 	void calibration()
 	{
-		//todo
+		history.push( accData );
+		//todo: compute differences
 	}
 	
 	void update()
 	{
 		history.push(accData);	//todo: global accelerometers variables
-		for(int i=0;i<accNumberOfChannels;i++)
-		{
-			lastDifference[i] = history.getValue(0,i) - history.getValue(1,i);	//todo: maybe set to 1 and 2 steps ago
-		}
 	}
 };

File firmware/testy/testICP/help.cpp

View file
  • Ignore whitespace
 //DDRB��&=�0x00;��//make�port�d�bit�zero�input�mode
 //PORTB�|=�0xFF;��//turn�on�bit�0�pull�up
 //DDRD��|=�0x01;��//set�port�b�bit�0�to�output�mode
+
+
+
+
+
+
+//initLEDs();
+	//initFastPWM();
+	//firstAccCalibration();
+	//blink();
+	//testRangePWM();
+	//blink();
+
+	//BTRCinit();	//todo: uncomment or delete with declaration; set concurent access
+	//accInit();	//todo: uncomment or delete with declaration; set concurent access
+	/*int accPropConst = 200;
+	
+	for(;;)
+	{
+		//set constant for proporcional accelerometer driving
+		if(buttons[1])
+		{
+			accPropConst = RCchannels[3];
+		}
+		
+		for(int i=0;i<5;i++)	//todo: set asynchronic cycle for reading faster accelerometer uart line
+		{
+			while(!BTRCupdate());
+		}
+
+		//driving by accelerometers and transmitter (in user option)
+		wantAcc[2] = RCchannels[2]/8;	//motor
+		wantAcc[0] = -RCchannels[1]/8 + RCchannels[0]/8;	//servo0
+		wantAcc[1] = -RCchannels[1]/8 - RCchannels[0]/8;	//servo1
+		computeAcc[2] = 0;	//motor is not driven by accelerometer
+		computeAcc[0] = -accData[3]*accReverzCorrection[3]/accPropConst + accData[4]*accReverzCorrection[4]/accPropConst;	//accelerometer stabilization for servo0
+		computeAcc[1] = -accData[3]*accReverzCorrection[3]/accPropConst - accData[4]*accReverzCorrection[4]/accPropConst;	//accelerometer stabilization for servo1
+
+		for(int i=0;i<5;i++)	//todo: set asynchronic cycle for reading faster accelerometer uart line
+		{
+			while(!accUpdate());
+		}
+
+		for(int i=0;i<channels;i++)
+		{
+			if(drivenByAcc[i] && buttons[0])
+			{
+				setFastPWM( servosPosition[i], wantAcc[i] - computeAcc[i] );
+			}
+			else
+			{
+				setFastPWM( servosPosition[i], wantAcc[i] );
+			}
+		}
+
+		if(buttons[0])
+			clearLed();
+		else
+			setLed();
+
+		//toggleLed();
+	}*/

File firmware/testy/testICP/testICP.c

View file
  • Ignore whitespace
 
 	for(uint32_t i=0;;i++)
 	{
-		_delay_ms(10);
+		_delay_ms(100);
 		for(int j=0;j<8;j++)
 		{
-			debug << /*RCrec[j] << "     " <<*/ (((RCrec[j]-500)>>3)-128) << "   ";
+			debug.wait();
+			debug << /*RCrec[j] << "   " <<*/ (((RCrec[j]-500)>>3)-128) << " ";
 			debug.wait();
 		}
-		debug << "          " << "\r";
+		debug << "\n";
 		debug.wait();
-		//if(i%100==0) toggleLed();
 	}
 }
 
 { 
     countTimer++;
 }
-
-/*char buf[128];
-
-int main()
-{
-	rs232.init(38400);
-	sei();
-	debug<<endl<<endl<<" ok "<<endl;
-	debug.wait();
-
-	DDRB = 0x00;
-	PORTB = 0xFF;
-	DDRD = 0x01;
-	for(;;)
-	{
-		for(int i=0;i<128;i++)
-		{
-			buf[i] = PINB;
-			_delay_us(100);
-		}
-		for(int i=0;i<128;i++)
-		{
-			debug << (int)buf[i];
-			if(buf[i] == 255)
-				debug << "   blablabla";
-			debug << endl;
-			debug.wait();
-		}
-		debug << endl << endl;
-		debug.wait();
-	}
-}*/
-
-
-/*int timeCapture = 0;
-
-int main ()
-{
-	rs232.init(38400);
-	sei();
-	debug<<endl<<endl<<" ok "<<endl;
-	debug.wait();
-
-
-	// set use pin to PB7
-	EICRA |= (1<<PINB7);
-	//(nastavi preruseni INT3 na sestupnou hranu)
-
-	// interrupt on INT0 pin falling edge
-	MCUCR = (1<<ISC01) | (1<<ISC00);
-	//(tento radek nastesti nic neudela, protoze byty, ktere se snazis zapsat, jsou chranene proti nechtenemu prepsani; jinak by ti rozhodil cely system preruseni)
-
-	EIMSK  |= (1<<INT0);
-	(jediny vicemene spravny radek, opravdu povoli INT0)
-
-	for(;;)
-	{
-		debug << timeCapture << endl;
-		debug.wait();
-	}
-}
-
-SIGNAL (SIG_INT0)
-{ 
-    timeCapture++;
-}*/

File firmware/testy/testICP/testicp.aws

View file
  • Ignore whitespace
-<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA128"/><Files><File00000 Name="D:\Beda\Aktualni data\Yunifly\Yunifly\testy\testICP\testICP.c" Position="101 76 1210 699" LineCol="49 4"/></Files></AVRWorkspace>
+<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA128"/><Files><File00000 Name="D:\Beda\Aktualni data\Yunifly\Yunifly\testy\testICP\testICP.c" Position="223 130 1297 648" LineCol="50 2"/><File00001 Name="D:\Beda\Aktualni data\Yunifly\Yunifly\testy\testICP\fastPWM.hpp" Position="211 101 1302 614" LineCol="0 0"/><File00002 Name="D:\Beda\Aktualni data\Yunifly\Yunifly\testy\testICP\led.hpp" Position="236 159 1327 672" LineCol="24 1"/></Files></AVRWorkspace>