add opdracht 1.6
This commit is contained in:
@@ -5,7 +5,9 @@ VisualStudioVersion = 14.0.23107.0
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "Microcontrollers", "Microcontrollers\Microcontrollers.cproj", "{2285C48D-296E-43FD-A7B6-69885F64CFFD}"
|
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "Microcontrollers", "Microcontrollers\Microcontrollers.cproj", "{2285C48D-296E-43FD-A7B6-69885F64CFFD}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.7a", "opdracht 2.7a\opdracht 2.7a.cproj", "{B7ED8D27-9387-4A45-A238-923F89602FB5}"
|
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 1.7a", "opdracht 2.7a\opdracht 1.7a.cproj", "{B7ED8D27-9387-4A45-A238-923F89602FB5}"
|
||||||
|
EndProject
|
||||||
|
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 1.6", "opdracht 1.6\opdracht 1.6.cproj", "{2C44E92F-6D48-45BD-810A-AD501EC081FE}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -21,6 +23,10 @@ Global
|
|||||||
{B7ED8D27-9387-4A45-A238-923F89602FB5}.Debug|AVR.Build.0 = Debug|AVR
|
{B7ED8D27-9387-4A45-A238-923F89602FB5}.Debug|AVR.Build.0 = Debug|AVR
|
||||||
{B7ED8D27-9387-4A45-A238-923F89602FB5}.Release|AVR.ActiveCfg = Release|AVR
|
{B7ED8D27-9387-4A45-A238-923F89602FB5}.Release|AVR.ActiveCfg = Release|AVR
|
||||||
{B7ED8D27-9387-4A45-A238-923F89602FB5}.Release|AVR.Build.0 = Release|AVR
|
{B7ED8D27-9387-4A45-A238-923F89602FB5}.Release|AVR.Build.0 = Release|AVR
|
||||||
|
{2C44E92F-6D48-45BD-810A-AD501EC081FE}.Debug|AVR.ActiveCfg = Debug|AVR
|
||||||
|
{2C44E92F-6D48-45BD-810A-AD501EC081FE}.Debug|AVR.Build.0 = Debug|AVR
|
||||||
|
{2C44E92F-6D48-45BD-810A-AD501EC081FE}.Release|AVR.ActiveCfg = Release|AVR
|
||||||
|
{2C44E92F-6D48-45BD-810A-AD501EC081FE}.Release|AVR.Build.0 = Release|AVR
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
104
Microcontrollers/opdracht 1.6/main.c
Normal file
104
Microcontrollers/opdracht 1.6/main.c
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
* main.c
|
||||||
|
*
|
||||||
|
* Created: 03-Feb-21 9:17:12 AM
|
||||||
|
* Author: lemms
|
||||||
|
*/
|
||||||
|
# define F_CPU 10000000UL
|
||||||
|
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
false = 0,
|
||||||
|
true = 1
|
||||||
|
} bool;
|
||||||
|
|
||||||
|
/******************************************************************/
|
||||||
|
void wait( int ms )
|
||||||
|
/*
|
||||||
|
short: Busy wait number of milliseconds
|
||||||
|
inputs: int ms (Number of milliseconds to busy wait)
|
||||||
|
outputs:
|
||||||
|
notes: Busy wait, not very accurate. Make sure (external)
|
||||||
|
clock value is set. This is used by _delay_ms inside
|
||||||
|
util/delay.h
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
{
|
||||||
|
for (int i=0; i<ms; i++)
|
||||||
|
{
|
||||||
|
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sbi(int REG, int index){
|
||||||
|
REG |= (1<<index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbi(int REG, int index){
|
||||||
|
REG &= ~(1<<index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int tbi(int REG, int index){
|
||||||
|
REG ^= (1<<index);
|
||||||
|
return REG;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkButton(){
|
||||||
|
return (PINC & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkButtonToggle(bool pressed){
|
||||||
|
return (checkButton() == true) && (pressed == false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************/
|
||||||
|
int main( void )
|
||||||
|
/*
|
||||||
|
short: main() loop, entry point of executable
|
||||||
|
inputs:
|
||||||
|
outputs:
|
||||||
|
notes: Looping forever, flipping bits on PORTD
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
{
|
||||||
|
bool pressed = checkButton();
|
||||||
|
bool state = false;
|
||||||
|
int ms = 0;
|
||||||
|
int button = 0;
|
||||||
|
int setTime = 1000;
|
||||||
|
DDRD = 0b11111111; // All pins PORTD are set to output
|
||||||
|
DDRC = 0b00000000; // set pint input
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(checkButtonToggle(pressed)){
|
||||||
|
pressed = checkButton();
|
||||||
|
state = !state;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pressed && !checkButton()){
|
||||||
|
pressed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(state){
|
||||||
|
setTime = 250;
|
||||||
|
} else {
|
||||||
|
setTime = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ms >= setTime){
|
||||||
|
PORTD = tbi(PORTD, 0);
|
||||||
|
ms = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
wait(1);
|
||||||
|
|
||||||
|
ms++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectVersion>7.0</ProjectVersion>
|
<ProjectVersion>7.0</ProjectVersion>
|
||||||
<ToolchainName>com.microchip.xc8</ToolchainName>
|
<ToolchainName>com.microchip.xc8</ToolchainName>
|
||||||
<ProjectGuid>{b7ed8d27-9387-4a45-a238-923f89602fb5}</ProjectGuid>
|
<ProjectGuid>{2c44e92f-6d48-45bd-810a-ad501ec081fe}</ProjectGuid>
|
||||||
<avrdevice>ATmega128</avrdevice>
|
<avrdevice>ATmega128</avrdevice>
|
||||||
<avrdeviceseries>none</avrdeviceseries>
|
<avrdeviceseries>none</avrdeviceseries>
|
||||||
<OutputType>Executable</OutputType>
|
<OutputType>Executable</OutputType>
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
||||||
<OutputFileExtension>.elf</OutputFileExtension>
|
<OutputFileExtension>.elf</OutputFileExtension>
|
||||||
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||||
<AssemblyName>opdracht 2.7a</AssemblyName>
|
<AssemblyName>opdracht 1.6</AssemblyName>
|
||||||
<Name>opdracht 2.7a</Name>
|
<Name>opdracht 1.6</Name>
|
||||||
<RootNamespace>opdracht 2.7a</RootNamespace>
|
<RootNamespace>opdracht 1.6</RootNamespace>
|
||||||
<ToolchainFlavour>XC8_2.31</ToolchainFlavour>
|
<ToolchainFlavour>XC8_2.31</ToolchainFlavour>
|
||||||
<KeepTimersRunning>true</KeepTimersRunning>
|
<KeepTimersRunning>true</KeepTimersRunning>
|
||||||
<OverrideVtor>false</OverrideVtor>
|
<OverrideVtor>false</OverrideVtor>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?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.6.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.6.364\xc8\avr\include\avr\iom128.h</AbsolutePath>
|
||||||
|
<Attribute></Attribute>
|
||||||
|
<Category>header</Category>
|
||||||
|
<Condition>XC</Condition>
|
||||||
|
<FileContentHash>JdJ7J9I/SJh965SEyyyVYw==</FileContentHash>
|
||||||
|
<FileVersion></FileVersion>
|
||||||
|
<Name>xc8/avr/include/avr/iom128.h</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.6.364/Atmel.ATmega_DFP.pdsc</PackPath>
|
||||||
|
<PackVersion>1.6.364</PackVersion>
|
||||||
|
<PresentInProject>true</PresentInProject>
|
||||||
|
<ReferenceConditionId>ATmega128</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>
|
||||||
99
Microcontrollers/opdracht 2.7a/opdracht 1.7a.cproj
Normal file
99
Microcontrollers/opdracht 2.7a/opdracht 1.7a.cproj
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectVersion>7.0</ProjectVersion>
|
||||||
|
<ToolchainName>com.microchip.xc8</ToolchainName>
|
||||||
|
<ProjectGuid>{b7ed8d27-9387-4a45-a238-923f89602fb5}</ProjectGuid>
|
||||||
|
<avrdevice>ATmega128</avrdevice>
|
||||||
|
<avrdeviceseries>none</avrdeviceseries>
|
||||||
|
<OutputType>Executable</OutputType>
|
||||||
|
<Language>C</Language>
|
||||||
|
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
||||||
|
<OutputFileExtension>.elf</OutputFileExtension>
|
||||||
|
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||||
|
<AssemblyName>opdracht 2.7a</AssemblyName>
|
||||||
|
<Name>opdracht 1.7a</Name>
|
||||||
|
<RootNamespace>opdracht 2.7a</RootNamespace>
|
||||||
|
<ToolchainFlavour>XC8_2.31</ToolchainFlavour>
|
||||||
|
<KeepTimersRunning>true</KeepTimersRunning>
|
||||||
|
<OverrideVtor>false</OverrideVtor>
|
||||||
|
<CacheFlash>true</CacheFlash>
|
||||||
|
<ProgFlashFromRam>true</ProgFlashFromRam>
|
||||||
|
<RamSnippetAddress />
|
||||||
|
<UncachedRange />
|
||||||
|
<preserveEEPROM>true</preserveEEPROM>
|
||||||
|
<OverrideVtorValue />
|
||||||
|
<BootSegment>2</BootSegment>
|
||||||
|
<ResetRule>0</ResetRule>
|
||||||
|
<eraseonlaunchrule>0</eraseonlaunchrule>
|
||||||
|
<EraseKey />
|
||||||
|
<AsfFrameworkConfig>
|
||||||
|
<framework-data xmlns="">
|
||||||
|
<options />
|
||||||
|
<configurations />
|
||||||
|
<files />
|
||||||
|
<documentation help="" />
|
||||||
|
<offline-documentation help="" />
|
||||||
|
<dependencies>
|
||||||
|
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.49.1" />
|
||||||
|
</dependencies>
|
||||||
|
</framework-data>
|
||||||
|
</AsfFrameworkConfig>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
|
<ToolchainSettings>
|
||||||
|
<com.microchip.xc8>
|
||||||
|
<com.microchip.xc8.common.optimization.RelaxBranches>True</com.microchip.xc8.common.optimization.RelaxBranches>
|
||||||
|
<com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||||
|
<com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||||
|
<com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||||
|
<ListValues>
|
||||||
|
<Value>(%24DeviceMacro)</Value>
|
||||||
|
<Value>NDEBUG</Value>
|
||||||
|
</ListValues>
|
||||||
|
</com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||||
|
<com.microchip.xc8.compiler.optimization.level>Optimize for size (-Os)</com.microchip.xc8.compiler.optimization.level>
|
||||||
|
<com.microchip.xc8.compiler.optimization.PackStructureMembers>True</com.microchip.xc8.compiler.optimization.PackStructureMembers>
|
||||||
|
<com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>True</com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>
|
||||||
|
<com.microchip.xc8.compiler.warnings.AllWarnings>True</com.microchip.xc8.compiler.warnings.AllWarnings>
|
||||||
|
<com.microchip.xc8.linker.libraries.Libraries>
|
||||||
|
<ListValues>
|
||||||
|
<Value>libm</Value>
|
||||||
|
</ListValues>
|
||||||
|
</com.microchip.xc8.linker.libraries.Libraries>
|
||||||
|
</com.microchip.xc8>
|
||||||
|
</ToolchainSettings>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<ToolchainSettings>
|
||||||
|
<com.microchip.xc8>
|
||||||
|
<com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||||
|
<com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||||
|
<com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||||
|
<ListValues>
|
||||||
|
<Value>(%24DeviceMacro)</Value>
|
||||||
|
<Value>DEBUG</Value>
|
||||||
|
</ListValues>
|
||||||
|
</com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||||
|
<com.microchip.xc8.compiler.optimization.level>Optimize debugging experience (-Og)</com.microchip.xc8.compiler.optimization.level>
|
||||||
|
<com.microchip.xc8.compiler.optimization.PackStructureMembers>True</com.microchip.xc8.compiler.optimization.PackStructureMembers>
|
||||||
|
<com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>True</com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>
|
||||||
|
<com.microchip.xc8.compiler.optimization.DebugLevel>Default (-g2)</com.microchip.xc8.compiler.optimization.DebugLevel>
|
||||||
|
<com.microchip.xc8.compiler.warnings.AllWarnings>True</com.microchip.xc8.compiler.warnings.AllWarnings>
|
||||||
|
<com.microchip.xc8.linker.libraries.Libraries>
|
||||||
|
<ListValues>
|
||||||
|
<Value>libm</Value>
|
||||||
|
</ListValues>
|
||||||
|
</com.microchip.xc8.linker.libraries.Libraries>
|
||||||
|
<com.microchip.xc8.assembler.debugging.DebugLevel>Default (-Wa,-g)</com.microchip.xc8.assembler.debugging.DebugLevel>
|
||||||
|
</com.microchip.xc8>
|
||||||
|
</ToolchainSettings>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="main.c">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user