[add] opdradcht 2.5
This commit is contained in:
@@ -19,6 +19,8 @@ Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "Opdracht 2.2", "Opdracht 2.
|
||||
EndProject
|
||||
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.3", "opdracht 2.3\opdracht 2.3.cproj", "{9154C165-89AB-43CF-8C28-23147BC26FDC}"
|
||||
EndProject
|
||||
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.5", "opdracht 2.5\opdracht 2.5.cproj", "{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|AVR = Debug|AVR
|
||||
@@ -57,6 +59,10 @@ Global
|
||||
{9154C165-89AB-43CF-8C28-23147BC26FDC}.Debug|AVR.Build.0 = Debug|AVR
|
||||
{9154C165-89AB-43CF-8C28-23147BC26FDC}.Release|AVR.ActiveCfg = Release|AVR
|
||||
{9154C165-89AB-43CF-8C28-23147BC26FDC}.Release|AVR.Build.0 = Release|AVR
|
||||
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Debug|AVR.ActiveCfg = Debug|AVR
|
||||
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Debug|AVR.Build.0 = Debug|AVR
|
||||
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Release|AVR.ActiveCfg = Release|AVR
|
||||
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Release|AVR.Build.0 = Release|AVR
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -64,3 +64,42 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_strobe_lcd_e(void) {
|
||||
PORTC |= (1<<LCD_E); // E high
|
||||
_delay_ms(1);
|
||||
PORTC &= ~(1<<LCD_E); // E low
|
||||
}
|
||||
|
||||
void init_4bits_mode(void) {
|
||||
// PORTC output mode and all low (also E and RS pin)
|
||||
DDRC = 0xFF;
|
||||
PORTC = 0x00;
|
||||
|
||||
PORTC = 0x20; // (0x28 for 2 lines)
|
||||
lcd_strobe_lcd_e();
|
||||
}
|
||||
|
||||
void init_4bits_mode(void) {
|
||||
|
||||
// PORTC output mode and all low (also E and RS pin)
|
||||
DDRC = 0xFF;
|
||||
PORTC = 0x00;
|
||||
|
||||
PORTC = 0x20; // function for 4-bit 1 row
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
PORTC = 0x20; // function high nibble 4-bit 2 row
|
||||
lcd_strobe_lcd_e();
|
||||
PORTC = 0x80; // function low nibble 4-bit 2 row
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
PORTC = 0x00; // function high nibble turn on visible blinking-block cursor
|
||||
lcd_strobe_lcd_e();
|
||||
PORTC = 0xF0; // function low nibble turn on visible blinking-block cursor
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
PORTC = 0x00; // Entry mode set high nibble
|
||||
lcd_strobe_lcd_e();
|
||||
PORTC = 0x60; // Entry mode set low nibble
|
||||
lcd_strobe_lcd_e();
|
||||
}
|
||||
61
Microcontrollers/opdracht 2.5/main.c
Normal file
61
Microcontrollers/opdracht 2.5/main.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* main.c
|
||||
*
|
||||
* Created: 11-Feb-21 11:01:07 PM
|
||||
* Author: lemms
|
||||
*/
|
||||
|
||||
|
||||
#define F_CPU 8e6
|
||||
#include <xc.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#define LCD_E 3
|
||||
#define LCD_RS 2
|
||||
|
||||
void lcd_strobe_lcd_e(void);
|
||||
void init_4bits_mode(void);
|
||||
void lcd_write_string(char *str);
|
||||
void lcd_write_data(unsigned char byte);
|
||||
void lcd_write_cmd(unsigned char byte);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
//TODO:: Please write your application code
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_strobe_lcd_e(void) {
|
||||
PORTC |= (1<<LCD_E); // E high
|
||||
_delay_ms(1);
|
||||
PORTC &= ~(1<<LCD_E); // E low
|
||||
}
|
||||
|
||||
void init_4bits_mode(void) {
|
||||
|
||||
// PORTC output mode and all low (also E and RS pin)
|
||||
DDRC = 0xFF;
|
||||
PORTC = 0x00;
|
||||
|
||||
PORTC = 0x20; // function for 4-bit 1 row
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
PORTC = 0x20; // function high nibble 4-bit 2 row
|
||||
lcd_strobe_lcd_e();
|
||||
PORTC = 0x80; // function low nibble 4-bit 2 row
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
PORTC = 0x00; // function high nibble turn on visible blinking-block cursor
|
||||
lcd_strobe_lcd_e();
|
||||
PORTC = 0xF0; // function low nibble turn on visible blinking-block cursor
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
PORTC = 0x00; // Entry mode set high nibble
|
||||
lcd_strobe_lcd_e();
|
||||
PORTC = 0x60; // Entry mode set low nibble
|
||||
lcd_strobe_lcd_e();
|
||||
}
|
||||
42
Microcontrollers/opdracht 2.5/opdracht 2.5.componentinfo.xml
Normal file
42
Microcontrollers/opdracht 2.5/opdracht 2.5.componentinfo.xml
Normal 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>
|
||||
99
Microcontrollers/opdracht 2.5/opdracht 2.5.cproj
Normal file
99
Microcontrollers/opdracht 2.5/opdracht 2.5.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>{c81b68aa-f4bb-4a5d-81f8-2737dcd1d4a7}</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.5</AssemblyName>
|
||||
<Name>opdracht 2.5</Name>
|
||||
<RootNamespace>opdracht 2.5</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