1
0
Fork 0

Additions from 17/12/2021: Speculation ? Interruption not working so going backward ?

This commit is contained in:
Yohan Boujon 2022-04-05 20:34:09 +02:00
parent 8730b36933
commit 2b1327994c
7 changed files with 120 additions and 120 deletions

View file

@ -179,7 +179,6 @@ defined( __AVR_ATtiny85__ )
(0<<USITC); \
USISR = (0<<USI_START_COND_INT)|(1<<USIOIF)|(1<<USIPF)|(1<<USIDC)| /* Clear all flags, except Start Cond */ \
(0x0<<USICNT0); \
ADCSRA |= (1<<ADEN)|(1<<ADIE)|(1<<ADSC); \
}

View file

@ -9,57 +9,57 @@
<CSub></CSub>
<CVariant></CVariant>
<CVendor>Atmel</CVendor>
<CVersion>1.8.0</CVersion>
<DefaultRepoPath>D:/Programs\Atmelstudio\7.0\Packs</DefaultRepoPath>
<CVersion>1.2.0</CVersion>
<DefaultRepoPath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs</DefaultRepoPath>
<DependentComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
<Description></Description>
<Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Programs\Atmelstudio\7.0\Packs\atmel\ATtiny_DFP\1.8.332\include\</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.2.118\include</AbsolutePath>
<Attribute></Attribute>
<Category>include</Category>
<Condition>C</Condition>
<FileContentHash i:nil="true" />
<FileVersion></FileVersion>
<Name>include/</Name>
<Name>include</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Programs\Atmelstudio\7.0\Packs\atmel\ATtiny_DFP\1.8.332\include\avr\iotn85.h</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.2.118\include\avr\iotn85.h</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>C</Condition>
<FileContentHash>T0lnJZ6iliUJCzU7ZHCMPQ==</FileContentHash>
<FileContentHash>RcYmivGpgsCGGCzeWAIjcA==</FileContentHash>
<FileVersion></FileVersion>
<Name>include/avr/iotn85.h</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Programs\Atmelstudio\7.0\Packs\atmel\ATtiny_DFP\1.8.332\templates\main.c</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.2.118\templates\main.c</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>KjvOcFWd++tbnsEMfVPd/w==</FileContentHash>
<FileContentHash>GD1k8YYhulqRs6FD1B2Hog==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/main.c</Name>
<SelectString>Main file (.c)</SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Programs\Atmelstudio\7.0\Packs\atmel\ATtiny_DFP\1.8.332\templates\main.cpp</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.2.118\templates\main.cpp</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>mkKaE95TOoATsuBGv6jmxg==</FileContentHash>
<FileContentHash>YXFphlh0CtZJU+ebktABgQ==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/main.cpp</Name>
<SelectString>Main file (.cpp)</SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Programs\Atmelstudio\7.0\Packs\atmel\ATtiny_DFP\1.8.332\gcc\dev\attiny85</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.2.118\gcc\dev\attiny85</AbsolutePath>
<Attribute></Attribute>
<Category>libraryPrefix</Category>
<Condition>GCC</Condition>
@ -71,8 +71,8 @@
</d4p1:anyType>
</Files>
<PackName>ATtiny_DFP</PackName>
<PackPath>D:/Programs/Atmelstudio/7.0/Packs/atmel/ATtiny_DFP/1.8.332/Atmel.ATtiny_DFP.pdsc</PackPath>
<PackVersion>1.8.332</PackVersion>
<PackPath>C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.2.118/Atmel.ATtiny_DFP.pdsc</PackPath>
<PackVersion>1.2.118</PackVersion>
<PresentInProject>true</PresentInProject>
<ReferenceConditionId>ATtiny85</ReferenceConditionId>
<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">

View file

@ -34,17 +34,17 @@
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.42.0" />
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.25.0" />
</dependencies>
</framework-data>
</framework-data>
</AsfFrameworkConfig>
<avrtool>com.atmel.avrdbg.tool.simulator</avrtool>
<avrtool>com.atmel.avrdbg.tool.stk500</avrtool>
<avrtoolserialnumber />
<avrdeviceexpectedsignature>0x1E930B</avrdeviceexpectedsignature>
<com_atmel_avrdbg_tool_stk500>
<ToolOptions>
<InterfaceProperties>
<IspClock>0</IspClock>
<IspClock>125000</IspClock>
</InterfaceProperties>
<InterfaceName>ISP</InterfaceName>
</ToolOptions>
@ -54,7 +54,7 @@
<ToolName>STK500</ToolName>
</com_atmel_avrdbg_tool_stk500>
<avrtoolinterface>ISP</avrtoolinterface>
<avrtoolinterfaceclock>0</avrtoolinterfaceclock>
<avrtoolinterfaceclock>125000</avrtoolinterfaceclock>
<ResetRule>0</ResetRule>
<EraseKey />
<com_atmel_avrdbg_tool_simulator>
@ -72,7 +72,7 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=attiny85 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.8.332\gcc\dev\attiny85"</avrgcc.common.Device>
<avrgcc.common.Device>-mmcu=attiny85 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.2.118\gcc\dev\attiny85"</avrgcc.common.Device>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
@ -87,7 +87,7 @@
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.8.332\include\</Value>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.2.118\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
@ -101,16 +101,16 @@
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.8.332\include\</Value>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.2.118\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=attiny85 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.8.332\gcc\dev\attiny85"</avrgcc.common.Device>
<avrgcc.common.Device>-mmcu=attiny85 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.2.118\gcc\dev\attiny85"</avrgcc.common.Device>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
@ -125,7 +125,7 @@
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.8.332\include\</Value>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.2.118\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
@ -140,11 +140,11 @@
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.8.332\include\</Value>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.2.118\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</AvrGcc>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
@ -160,12 +160,6 @@
<Compile Include="led_receptor.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="led_test.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="led_test.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>

View file

@ -10,7 +10,7 @@
void led1_init(void)
{
DDRB |= (1<<PB1);
TCCR1|=(1<<CTC1)|(1<<COM1A0); //on active le mode CTC en comparant OCR1C, COM1A1 ? 1 pour desactiver /OC1A
TCCR1|=(1<<CTC1)|(1<<COM1A0); //on active le mode CTC en comparant OCR1C, COM1A0 : mode toggle
OCR1C=16; //d'apres retroingenieurie OCR1C=16
TCCR1|=(1<<CS10); //on active la clock avec CS10 = 1, pas de prediv (plus precis pour haute freq)
}
@ -18,8 +18,8 @@ void led1_init(void)
void led2_init(void)
{
DDRB |= (1<<PB4);
GTCCR|=(1<<COM1B0); //COM1B0 a 1 pour desactiver /OC1A
OCR1B=16; //d'apres retroingenieurie OCR1B=16
GTCCR|=(1<<COM1B0); //COM1B0 : mode toggle
OCR1C=16; //d'apres retroingenieurie OCR1C=16
TCCR1|=(1<<CS10); //on active la clock avec CS10 = 1, pas de prediv (plus precis pour haute freq)
}
@ -34,3 +34,9 @@ void led2_stop(void)
DDRB &= ~(1<<PB4);
GTCCR &= ~(1<<COM1B0);
}

View file

@ -45,22 +45,22 @@ float ADC_averaging(unsigned char val_ana)
float measureLed1(void)
{
float adcLed;
led1_init();
_delay_us(TIMING);
//led1_init();
//_delay_ms(TIMING);
adcLed=ADC_averaging(ADCH);
_delay_us(TIMING);
led1_stop();
//_delay_ms(TIMING);
//led1_stop();
return adcLed;
};
float measureLed2(void)
{
float adcLed;
led2_init();
_delay_us(TIMING);
//led2_init();
//_delay_ms(TIMING);
adcLed=ADC_averaging(ADCH);
_delay_us(TIMING);
led2_stop();
//_delay_ms(TIMING);
//led2_stop();
return adcLed;
};

View file

@ -11,7 +11,7 @@
#include "led_gen.h"
#include "USI_TWI_Slave.h"
#define F_CPU 8000000UL
#define F_CPU 8000000
#include <util/delay.h>
#include <avr/interrupt.h>
@ -21,7 +21,7 @@
#define NOTHING 0x54
#define ERROR 0xF0
#define VOLTMIN 1
#define TIMING 500
#define TIMING 100
void ADC_init(void);
void ADC_start_conversion(void);

View file

@ -16,7 +16,7 @@
#include "led_gen.h"
#include "led_receptor.h"
#include "USI_TWI_Slave.h"
//#define F_CPU 1000000
#define NOM_CONSTRUC 0x08
#define NOM_CAPTEUR 0x10
#define VALEUR_DEMAN 0x49
@ -27,11 +27,11 @@ volatile float adcled1;
volatile float adcled2;
volatile unsigned char recVal;
ISR (ADC_vect){//On récupère les données à chaque fin de conversion Analogique/Numérique
/*ISR (ADC_vect){
adcled1=measureLed1();
adcled2=measureLed2();
recVal=compareLed(adcled1,adcled2);
}
}*/
int main( void )
{
@ -39,11 +39,12 @@ int main( void )
unsigned char nom_capteur[8]= {'T','u','r','k','i','s','h','Z'};
unsigned char sensor_type[8]= {'C','a','t','c','h','E','y','e'};
slaveAdress = 0x01;
MCUCR |= (1<<PUD);
USI_TWI_Slave_Initialise(slaveAdress);
sei();
ADC_init();
ADC_start_conversion();
//ADC_init();
//ADC_start_conversion();
while(1)
{
@ -67,7 +68,7 @@ int main( void )
break;
case VALEUR_DEMAN :
USI_TWI_Transmit_Byte(recVal);
USI_TWI_Transmit_Byte(0x45/*recVal*/);
break;
case BASIC_MODE :