added opdracht 2.3 folder

This commit is contained in:
Sem van der Hoeven
2021-02-10 11:46:53 +01:00
parent 9e1445737d
commit 35ce5510a0
4 changed files with 122 additions and 4 deletions

View File

@@ -14,7 +14,10 @@ void wait( int ms ) {
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
/************************************************************************/
/* interrupt 1
walk the light 1 down */
/************************************************************************/
ISR( INT1_vect ) {
if (PORTC == 0b10000000)
{
@@ -26,6 +29,10 @@ ISR( INT1_vect ) {
}
/************************************************************************/
/* interrupt 2
walk the light 1 up */
/************************************************************************/
ISR( INT2_vect ) {
if (PORTC == 0b00000001)
{
@@ -47,13 +54,13 @@ int main(void)
EICRA |= 0x2C; // INT2 falling edge, INT1 rising edge
EIMSK |= 0x06; // Enable INT2 & INT1
PORTC = 0x01;
PORTC = 0x01; // init the first bit
sei();
sei(); // enable input mechanism
while (1)
{
wait(500);
}
}

View File

@@ -0,0 +1,38 @@
/*
* main.c
*
* Created: 2/10/2021 11:45:42 AM
* Author: Sem
*/
#include <xc.h>
#include <avr/io.h>
#include <util/delay.h>
void wait( int ms ) {
for (int i=0; i<ms; i++) {
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
const unsigned char Numbers [10] = {
// dPgfe dcba
0b 0011 1111, // 0
0b 0000 0110, // 1
0b 0101 1011, // 2
0b 0100 1111, // 3
0b 0110 0110, // 4
0b 0110 1101, // 5
0b 0111 1101, // 6
0b 0000 0111, // 7
0b 0111 1111, // 8
0b 0110 1111, // 9
};
int main(void)
{
while(1)
{
//TODO:: Please write your application code
}
}

View File

@@ -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>

View File

@@ -0,0 +1,31 @@
<?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>2285C48D-296E-43FD-A7B6-69885F64CFFD</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.3</AssemblyName>
<Name>opdracht 2.3</Name>
<RootNamespace>opdracht 2.3</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings />
</PropertyGroup>
<ItemGroup>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>