Depart avec chenillard3

This commit is contained in:
adri 2018-06-09 17:38:15 +02:00
commit d4d4c3a6a3
3 changed files with 228 additions and 0 deletions

74
ASM18b20AvecLCD.asmproj Normal file
View File

@ -0,0 +1,74 @@
<?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.AVRAssembler</ToolchainName>
<ProjectGuid>59B1D629-9DCC-43ed-A0FD-8AB0E4D622AB</ProjectGuid>
<avrdeviceseries>none</avrdeviceseries>
<avrdevice>ATmega328P</avrdevice>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.obj</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<Language>ASSEMBLY</Language>
<AssemblyName>ASM18b20AvecLCD</AssemblyName>
<Name>ASM18b20AvecLCD</Name>
<RootNamespace>ASM18b20AvecLCD</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<EntryFile>$(MSBuildProjectDirectory)\main.asm</EntryFile>
<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.35.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrAssembler>
<avrasm.assembler.general.AdditionalIncludeDirectories>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.150\avrasm\inc</Value>
</ListValues>
</avrasm.assembler.general.AdditionalIncludeDirectories>
<avrasm.assembler.general.IncludeFile>m328pdef.inc</avrasm.assembler.general.IncludeFile>
</AvrAssembler>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrAssembler>
<avrasm.assembler.general.AdditionalIncludeDirectories>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.150\avrasm\inc</Value>
</ListValues>
</avrasm.assembler.general.AdditionalIncludeDirectories>
<avrasm.assembler.general.IncludeFile>m328pdef.inc</avrasm.assembler.general.IncludeFile>
</AvrAssembler>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="main.asm">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Assembler.targets" />
</Project>

View File

@ -0,0 +1,64 @@
<?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.150\avrasm\inc</AbsolutePath>
<Attribute></Attribute>
<Category>include</Category>
<Condition>AVRASM</Condition>
<FileContentHash i:nil="true" />
<FileVersion></FileVersion>
<Name>avrasm/inc</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.150\avrasm\inc\m328pdef.inc</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>AVRASM</Condition>
<FileContentHash>YpGdK/vCoyGIUkMyqjAbKQ==</FileContentHash>
<FileVersion></FileVersion>
<Name>avrasm/inc/m328pdef.inc</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.150\avrasm\templates\main.asm</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>AVRASM</Condition>
<FileContentHash>jEqxGSx+2zHMFiTZ3UD6Xg==</FileContentHash>
<FileVersion></FileVersion>
<Name>avrasm/templates/main.asm</Name>
<SelectString>Main file (.asm)</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.150/Atmel.ATmega_DFP.pdsc</PackPath>
<PackVersion>1.2.150</PackVersion>
<PresentInProject>true</PresentInProject>
<ReferenceConditionId>ATmega328P</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>

90
main.asm Normal file
View File

@ -0,0 +1,90 @@
;
; chenillarEssai3.asm
;
; Created: 19-03-18 13:13:56
; Author : Adrien
;
.dseg
.def rtmp = r16
.def rdec = r17
.def rsens = r18
.cseg
.include "m328pdef.inc"
.org 0x0000
jmp RESET
.org OC0Aaddr
jmp TIM0_COMPA ; Timer0 CompareA
.org OVF0addr
jmp TIM0_OVF
.org 0x0100
RESET:
ldi rtmp, HIGH(RAMEND) ;Charge la valeur haute de l?adresse en fin m?moire RAM
out SPH, rtmp ;Positionne le pointeur de pile haut sur cette adresse
ldi rtmp, LOW(RAMEND) ;Charge la valeur basse de l?adresse en fin m?moire RAM
out SPL, rtmp ;Positionne le pointeur de pile bas sur cette adresse
; Replace with your application code
ser rtmp ;Port en sortie (les bits du port sont mis ? 1, soit en sortie)
out DDRD, rtmp ;Ecriture sur le
clr rtmp ;Port en bas (les bits du port sont mis ? 0, Led ?teinte)
ldi rtmp, 0x01
out PORTD, rtmp ;PINB1 Mis ? 1
clr rsens
;_____________________________________________________________________________
;Setup Timer0
;_____________________________________________________________________________
CLR rtmp
OUT TCCR0A, rtmp ;Normal port op
LDI rtmp, 0x01
OUT TCCR0B, rtmp ; No Force, No wave, Clk from precal/1024, 7.8125Khz, 128?s
ldi rtmp, 0x02
sts TIMSK0, rtmp ; OCR0A Interrupt Enable
CLR rtmp
OUT TCNT0, rtmp ;
LDI rtmp, 0xff
OUT OCR0A, rtmp ; 256*128?s = 16ms
LDI rdec, 0xFF
;_____________________________________________________________________________
;Setup PWM Timer0
;_____________________________________________________________________________
SEI
start:
nop
nop
nop
jmp PC-2
TIM0_COMPA:
dec rdec
BRNE PC+7
in rtmp, PORTD
lsl rtmp ;Shift left
BRCC PC+2; Si le cary est ? 0 rtmp est dif de 0x00 Si carry est ? 1, rtmp = 0x00 donc on le met ? 0x01
ldi rtmp, 0x01
out PORTD, rtmp
ldi r18, 0xff
ldi rtmp, 0x00
out TCNT0, rtmp
reti ;Fin de l?interruption
TIM0_OVF:
dec rdec
BRNE PC+1
in rtmp, PORTD
lsl rtmp ;Shift left
BRCC PC+2; Si le cary est ? 0 rtmp est dif de 0x00 Si carry est ? 1, rtmp = 0x00 donc on le met ? 0x01
ldi rtmp, 0x01
out PORTD, rtmp
reti