Added tp1
This commit is contained in:
commit
054bffbda9
9 changed files with 435 additions and 0 deletions
22
tp1/exo2.c
Executable file
22
tp1/exo2.c
Executable file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* tutoriel.c
|
||||
*
|
||||
* Created: 29/01/2021 09:13:18
|
||||
* Author : yboujon1
|
||||
*/
|
||||
|
||||
#include <avr/io.h> // necessaire pour l'acces au reg IO
|
||||
|
||||
unsigned char a,b,x,y,z;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
DDRB = 0xFF;
|
||||
x = 0x6E;
|
||||
y = 0xA5;
|
||||
z = ~((x & 0xF0) | (y & 0x0F));
|
||||
PORTB = ~z;
|
||||
|
||||
while (1) {
|
||||
}
|
||||
}
|
21
tp1/exo3.c
Executable file
21
tp1/exo3.c
Executable file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* tutoriel.c
|
||||
*
|
||||
* Created: 29/01/2021 09:13:18
|
||||
* Author : yboujon1
|
||||
*/
|
||||
|
||||
#include <avr/io.h> // necessaire pour l'acces au reg IO
|
||||
|
||||
unsigned char entree,sortie;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
DDRB = 0xFF; //sortie
|
||||
DDRA = 0x00; //entree
|
||||
while (1) {
|
||||
entree=PINA;
|
||||
sortie=entree;
|
||||
PORTB=sortie;
|
||||
}
|
||||
}
|
25
tp1/exo4.c
Executable file
25
tp1/exo4.c
Executable file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* tutoriel.c
|
||||
*
|
||||
* Created: 29/01/2021 09:13:18
|
||||
* Author : yboujon1
|
||||
*/
|
||||
|
||||
#include <avr/io.h> // necessaire pour l'acces au reg IO
|
||||
|
||||
int main(void)
|
||||
{
|
||||
DDRB = 0xFF; //sortie
|
||||
DDRA = 0x00; //entree
|
||||
while (1) {
|
||||
if(PINA==0xFF)
|
||||
{
|
||||
PORTB=0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
PORTB=0x00;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
25
tp1/exo5.c
Executable file
25
tp1/exo5.c
Executable file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* tutoriel.c
|
||||
*
|
||||
* Created: 29/01/2021 09:13:18
|
||||
* Author : yboujon1
|
||||
*/
|
||||
|
||||
#include <avr/io.h> // necessaire pour l'acces au reg IO
|
||||
|
||||
int main(void)
|
||||
{
|
||||
DDRB = 0xFF; //sortie
|
||||
DDRA = 0x00; //entree
|
||||
while (1) {
|
||||
if(PINA==0xF7) //on vérifie si le 3ème bouton est appuyé
|
||||
{
|
||||
PORTB=0x00; //les leds sont allumées
|
||||
}
|
||||
else
|
||||
{
|
||||
PORTB=0xFF; //les leds sont éteintes
|
||||
};
|
||||
}
|
||||
}
|
||||
|
28
tp1/exo6.c
Executable file
28
tp1/exo6.c
Executable file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* tutoriel.c
|
||||
*
|
||||
* Created: 29/01/2021 09:13:18
|
||||
* Author : yboujon1
|
||||
*/
|
||||
|
||||
#include <avr/io.h> // necessaire pour l'acces au reg IO
|
||||
unsigned char carry,temp;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
DDRB = 0xFF; //sortie
|
||||
DDRA = 0x00; //entree
|
||||
while (1)
|
||||
{
|
||||
if(PINA==0xF7)
|
||||
{
|
||||
carry=1;
|
||||
};
|
||||
if(carry==1 && PINA!=0xF7)
|
||||
{
|
||||
PORTB=~PORTB;
|
||||
carry=0;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
44
tp1/exo7.c
Executable file
44
tp1/exo7.c
Executable file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* tutoriel.c
|
||||
*
|
||||
* Created: 29/01/2021 09:13:18
|
||||
* Author : yboujon1
|
||||
*/
|
||||
|
||||
#include <avr/io.h> // necessaire pour l'acces au reg IO
|
||||
#define F_CPU 3686400 //nous specifions la fréquence du processeur
|
||||
#include <util/delay.h> //bibliotheque necessaire pour le delai en millisecondes
|
||||
#define V1R2 ~0x81 //on defini chaque pattern de leds donné dans le tp
|
||||
#define O1R2 ~0x41
|
||||
#define R1R2 ~0x21
|
||||
#define R1V2 ~0x24
|
||||
#define R1O2 ~0x22
|
||||
#define R1R2 ~0x21
|
||||
|
||||
void seconde(char x); //fonction qui fait attendre x secondes
|
||||
|
||||
int main(void)
|
||||
{
|
||||
DDRB = 0xFF; //sortie
|
||||
DDRA = 0x00; //entree
|
||||
char tabsec[6]= {2, 4, 2, 15, 4, 2}; //on defini chaque cycle en secondes
|
||||
char tabfeu[6]= {V1R2, O1R2, R1R2, R1V2, R1O2, R1R2}; //on defini le pattern de chaque led
|
||||
while (1)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<6;i++) //on repete 6 fois l'action en fonction des valeurs du tableau
|
||||
{
|
||||
PORTB=tabfeu[i]; //on affect un pattern en fonction de sa valeur dans le tableau
|
||||
seconde(tabsec[i]); //on attends x secondes en fonction de la durée du cycle défini dans le tableau
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
void seconde(char x)
|
||||
{
|
||||
int y;
|
||||
for(y=0;y<100*x+1;y++)
|
||||
{
|
||||
_delay_ms(10);
|
||||
}
|
||||
}
|
28
tp1/main.c
Executable file
28
tp1/main.c
Executable file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* tutoriel.c
|
||||
*
|
||||
* Created: 29/01/2021 09:13:18
|
||||
* Author : yboujon1
|
||||
*/
|
||||
|
||||
#include <avr/io.h> // necessaire pour l'acces au reg IO
|
||||
unsigned char carry,temp;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
DDRB = 0xFF; //sortie
|
||||
DDRA = 0x00; //entree
|
||||
while (1)
|
||||
{
|
||||
if((PINA & (1<<PA3)) == 0x00) // si PA3 appuyé
|
||||
{
|
||||
carry=1; //on défini à 1 une retenue
|
||||
};
|
||||
if((carry==1) && ((PINA & (1<<PA3)) != 0x00)) // si PA3 relaché après appui et que carry est à 1
|
||||
{
|
||||
PORTB=~PORTB; //on inverse la valeur de la led au PORTB
|
||||
carry=0; //nous la remettons à 0 pour ne pas changer les leds indéfiniment
|
||||
};
|
||||
};
|
||||
}
|
||||
|
86
tp1/tutoriel.componentinfo.xml
Executable file
86
tp1/tutoriel.componentinfo.xml
Executable file
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Store xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="AtmelPackComponentManagement">
|
||||
<ProjectComponents>
|
||||
<ProjectComponent z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
|
||||
<CApiVersion></CApiVersion>
|
||||
<CBundle></CBundle>
|
||||
<CClass>Device</CClass>
|
||||
<CGroup>Startup</CGroup>
|
||||
<CSub></CSub>
|
||||
<CVariant></CVariant>
|
||||
<CVendor>Atmel</CVendor>
|
||||
<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>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include</AbsolutePath>
|
||||
<Attribute></Attribute>
|
||||
<Category>include</Category>
|
||||
<Condition>C</Condition>
|
||||
<FileContentHash i:nil="true" />
|
||||
<FileVersion></FileVersion>
|
||||
<Name>include</Name>
|
||||
<SelectString></SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include\avr\iom16.h</AbsolutePath>
|
||||
<Attribute></Attribute>
|
||||
<Category>header</Category>
|
||||
<Condition>C</Condition>
|
||||
<FileContentHash>BDa+/Y5e630de26bwSjZpg==</FileContentHash>
|
||||
<FileVersion></FileVersion>
|
||||
<Name>include/avr/iom16.h</Name>
|
||||
<SelectString></SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\templates\main.c</AbsolutePath>
|
||||
<Attribute>template</Attribute>
|
||||
<Category>source</Category>
|
||||
<Condition>C Exe</Condition>
|
||||
<FileContentHash>H7ZbrvNuFnv6bp46igi5tg==</FileContentHash>
|
||||
<FileVersion></FileVersion>
|
||||
<Name>templates/main.c</Name>
|
||||
<SelectString>Main file (.c)</SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\templates\main.cpp</AbsolutePath>
|
||||
<Attribute>template</Attribute>
|
||||
<Category>source</Category>
|
||||
<Condition>C Exe</Condition>
|
||||
<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>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega16</AbsolutePath>
|
||||
<Attribute></Attribute>
|
||||
<Category>libraryPrefix</Category>
|
||||
<Condition>GCC</Condition>
|
||||
<FileContentHash i:nil="true" />
|
||||
<FileVersion></FileVersion>
|
||||
<Name>gcc/dev/atmega16</Name>
|
||||
<SelectString></SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
</Files>
|
||||
<PackName>ATmega_DFP</PackName>
|
||||
<PackPath>C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.132/Atmel.ATmega_DFP.pdsc</PackPath>
|
||||
<PackVersion>1.2.132</PackVersion>
|
||||
<PresentInProject>true</PresentInProject>
|
||||
<ReferenceConditionId>ATmega16</ReferenceConditionId>
|
||||
<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
||||
<d4p1:string></d4p1:string>
|
||||
</RteComponents>
|
||||
<Status>Resolved</Status>
|
||||
<VersionMode>Fixed</VersionMode>
|
||||
<IsComponentInAtProject>true</IsComponentInAtProject>
|
||||
</ProjectComponent>
|
||||
</ProjectComponents>
|
||||
</Store>
|
156
tp1/tutoriel.cproj
Executable file
156
tp1/tutoriel.cproj
Executable file
|
@ -0,0 +1,156 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>7.0</ProjectVersion>
|
||||
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
|
||||
<ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid>
|
||||
<avrdevice>ATmega16</avrdevice>
|
||||
<avrdeviceseries>none</avrdeviceseries>
|
||||
<OutputType>Executable</OutputType>
|
||||
<Language>C</Language>
|
||||
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
||||
<OutputFileExtension>.elf</OutputFileExtension>
|
||||
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||
<AssemblyName>tutoriel</AssemblyName>
|
||||
<Name>tutoriel</Name>
|
||||
<RootNamespace>tutoriel</RootNamespace>
|
||||
<ToolchainFlavour>Native</ToolchainFlavour>
|
||||
<KeepTimersRunning>true</KeepTimersRunning>
|
||||
<OverrideVtor>false</OverrideVtor>
|
||||
<CacheFlash>true</CacheFlash>
|
||||
<ProgFlashFromRam>true</ProgFlashFromRam>
|
||||
<RamSnippetAddress>0x20000000</RamSnippetAddress>
|
||||
<UncachedRange />
|
||||
<preserveEEPROM>true</preserveEEPROM>
|
||||
<OverrideVtorValue>exception_table</OverrideVtorValue>
|
||||
<BootSegment>2</BootSegment>
|
||||
<eraseonlaunchrule>0</eraseonlaunchrule>
|
||||
<AsfFrameworkConfig>
|
||||
<framework-data>
|
||||
<options />
|
||||
<configurations />
|
||||
<files />
|
||||
<documentation help="" />
|
||||
<offline-documentation help="" />
|
||||
<dependencies>
|
||||
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.42.0" />
|
||||
</dependencies>
|
||||
</framework-data>
|
||||
</AsfFrameworkConfig>
|
||||
<avrtool>com.atmel.avrdbg.tool.simulator</avrtool>
|
||||
<avrtoolserialnumber />
|
||||
<avrdeviceexpectedsignature>0x1E9403</avrdeviceexpectedsignature>
|
||||
<com_atmel_avrdbg_tool_simulator>
|
||||
<ToolOptions>
|
||||
<InterfaceProperties>
|
||||
</InterfaceProperties>
|
||||
<InterfaceName>ISP</InterfaceName>
|
||||
</ToolOptions>
|
||||
<ToolType>com.atmel.avrdbg.tool.simulator</ToolType>
|
||||
<ToolNumber>
|
||||
</ToolNumber>
|
||||
<ToolName>Simulator</ToolName>
|
||||
</com_atmel_avrdbg_tool_simulator>
|
||||
<avrtoolinterface>ISP</avrtoolinterface>
|
||||
<com_atmel_avrdbg_tool_stk500>
|
||||
<ToolOptions>
|
||||
<InterfaceProperties>
|
||||
<IspClock>0</IspClock>
|
||||
</InterfaceProperties>
|
||||
<InterfaceName>ISP</InterfaceName>
|
||||
</ToolOptions>
|
||||
<ToolType>com.atmel.avrdbg.tool.stk500</ToolType>
|
||||
<ToolNumber>
|
||||
</ToolNumber>
|
||||
<ToolName>STK500</ToolName>
|
||||
</com_atmel_avrdbg_tool_stk500>
|
||||
<avrtoolinterfaceclock>0</avrtoolinterfaceclock>
|
||||
<ResetRule>0</ResetRule>
|
||||
<EraseKey />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.Device>-mmcu=atmega16 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega16"</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>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>NDEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
<avrgcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value>
|
||||
</ListValues>
|
||||
</avrgcc.assembler.general.IncludePaths>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.Device>-mmcu=atmega16 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega16"</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>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>DEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
<avrgcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value>
|
||||
</ListValues>
|
||||
</avrgcc.assembler.general.IncludePaths>
|
||||
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="main.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||
</Project>
|
Loading…
Add table
Reference in a new issue