Added missing classes from final year at OSU

This commit is contained in:
2019-06-17 14:04:15 -07:00
parent 8fa1ffb1b0
commit c717a0316f
166 changed files with 653934 additions and 308 deletions

View File

@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Atmel Studio Solution File, Format Version 11.00
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{18226A42-8477-4023-8AD2-40C49DA407C9}") = "Corwin_Perren_Lab4_challengecode", "Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asmproj", "{59B1D629-9DCC-43ED-A0FD-8AB0E4D622AB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AVR = Debug|AVR
Release|AVR = Release|AVR
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{59B1D629-9DCC-43ED-A0FD-8AB0E4D622AB}.Debug|AVR.ActiveCfg = Debug|AVR
{59B1D629-9DCC-43ED-A0FD-8AB0E4D622AB}.Debug|AVR.Build.0 = Debug|AVR
{59B1D629-9DCC-43ED-A0FD-8AB0E4D622AB}.Release|AVR.ActiveCfg = Release|AVR
{59B1D629-9DCC-43ED-A0FD-8AB0E4D622AB}.Release|AVR.Build.0 = Release|AVR
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,193 @@
;***********************************************************
;*
;* Corwin_Perren_Lab4_challengecode.asm
;*
;* This program loads a two line string from program memory,
;* then cycles it around the lines of the display.
;*
;* This is the skeleton file for Lab 4 of ECE 375
;*
;***********************************************************
;*
;* Author: Corwin Perren
;* Date: 10/17/2018
;*
;***********************************************************
.include "m128def.inc" ; Include definition file
;***********************************************************
;* Internal Register Definitions and Constants
;***********************************************************
.def mpr = r16 ; Multipurpose register is
.def mpr2 = r10
.def dataloopcountreg = r23
.equ WTime = 25 ; Time to wait in wait loop
.equ datamemstart = 0x0100
.equ stringlen = 32
;***********************************************************
;* Start of Code Segment
;***********************************************************
.cseg ; Beginning of code segment
;***********************************************************
;* Interrupt Vectors
;***********************************************************
.org $0000 ; Beginning of IVs
rjmp INIT ; Reset interrupt
.org $0046 ; End of Interrupt Vectors
;***********************************************************
;* Program Initialization
;***********************************************************
INIT: ; The initialization routine
; Initialize Stack Pointer
ldi mpr, low(RAMEND) ; Load the low and high bytes of ram end to the stack pointer
out SPL, mpr
ldi mpr, high(RAMEND)
out SPH, mpr
; Initialize LCD Display
rcall LCDInit ; Call the lcd init function
; Move strings from Program Memory to Data Memory
ldi ZL, low(STRING_BEG << 1) ; Low byte of first byte in string into ZL
ldi ZH, high(STRING_BEG << 1) ; High byte of first byte in string into ZH
ldi YL, low(datamemstart) ; Low byte of data memory start into YL
ldi YH, high(datamemstart)
ldi dataloopcountreg, stringlen ; Initialize count for loop to string length
INIT_MEMCOPYLOOP: ; Loop to read data from progmem to datamem
lpm mpr, Z+ ; Get byte from address pointed to be Z,
; store in reg, move to next byte
st Y+, mpr ; Store byte from reg into data mem address
; pointed to by Y, then move Y to next open spot
dec dataloopcountreg ; Decrement count as we're done with byte
brne INIT_MEMCOPYLOOP ; If we haven't read in the whole string, loop again
; NOTE that there is no RET or RJMP from INIT, this
; is because the next instruction executed is the
; first instruction of the main program
;***********************************************************
;* Main Program
;***********************************************************
MAIN: ; The Main program
; Display the strings on the LCD Display
rcall LCDWrite ; This writes the data mem to the display,
; based on fixed mem addresses in LCDDriver.asm
ldi mpr, WTime ; Copied from lab 1, copy time into general reg
mov wait, mpr ; Copy into wait reg
rcall AVRWait ; Call wait subroutine
rcall ROTATE_TEXT ; Call subroutine to rotate text by one char
rjmp MAIN ; jump back to main and create an infinite
; while loop. Generally, every main program is an
; infinite while loop, never let the main program
; just run off
;-----------------------------------------------------------
; Func: ROTATE_TEXT
; Desc: This rotates a text string by one character, looping around the end
;-----------------------------------------------------------
ROTATE_TEXT: ; Begin a function with a label
; Save variables by pushing them to the stack
push mpr
push mpr2
push dataloopcountreg
push XL
push XH
; Get pointer to start of data memory for the lcd
ldi XL, low(datamemstart)
ldi XH, high(datamemstart)
ld mpr, X+ ; Get the first element, point to next
; Initialize counter
ldi dataloopcountreg, stringlen ; Initialize count for loop to string length
dec dataloopcountreg ; The last one we want to take care of
; specifically, so dec to skip the first char
ROTATE_TEXT_LOOP:
ld mpr2, X ; Save value in current text mem location
st X, mpr ; Overwrite current text mem with char from prev location
inc XL ; Move to next byte location
mov mpr, mpr2 ; Move stored prev char value into main mpr for overwrite
dec dataloopcountreg ; Dec loop counter
brne ROTATE_TEXT_LOOP ; If not done with all chars, loop
; Go back to start
ldi XL, low(datamemstart) ; Repoint to beginning of string array
ldi XH, high(datamemstart)
; Store last element as first
st X, mpr ; Overwrite first char with previous last character
; Restore variables by popping them from the stack,
; in reverse order
pop XH
pop XL
pop dataloopcountreg
pop mpr2
pop mpr
ret ; End a function with RET
; This was copied and modified from lab 1
;----------------------------------------------------------------
; Sub: AVRWait
; Desc: A wait loop that is 16 + 159975*waitcnt cycles or roughly
; waitcnt*10ms. Just initialize wait for the specific amount
; of time in 10ms intervals. Here is the general eqaution
; for the number of clock cycles in the wait loop:
; ((3 * ilcnt + 3) * olcnt + 3) * waitcnt + 13 + call
;----------------------------------------------------------------
AVRWait:
push wait ; Save wait register
push count ; Save ilcnt register
push line ; Save olcnt register
Loop: ldi line, 224 ; load olcnt register
OLoop: ldi count, 237 ; load ilcnt register
ILoop: dec count ; decrement ilcnt
brne ILoop ; Continue Inner Loop
dec line ; decrement olcnt
brne OLoop ; Continue Outer Loop
dec wait ; Decrement wait
brne Loop ; Continue Wait loop
pop line ; Restore olcnt register
pop count ; Restore ilcnt register
pop wait ; Restore wait register
ret ; Return from subroutine
;***********************************************************
;* Stored Program Data
;***********************************************************
;-----------------------------------------------------------
; An example of storing a string. Note the labels before and
; after the .DB directive; these can help to access the data
;-----------------------------------------------------------
STRING_BEG:
.DB " Corwin Perren Hello World! " ; Declaring data in ProgMem
STRING_END:
;***********************************************************
;* Additional Program Includes
;***********************************************************
.include "LCDDriver.asm" ; Include the LCD Driver

View File

@@ -0,0 +1,77 @@
<?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>ATmega128</avrdevice>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.obj</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<Language>ASSEMBLY</Language>
<AssemblyName>Corwin_Perren_Lab4_challengecode</AssemblyName>
<Name>Corwin_Perren_Lab4_challengecode</Name>
<RootNamespace>Corwin_Perren_Lab4_challengecode</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<EntryFile>$(MSBuildProjectDirectory)\Corwin_Perren_Lab4_challengecode.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.40.0" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrAssembler>
<avrasm.assembler.general.AdditionalIncludeDirectories>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\avrasm\inc</Value>
</ListValues>
</avrasm.assembler.general.AdditionalIncludeDirectories>
<avrasm.assembler.general.IncludeFile>m128def.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.209\avrasm\inc</Value>
</ListValues>
</avrasm.assembler.general.AdditionalIncludeDirectories>
<avrasm.assembler.general.IncludeFile>m128def.inc</avrasm.assembler.general.IncludeFile>
</AvrAssembler>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="Corwin_Perren_Lab4_challengecode.asm">
<SubType>Code</SubType>
</Compile>
<Compile Include="LCDDriver.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.209\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.209\avrasm\inc\m128def.inc</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>AVRASM</Condition>
<FileContentHash>bd3TUV9UtxpdYQkn+6MWPA==</FileContentHash>
<FileVersion></FileVersion>
<Name>avrasm/inc/m128def.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.209\avrasm\templates\main.asm</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>AVRASM</Condition>
<FileContentHash>5CfmTmZmR6PbQJ065mg2IQ==</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.209/Atmel.ATmega_DFP.pdsc</PackPath>
<PackVersion>1.2.209</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,48 @@
:020000020000FC
:0200000045C0F9
:10008C000FEF0DBF00E10EBF47D0E4E0F1E0C0E0A0
:10009C00D1E070E2059109937A95E1F77CD009E102
:1000AC00102F1BD001D0FACF0F93AF927F93AF9349
:1000BC00BF93A0E0B1E00D9170E27A95AC900C93F7
:1000CC00A3950A2D7A95D1F7A0E0B1E00C93BF91DE
:1000DC00AF917F91AF900F9108951F932F933F9302
:1000EC0030EE2DEE2A95F1F73A95D9F71A95C1F71E
:1000FC003F912F911F91089520436F7277696E2065
:10010C0050657272656E2020202048656C6C6F20E3
:10011C00576F726C642120200F930FB70F931F93AE
:10012C0000E008BB0FEF07BB00E002BB00E001BB27
:10013C0000E00093620008E00093610000E50DB957
:10014C0001E00EB900E805BF02E400936D0000E881
:10015C0000936C0000E00BB908E10AB906E00093CB
:10016C00950000E00093900007E609B906E01AEF4D
:10017C00BFD00A95E1F708E397D008E095D001E0ED
:10018C0093D006E091D00CE08FD028D01F910F9126
:10019C000FBF0F91089502D011D008950F93EF93D4
:1001AC00FF932F933F93E0E0F1E030E86BD076D0F3
:1001BC003F912F91FF91EF910F9108950F93EF9332
:1001CC00FF932F933F93E0E1F1E030EC5BD066D0EE
:1001DC003F912F91FF91EF910F91089502D011D083
:1001EC0008950F933F932F93EF93FF9330E84AD0EA
:1001FC00E0E0F1E04CD0FF91EF912F913F910F9106
:10020C0008950F933F932F93EF93FF9330EC3AD0D5
:10021C00E0E1F1E03CD0FF91EF912F913F910F91F4
:10022C0008950F933F932F93283250F4313011F4EB
:10023C0030E803C0323021F430EC320F23D042D0FE
:10024C002F913F910F9108950F936F935F93BF93ED
:10025C00AF93043618F023E0139607C00A3018F059
:10026C0022E0129602C0119621E04AD000E3060F5C
:10027C000E93052F0030C9F7AF91BF915F916F912D
:10028C000F9108950F93032F0FD00F91089500E253
:10029C0020E1019317D02A95E1F7089520E101910F
:1002AC0011D02A95E1F708954F931F9340E013D096
:1002BC000F9302E01DEC1CD00A95E1F70F911F91F2
:1002CC004F9108954F931F9341E005D010E110D04A
:1002DC001F914F9108954FB912E00AD00FB912E057
:1002EC0007D018E01093620010E01093620008959C
:1002FC000F9309E40A95F1F71A95D9F70F91089520
:10030C000F92502F56955695500F5695500F569557
:10031C0056955695500F5695500F56955695569591
:10032C00500F5695500F5695569556955695652FD8
:10033C00660F660F650F660F062E602F60196A3008
:0C034C0018F053956A50FBCF0F900895F5
:00000001FF

View File

@@ -0,0 +1,933 @@
AVRASM ver. 2.2.7 C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm Tue Oct 23 20:38:27 2018
EQU SIGNATURE_000 0000001e
EQU SIGNATURE_001 00000097
EQU SIGNATURE_002 00000002
EQU UCSR1C 0000009d
EQU UDR1 0000009c
EQU UCSR1A 0000009b
EQU UCSR1B 0000009a
EQU UBRR1H 00000098
EQU UBRR1L 00000099
EQU UCSR0C 00000095
EQU UBRR0H 00000090
EQU TCCR3C 0000008c
EQU TCCR3A 0000008b
EQU TCCR3B 0000008a
EQU TCNT3L 00000088
EQU TCNT3H 00000089
EQU OCR3AL 00000086
EQU OCR3AH 00000087
EQU OCR3BL 00000084
EQU OCR3BH 00000085
EQU OCR3CL 00000082
EQU OCR3CH 00000083
EQU ICR3L 00000080
EQU ICR3H 00000081
EQU ETIMSK 0000007d
EQU ETIFR 0000007c
EQU TCCR1C 0000007a
EQU OCR1CL 00000078
EQU OCR1CH 00000079
EQU TWCR 00000074
EQU TWDR 00000073
EQU TWAR 00000072
EQU TWSR 00000071
EQU TWBR 00000070
EQU OSCCAL 0000006f
EQU XMCRA 0000006d
EQU XMCRB 0000006c
EQU EICRA 0000006a
EQU SPMCSR 00000068
EQU PORTG 00000065
EQU DDRG 00000064
EQU PING 00000063
EQU PORTF 00000062
EQU DDRF 00000061
EQU SREG 0000003f
EQU SPL 0000003d
EQU SPH 0000003e
EQU XDIV 0000003c
EQU RAMPZ 0000003b
EQU EICRB 0000003a
EQU EIMSK 00000039
EQU EIFR 00000038
EQU TIMSK 00000037
EQU TIFR 00000036
EQU MCUCR 00000035
EQU MCUCSR 00000034
EQU TCCR0 00000033
EQU TCNT0 00000032
EQU OCR0 00000031
EQU ASSR 00000030
EQU TCCR1A 0000002f
EQU TCCR1B 0000002e
EQU TCNT1L 0000002c
EQU TCNT1H 0000002d
EQU OCR1AL 0000002a
EQU OCR1AH 0000002b
EQU OCR1BL 00000028
EQU OCR1BH 00000029
EQU ICR1L 00000026
EQU ICR1H 00000027
EQU TCCR2 00000025
EQU TCNT2 00000024
EQU OCR2 00000023
EQU OCDR 00000022
EQU WDTCR 00000021
EQU SFIOR 00000020
EQU EEARL 0000001e
EQU EEARH 0000001f
EQU EEDR 0000001d
EQU EECR 0000001c
EQU PORTA 0000001b
EQU DDRA 0000001a
EQU PINA 00000019
EQU PORTB 00000018
EQU DDRB 00000017
EQU PINB 00000016
EQU PORTC 00000015
EQU DDRC 00000014
EQU PINC 00000013
EQU PORTD 00000012
EQU DDRD 00000011
EQU PIND 00000010
EQU SPDR 0000000f
EQU SPSR 0000000e
EQU SPCR 0000000d
EQU UDR0 0000000c
EQU UCSR0A 0000000b
EQU UCSR0B 0000000a
EQU UBRR0L 00000009
EQU ACSR 00000008
EQU ADMUX 00000007
EQU ADCSRA 00000006
EQU ADCH 00000005
EQU ADCL 00000004
EQU PORTE 00000003
EQU DDRE 00000002
EQU PINE 00000001
EQU PINF 00000000
EQU ACME 00000003
EQU ACIS0 00000000
EQU ACIS1 00000001
EQU ACIC 00000002
EQU ACIE 00000003
EQU ACI 00000004
EQU ACO 00000005
EQU ACBG 00000006
EQU ACD 00000007
EQU SPDR0 00000000
EQU SPDR1 00000001
EQU SPDR2 00000002
EQU SPDR3 00000003
EQU SPDR4 00000004
EQU SPDR5 00000005
EQU SPDR6 00000006
EQU SPDR7 00000007
EQU SPI2X 00000000
EQU WCOL 00000006
EQU SPIF 00000007
EQU SPR0 00000000
EQU SPR1 00000001
EQU CPHA 00000002
EQU CPOL 00000003
EQU MSTR 00000004
EQU DORD 00000005
EQU SPE 00000006
EQU SPIE 00000007
EQU I2BR 00000070
EQU TWBR0 00000000
EQU TWBR1 00000001
EQU TWBR2 00000002
EQU TWBR3 00000003
EQU TWBR4 00000004
EQU TWBR5 00000005
EQU TWBR6 00000006
EQU TWBR7 00000007
EQU I2CR 00000074
EQU TWIE 00000000
EQU I2IE 00000000
EQU TWEN 00000002
EQU I2EN 00000002
EQU ENI2C 00000002
EQU TWWC 00000003
EQU I2WC 00000003
EQU TWSTO 00000004
EQU I2STO 00000004
EQU TWSTA 00000005
EQU I2STA 00000005
EQU TWEA 00000006
EQU I2EA 00000006
EQU TWINT 00000007
EQU I2INT 00000007
EQU I2SR 00000071
EQU TWPS0 00000000
EQU TWS0 00000000
EQU I2GCE 00000000
EQU TWPS1 00000001
EQU TWS1 00000001
EQU TWS3 00000003
EQU I2S3 00000003
EQU TWS4 00000004
EQU I2S4 00000004
EQU TWS5 00000005
EQU I2S5 00000005
EQU TWS6 00000006
EQU I2S6 00000006
EQU TWS7 00000007
EQU I2S7 00000007
EQU I2DR 00000073
EQU TWD0 00000000
EQU TWD1 00000001
EQU TWD2 00000002
EQU TWD3 00000003
EQU TWD4 00000004
EQU TWD5 00000005
EQU TWD6 00000006
EQU TWD7 00000007
EQU I2AR 00000072
EQU TWGCE 00000000
EQU TWA0 00000001
EQU TWA1 00000002
EQU TWA2 00000003
EQU TWA3 00000004
EQU TWA4 00000005
EQU TWA5 00000006
EQU TWA6 00000007
EQU UDR00 00000000
EQU UDR01 00000001
EQU UDR02 00000002
EQU UDR03 00000003
EQU UDR04 00000004
EQU UDR05 00000005
EQU UDR06 00000006
EQU UDR07 00000007
EQU MPCM0 00000000
EQU U2X0 00000001
EQU UPE0 00000002
EQU DOR0 00000003
EQU FE0 00000004
EQU UDRE0 00000005
EQU TXC0 00000006
EQU RXC0 00000007
EQU TXB80 00000000
EQU RXB80 00000001
EQU UCSZ02 00000002
EQU UCSZ2 00000002
EQU TXEN0 00000003
EQU RXEN0 00000004
EQU UDRIE0 00000005
EQU TXCIE0 00000006
EQU RXCIE0 00000007
EQU UCPOL0 00000000
EQU UCSZ00 00000001
EQU UCSZ01 00000002
EQU USBS0 00000003
EQU UPM00 00000004
EQU UPM01 00000005
EQU UMSEL0 00000006
EQU UBRR8 00000000
EQU UBRR9 00000001
EQU UBRR10 00000002
EQU UBRR11 00000003
EQU UBRR0 00000000
EQU UBRR1 00000001
EQU UBRR2 00000002
EQU UBRR3 00000003
EQU UBRR4 00000004
EQU UBRR5 00000005
EQU UBRR6 00000006
EQU UBRR7 00000007
EQU UDR10 00000000
EQU UDR11 00000001
EQU UDR12 00000002
EQU UDR13 00000003
EQU UDR14 00000004
EQU UDR15 00000005
EQU UDR16 00000006
EQU UDR17 00000007
EQU MPCM1 00000000
EQU U2X1 00000001
EQU UPE1 00000002
EQU DOR1 00000003
EQU FE1 00000004
EQU UDRE1 00000005
EQU TXC1 00000006
EQU RXC1 00000007
EQU TXB81 00000000
EQU RXB81 00000001
EQU UCSZ12 00000002
EQU TXEN1 00000003
EQU RXEN1 00000004
EQU UDRIE1 00000005
EQU TXCIE1 00000006
EQU RXCIE1 00000007
EQU UCPOL1 00000000
EQU UCSZ10 00000001
EQU UCSZ11 00000002
EQU USBS1 00000003
EQU UPM10 00000004
EQU UPM11 00000005
EQU UMSEL1 00000006
EQU SREG_C 00000000
EQU SREG_Z 00000001
EQU SREG_N 00000002
EQU SREG_V 00000003
EQU SREG_S 00000004
EQU SREG_H 00000005
EQU SREG_T 00000006
EQU SREG_I 00000007
EQU IVCE 00000000
EQU IVSEL 00000001
EQU SM2 00000002
EQU SM0 00000003
EQU SM1 00000004
EQU SE 00000005
EQU SRW10 00000006
EQU SRE 00000007
EQU SRW11 00000001
EQU SRW00 00000002
EQU SRW01 00000003
EQU SRL0 00000004
EQU SRL1 00000005
EQU SRL2 00000006
EQU XMM0 00000000
EQU XMM1 00000001
EQU XMM2 00000002
EQU XMBK 00000007
EQU CAL0 00000000
EQU CAL1 00000001
EQU CAL2 00000002
EQU CAL3 00000003
EQU CAL4 00000004
EQU CAL5 00000005
EQU CAL6 00000006
EQU CAL7 00000007
EQU XDIV0 00000000
EQU XDIV1 00000001
EQU XDIV2 00000002
EQU XDIV3 00000003
EQU XDIV4 00000004
EQU XDIV5 00000005
EQU XDIV6 00000006
EQU XDIVEN 00000007
EQU PORF 00000000
EQU EXTRF 00000001
EQU BORF 00000002
EQU WDRF 00000003
EQU JTRF 00000004
EQU JTD 00000007
EQU RAMPZ0 00000000
EQU SPMCR 00000068
EQU SPMEN 00000000
EQU PGERS 00000001
EQU PGWRT 00000002
EQU BLBSET 00000003
EQU RWWSRE 00000004
EQU ASRE 00000004
EQU RWWSB 00000006
EQU ASB 00000006
EQU SPMIE 00000007
EQU OCDR0 00000000
EQU OCDR1 00000001
EQU OCDR2 00000002
EQU OCDR3 00000003
EQU OCDR4 00000004
EQU OCDR5 00000005
EQU OCDR6 00000006
EQU OCDR7 00000007
EQU IDRD 00000007
EQU PSR321 00000000
EQU PSR1 00000000
EQU PSR2 00000000
EQU PSR3 00000000
EQU PSR0 00000001
EQU PUD 00000002
EQU TSM 00000007
EQU ISC00 00000000
EQU ISC01 00000001
EQU ISC10 00000002
EQU ISC11 00000003
EQU ISC20 00000004
EQU ISC21 00000005
EQU ISC30 00000006
EQU ISC31 00000007
EQU ISC40 00000000
EQU ISC41 00000001
EQU ISC50 00000002
EQU ISC51 00000003
EQU ISC60 00000004
EQU ISC61 00000005
EQU ISC70 00000006
EQU ISC71 00000007
EQU GICR 00000039
EQU GIMSK 00000039
EQU INT0 00000000
EQU INT1 00000001
EQU INT2 00000002
EQU INT3 00000003
EQU INT4 00000004
EQU INT5 00000005
EQU INT6 00000006
EQU INT7 00000007
EQU GIFR 00000038
EQU INTF0 00000000
EQU INTF1 00000001
EQU INTF2 00000002
EQU INTF3 00000003
EQU INTF4 00000004
EQU INTF5 00000005
EQU INTF6 00000006
EQU INTF7 00000007
EQU EEDR0 00000000
EQU EEDR1 00000001
EQU EEDR2 00000002
EQU EEDR3 00000003
EQU EEDR4 00000004
EQU EEDR5 00000005
EQU EEDR6 00000006
EQU EEDR7 00000007
EQU EERE 00000000
EQU EEWE 00000001
EQU EEMWE 00000002
EQU EERIE 00000003
EQU PORTA0 00000000
EQU PA0 00000000
EQU PORTA1 00000001
EQU PA1 00000001
EQU PORTA2 00000002
EQU PA2 00000002
EQU PORTA3 00000003
EQU PA3 00000003
EQU PORTA4 00000004
EQU PA4 00000004
EQU PORTA5 00000005
EQU PA5 00000005
EQU PORTA6 00000006
EQU PA6 00000006
EQU PORTA7 00000007
EQU PA7 00000007
EQU DDA0 00000000
EQU DDA1 00000001
EQU DDA2 00000002
EQU DDA3 00000003
EQU DDA4 00000004
EQU DDA5 00000005
EQU DDA6 00000006
EQU DDA7 00000007
EQU PINA0 00000000
EQU PINA1 00000001
EQU PINA2 00000002
EQU PINA3 00000003
EQU PINA4 00000004
EQU PINA5 00000005
EQU PINA6 00000006
EQU PINA7 00000007
EQU PORTB0 00000000
EQU PB0 00000000
EQU PORTB1 00000001
EQU PB1 00000001
EQU PORTB2 00000002
EQU PB2 00000002
EQU PORTB3 00000003
EQU PB3 00000003
EQU PORTB4 00000004
EQU PB4 00000004
EQU PORTB5 00000005
EQU PB5 00000005
EQU PORTB6 00000006
EQU PB6 00000006
EQU PORTB7 00000007
EQU PB7 00000007
EQU DDB0 00000000
EQU DDB1 00000001
EQU DDB2 00000002
EQU DDB3 00000003
EQU DDB4 00000004
EQU DDB5 00000005
EQU DDB6 00000006
EQU DDB7 00000007
EQU PINB0 00000000
EQU PINB1 00000001
EQU PINB2 00000002
EQU PINB3 00000003
EQU PINB4 00000004
EQU PINB5 00000005
EQU PINB6 00000006
EQU PINB7 00000007
EQU PORTC0 00000000
EQU PC0 00000000
EQU PORTC1 00000001
EQU PC1 00000001
EQU PORTC2 00000002
EQU PC2 00000002
EQU PORTC3 00000003
EQU PC3 00000003
EQU PORTC4 00000004
EQU PC4 00000004
EQU PORTC5 00000005
EQU PC5 00000005
EQU PORTC6 00000006
EQU PC6 00000006
EQU PORTC7 00000007
EQU PC7 00000007
EQU DDC0 00000000
EQU DDC1 00000001
EQU DDC2 00000002
EQU DDC3 00000003
EQU DDC4 00000004
EQU DDC5 00000005
EQU DDC6 00000006
EQU DDC7 00000007
EQU PINC0 00000000
EQU PINC1 00000001
EQU PINC2 00000002
EQU PINC3 00000003
EQU PINC4 00000004
EQU PINC5 00000005
EQU PINC6 00000006
EQU PINC7 00000007
EQU PORTD0 00000000
EQU PD0 00000000
EQU PORTD1 00000001
EQU PD1 00000001
EQU PORTD2 00000002
EQU PD2 00000002
EQU PORTD3 00000003
EQU PD3 00000003
EQU PORTD4 00000004
EQU PD4 00000004
EQU PORTD5 00000005
EQU PD5 00000005
EQU PORTD6 00000006
EQU PD6 00000006
EQU PORTD7 00000007
EQU PD7 00000007
EQU DDD0 00000000
EQU DDD1 00000001
EQU DDD2 00000002
EQU DDD3 00000003
EQU DDD4 00000004
EQU DDD5 00000005
EQU DDD6 00000006
EQU DDD7 00000007
EQU PIND0 00000000
EQU PIND1 00000001
EQU PIND2 00000002
EQU PIND3 00000003
EQU PIND4 00000004
EQU PIND5 00000005
EQU PIND6 00000006
EQU PIND7 00000007
EQU PORTE0 00000000
EQU PE0 00000000
EQU PORTE1 00000001
EQU PE1 00000001
EQU PORTE2 00000002
EQU PE2 00000002
EQU PORTE3 00000003
EQU PE3 00000003
EQU PORTE4 00000004
EQU PE4 00000004
EQU PORTE5 00000005
EQU PE5 00000005
EQU PORTE6 00000006
EQU PE6 00000006
EQU PORTE7 00000007
EQU PE7 00000007
EQU DDE0 00000000
EQU DDE1 00000001
EQU DDE2 00000002
EQU DDE3 00000003
EQU DDE4 00000004
EQU DDE5 00000005
EQU DDE6 00000006
EQU DDE7 00000007
EQU PINE0 00000000
EQU PINE1 00000001
EQU PINE2 00000002
EQU PINE3 00000003
EQU PINE4 00000004
EQU PINE5 00000005
EQU PINE6 00000006
EQU PINE7 00000007
EQU PORTF0 00000000
EQU PF0 00000000
EQU PORTF1 00000001
EQU PF1 00000001
EQU PORTF2 00000002
EQU PF2 00000002
EQU PORTF3 00000003
EQU PF3 00000003
EQU PORTF4 00000004
EQU PF4 00000004
EQU PORTF5 00000005
EQU PF5 00000005
EQU PORTF6 00000006
EQU PF6 00000006
EQU PORTF7 00000007
EQU PF7 00000007
EQU DDF0 00000000
EQU DDF1 00000001
EQU DDF2 00000002
EQU DDF3 00000003
EQU DDF4 00000004
EQU DDF5 00000005
EQU DDF6 00000006
EQU DDF7 00000007
EQU PINF0 00000000
EQU PINF1 00000001
EQU PINF2 00000002
EQU PINF3 00000003
EQU PINF4 00000004
EQU PINF5 00000005
EQU PINF6 00000006
EQU PINF7 00000007
EQU PORTG0 00000000
EQU PG0 00000000
EQU PORTG1 00000001
EQU PG1 00000001
EQU PORTG2 00000002
EQU PG2 00000002
EQU PORTG3 00000003
EQU PG3 00000003
EQU PORTG4 00000004
EQU PG4 00000004
EQU DDG0 00000000
EQU DDG1 00000001
EQU DDG2 00000002
EQU DDG3 00000003
EQU DDG4 00000004
EQU PING0 00000000
EQU PING1 00000001
EQU PING2 00000002
EQU PING3 00000003
EQU PING4 00000004
EQU CS00 00000000
EQU CS01 00000001
EQU CS02 00000002
EQU WGM01 00000003
EQU CTC0 00000003
EQU COM00 00000004
EQU COM01 00000005
EQU WGM00 00000006
EQU PWM0 00000006
EQU FOC0 00000007
EQU TCNT0_0 00000000
EQU TCNT0_1 00000001
EQU TCNT0_2 00000002
EQU TCNT0_3 00000003
EQU TCNT0_4 00000004
EQU TCNT0_5 00000005
EQU TCNT0_6 00000006
EQU TCNT0_7 00000007
EQU OCR0_0 00000000
EQU OCR0_1 00000001
EQU OCR0_2 00000002
EQU OCR0_3 00000003
EQU OCR0_4 00000004
EQU OCR0_5 00000005
EQU OCR0_6 00000006
EQU OCR0_7 00000007
EQU TCR0UB 00000000
EQU OCR0UB 00000001
EQU TCN0UB 00000002
EQU AS0 00000003
EQU TOIE0 00000000
EQU OCIE0 00000001
EQU TOV0 00000000
EQU OCF0 00000001
EQU TOIE1 00000002
EQU OCIE1B 00000003
EQU OCIE1A 00000004
EQU TICIE1 00000005
EQU OCIE1C 00000000
EQU TOV1 00000002
EQU OCF1B 00000003
EQU OCF1A 00000004
EQU ICF1 00000005
EQU OCF1C 00000000
EQU WGM10 00000000
EQU PWM10 00000000
EQU WGM11 00000001
EQU PWM11 00000001
EQU COM1C0 00000002
EQU COM1C1 00000003
EQU COM1B0 00000004
EQU COM1B1 00000005
EQU COM1A0 00000006
EQU COM1A1 00000007
EQU CS10 00000000
EQU CS11 00000001
EQU CS12 00000002
EQU WGM12 00000003
EQU CTC10 00000003
EQU WGM13 00000004
EQU CTC11 00000004
EQU ICES1 00000006
EQU ICNC1 00000007
EQU FOC1C 00000005
EQU FOC1B 00000006
EQU FOC1A 00000007
EQU CS20 00000000
EQU CS21 00000001
EQU CS22 00000002
EQU WGM21 00000003
EQU CTC2 00000003
EQU COM20 00000004
EQU COM21 00000005
EQU WGM20 00000006
EQU PWM2 00000006
EQU FOC2 00000007
EQU TCNT2_0 00000000
EQU TCNT2_1 00000001
EQU TCNT2_2 00000002
EQU TCNT2_3 00000003
EQU TCNT2_4 00000004
EQU TCNT2_5 00000005
EQU TCNT2_6 00000006
EQU TCNT2_7 00000007
EQU OCR2_0 00000000
EQU OCR2_1 00000001
EQU OCR2_2 00000002
EQU OCR2_3 00000003
EQU OCR2_4 00000004
EQU OCR2_5 00000005
EQU OCR2_6 00000006
EQU OCR2_7 00000007
EQU TOIE2 00000006
EQU OCIE2 00000007
EQU TOV2 00000006
EQU OCF2 00000007
EQU OCIE3C 00000001
EQU TOIE3 00000002
EQU OCIE3B 00000003
EQU OCIE3A 00000004
EQU TICIE3 00000005
EQU OCF3C 00000001
EQU TOV3 00000002
EQU OCF3B 00000003
EQU OCF3A 00000004
EQU ICF3 00000005
EQU WGM30 00000000
EQU PWM30 00000000
EQU WGM31 00000001
EQU PWM31 00000001
EQU COM3C0 00000002
EQU COM3C1 00000003
EQU COM3B0 00000004
EQU COM3B1 00000005
EQU COM3A0 00000006
EQU COM3A1 00000007
EQU CS30 00000000
EQU CS31 00000001
EQU CS32 00000002
EQU WGM32 00000003
EQU CTC30 00000003
EQU WGM33 00000004
EQU CTC31 00000004
EQU ICES3 00000006
EQU ICNC3 00000007
EQU FOC3C 00000005
EQU FOC3B 00000006
EQU FOC3A 00000007
EQU TCN3L0 00000000
EQU TCN3L1 00000001
EQU TCN3L2 00000002
EQU TCN3L3 00000003
EQU TCN3L4 00000004
EQU TCN3L5 00000005
EQU TCN3L6 00000006
EQU TCN3L7 00000007
EQU WDTCSR 00000021
EQU WDP0 00000000
EQU WDP1 00000001
EQU WDP2 00000002
EQU WDE 00000003
EQU WDCE 00000004
EQU WDTOE 00000004
EQU MUX0 00000000
EQU MUX1 00000001
EQU MUX2 00000002
EQU MUX3 00000003
EQU MUX4 00000004
EQU ADLAR 00000005
EQU REFS0 00000006
EQU REFS1 00000007
EQU ADCSR 00000006
EQU ADPS0 00000000
EQU ADPS1 00000001
EQU ADPS2 00000002
EQU ADIE 00000003
EQU ADIF 00000004
EQU ADFR 00000005
EQU ADSC 00000006
EQU ADEN 00000007
EQU ADCH0 00000000
EQU ADCH1 00000001
EQU ADCH2 00000002
EQU ADCH3 00000003
EQU ADCH4 00000004
EQU ADCH5 00000005
EQU ADCH6 00000006
EQU ADCH7 00000007
EQU ADCL0 00000000
EQU ADCL1 00000001
EQU ADCL2 00000002
EQU ADCL3 00000003
EQU ADCL4 00000004
EQU ADCL5 00000005
EQU ADCL6 00000006
EQU ADCL7 00000007
EQU LB1 00000000
EQU LB2 00000001
EQU BLB01 00000002
EQU BLB02 00000003
EQU BLB11 00000004
EQU BLB12 00000005
EQU CKSEL0 00000000
EQU CKSEL1 00000001
EQU CKSEL2 00000002
EQU CKSEL3 00000003
EQU SUT0 00000004
EQU SUT1 00000005
EQU BODEN 00000006
EQU BODLEVEL 00000007
EQU BOOTRST 00000000
EQU BOOTSZ0 00000001
EQU BOOTSZ1 00000002
EQU EESAVE 00000003
EQU CKOPT 00000004
EQU SPIEN 00000005
EQU JTAGEN 00000006
EQU OCDEN 00000007
EQU WDTON 00000000
EQU M103C 00000001
DEF XH r27
DEF XL r26
DEF YH r29
DEF YL r28
DEF ZH r31
DEF ZL r30
EQU FLASHEND 0000ffff
EQU IOEND 000000ff
EQU SRAM_START 00000100
EQU SRAM_SIZE 00001000
EQU RAMEND 000010ff
EQU XRAMEND 0000ffff
EQU E2END 00000fff
EQU EEPROMEND 00000fff
EQU EEADRBITS 0000000c
EQU NRWW_START_ADDR 0000f000
EQU NRWW_STOP_ADDR 0000ffff
EQU RWW_START_ADDR 00000000
EQU RWW_STOP_ADDR 0000efff
EQU PAGESIZE 00000080
EQU FIRSTBOOTSTART 0000fe00
EQU SECONDBOOTSTART 0000fc00
EQU THIRDBOOTSTART 0000f800
EQU FOURTHBOOTSTART 0000f000
EQU SMALLBOOTSTART 0000fe00
EQU LARGEBOOTSTART 0000f000
EQU INT0addr 00000002
EQU INT1addr 00000004
EQU INT2addr 00000006
EQU INT3addr 00000008
EQU INT4addr 0000000a
EQU INT5addr 0000000c
EQU INT6addr 0000000e
EQU INT7addr 00000010
EQU OC2addr 00000012
EQU OVF2addr 00000014
EQU ICP1addr 00000016
EQU OC1Aaddr 00000018
EQU OC1Baddr 0000001a
EQU OVF1addr 0000001c
EQU OC0addr 0000001e
EQU OVF0addr 00000020
EQU SPIaddr 00000022
EQU URXC0addr 00000024
EQU UDRE0addr 00000026
EQU UTXC0addr 00000028
EQU ADCCaddr 0000002a
EQU ERDYaddr 0000002c
EQU ACIaddr 0000002e
EQU OC1Caddr 00000030
EQU ICP3addr 00000032
EQU OC3Aaddr 00000034
EQU OC3Baddr 00000036
EQU OC3Caddr 00000038
EQU OVF3addr 0000003a
EQU URXC1addr 0000003c
EQU UDRE1addr 0000003e
EQU UTXC1addr 00000040
EQU TWIaddr 00000042
EQU SPMRaddr 00000044
EQU INT_VECTORS_SIZE 00000046
DEF mpr r16
DEF mpr2 r10
DEF dataloopcountreg r23
EQU WTime 00000019
EQU datamemstart 00000100
EQU stringlen 00000020
CSEG INIT 00000046
CSEG LCDInit 00000092
CSEG STRING_BEG 00000082
CSEG INIT_MEMCOPYLOOP 00000050
CSEG MAIN 00000054
CSEG LCDWrite 000000d1
DEF wait r17
CSEG AVRWait 00000073
CSEG ROTATE_TEXT 0000005a
CSEG ROTATE_TEXT_LOOP 00000064
DEF count r18
DEF line r19
CSEG Loop 00000076
CSEG OLoop 00000077
CSEG ILoop 00000078
CSEG STRING_END 00000092
DEF type r20
DEF q r21
DEF r r22
EQU LCDLine1 00000080
EQU LCDLine2 000000c0
EQU LCDClear 00000001
EQU LCDHome 00000002
EQU LCDPulse 00000008
EQU LCDCmd 00000000
EQU LCDTxt 00000001
EQU LCDMaxCnt 00000010
EQU LCDLn1Addr 00000100
EQU LCDLn2Addr 00000110
CSEG LCDINIT_L1 000000bd
CSEG LCDWait 0000017e
CSEG LCDWriteCmd 0000015a
CSEG LCDClr 000000f4
CSEG LCDWrLn1 000000d4
CSEG LCDWrLn2 000000e4
CSEG LCDSetLine 00000148
CSEG LCDWriteLine 00000154
CSEG LCDClrLn1 000000f7
CSEG LCDClrLn2 00000107
CSEG LCDClrLine 0000014d
CSEG LCDWriteByte 00000117
CSEG LCDWriteByte_3 00000126
CSEG LCDWriteByte_1 00000120
CSEG LCDWriteByte_2 00000123
CSEG LCDWriteChar 00000168
CSEG Bin2ASCII 0000012a
CSEG B2A_1 00000134
CSEG B2A_3 0000013b
CSEG B2A_2 00000139
CSEG div10 00000186
CSEG LCDClrLine_1 0000014f
CSEG LCDWriteLine_1 00000155
CSEG LCDWriteData 00000171
CSEG LCDWC_L1 00000160
CSEG LCDW_L1 0000017f
CSEG LCDW_L2 00000180
CSEG div10_1 000001a5
CSEG div10_2 000001aa

View File

@@ -0,0 +1,69 @@
<ASSEMBLER_INFO>
<VERSION>2.2.7</VERSION>
<DEVICE>"ATmega128"</DEVICE>
<WORKING_DIR>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Debug</WORKING_DIR>
<INCLUDE_PATH>
<DIR>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc</DIR>
<DIR>C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\Include</DIR>
<DIR></DIR>
</INCLUDE_PATH>
<SOURCE_FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</SOURCE_FILE>
<INCLUDED_FILES>
<FILE>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc\m128def.inc</FILE>
<FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE>
</INCLUDED_FILES>
<OBJECT_FILES>
<FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Debug\Corwin_Perren_Lab4_challengecode.obj</FILE>
</OBJECT_FILES>
<HEX_FILES>
<FILE>Corwin_Perren_Lab4_challengecode.hex</FILE>
</HEX_FILES>
<OUTPUT_FILES>
<FILE>Corwin_Perren_Lab4_challengecode.map</FILE>
<FILE>Corwin_Perren_Lab4_challengecode.lss</FILE>
</OUTPUT_FILES>
<LABELS>
<INIT><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</FILE><LINE>49</LINE></INIT>
<LCDInit><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>75</LINE></LCDInit>
<STRING_BEG><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</FILE><LINE>186</LINE></STRING_BEG>
<INIT_MEMCOPYLOOP><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</FILE><LINE>68</LINE></INIT_MEMCOPYLOOP>
<MAIN><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</FILE><LINE>85</LINE></MAIN>
<LCDWrite><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>170</LINE></LCDWrite>
<AVRWait><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</FILE><LINE>159</LINE></AVRWait>
<ROTATE_TEXT><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</FILE><LINE>106</LINE></ROTATE_TEXT>
<ROTATE_TEXT_LOOP><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</FILE><LINE>125</LINE></ROTATE_TEXT_LOOP>
<Loop><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</FILE><LINE>164</LINE></Loop>
<OLoop><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</FILE><LINE>165</LINE></OLoop>
<ILoop><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</FILE><LINE>166</LINE></ILoop>
<STRING_END><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode.asm</FILE><LINE>188</LINE></STRING_END>
<LCDINIT_L1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>139</LINE></LCDINIT_L1>
<LCDWait><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>492</LINE></LCDWait>
<LCDWriteCmd><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>436</LINE></LCDWriteCmd>
<LCDClr><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>230</LINE></LCDClr>
<LCDWrLn1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>180</LINE></LCDWrLn1>
<LCDWrLn2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>205</LINE></LCDWrLn2>
<LCDSetLine><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>388</LINE></LCDSetLine>
<LCDWriteLine><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>423</LINE></LCDWriteLine>
<LCDClrLn1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>240</LINE></LCDClrLn1>
<LCDClrLn2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>265</LINE></LCDClrLn2>
<LCDClrLine><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>404</LINE></LCDClrLine>
<LCDWriteByte><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>302</LINE></LCDWriteByte>
<LCDWriteByte_3><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>323</LINE></LCDWriteByte_3>
<LCDWriteByte_1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>313</LINE></LCDWriteByte_1>
<LCDWriteByte_2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>318</LINE></LCDWriteByte_2>
<LCDWriteChar><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>457</LINE></LCDWriteChar>
<Bin2ASCII><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>339</LINE></Bin2ASCII>
<B2A_1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>352</LINE></B2A_1>
<B2A_3><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>360</LINE></B2A_3>
<B2A_2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>357</LINE></B2A_2>
<div10><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>515</LINE></div10>
<LCDClrLine_1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>407</LINE></LCDClrLine_1>
<LCDWriteLine_1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>425</LINE></LCDWriteLine_1>
<LCDWriteData><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>472</LINE></LCDWriteData>
<LCDWC_L1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>443</LINE></LCDWC_L1>
<LCDW_L1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>493</LINE></LCDW_L1>
<LCDW_L2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>494</LINE></LCDW_L2>
<div10_1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>554</LINE></div10_1>
<div10_2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_challengecode\Corwin_Perren_Lab4_challengecode\LCDDriver.asm</FILE><LINE>560</LINE></div10_2>
</LABELS>
</ASSEMBLER_INFO>

View File

@@ -0,0 +1,561 @@
;***********************************************************
;*
;* LCDDriver.asm - V2.0
;*
;* Contains the neccessary functions to display text to a
;* 2 x 16 character LCD Display. Additional functions
;* include a conversion routine from an unsigned 8-bit
;* binary number to and ASCII text string.
;*
;* Version 2.0 - Added support for accessing the LCD
;* Display via the serial port. See version 1.0 for
;* accessing a memory mapped LCD display.
;*
;***********************************************************
;*
;* Author: David Zier
;* Date: March 17, 2003
;* Company: TekBots(TM), Oregon State University - EECS
;* Version: 2.0
;*
;***********************************************************
;* Rev Date Name Description
;*----------------------------------------------------------
;* - 8/20/02 Zier Initial Creation of Version 1.0
;* A 3/7/03 Zier V2.0 - Updated for USART LCD
;*
;*
;***********************************************************
;***********************************************************
;* Internal Register Definitions and Constants
;* NOTE: A register MUST be named 'mpr' in the Main Code
;* It is recomended to use register r16.
;* WARNING: Register r17-r22 are reserved and cannot be
;* renamed outside of the LCD Driver functions. Doing
;* so will damage the functionality of the LCD Driver
;***********************************************************
.def wait = r17 ; Wait Loop Register
.def count = r18 ; Character Counter
.def line = r19 ; Line Select Register
.def type = r20 ; LCD data type: Command or Text
.def q = r21 ; Quotient for div10
.def r = r22 ; Remander for div10
.equ LCDLine1 = $80 ; LCD Line 1 select command
.equ LCDLine2 = $c0 ; LCD Line 2 select command
.equ LCDClear = $01 ; LCD Clear Command
.equ LCDHome = $02 ; LCD Set Cursor Home Command
.equ LCDPulse = $08 ; LCD Pulse signal, used to simulate
; write signal
.equ LCDCmd = $00 ; Constant used to write a command
.equ LCDTxt = $01 ; Constant used to write a text character
.equ LCDMaxCnt = 16 ; Maximum number of characters per line
.equ LCDLn1Addr = $0100 ; Beginning address for Line 1 data
.equ LCDLn2Addr = $0110 ; Beginning address for Line 2 data
;-----------------------------------------------------------
;***********************************************************
;* Public LCD Driver Suboutines and Functions
;* These functions and subroutines can be called safely
;* from within any program
;***********************************************************
;-----------------------------------------------------------
;*******************************************************
;* SubRt: LCDInit
;* Desc: Initialize the Serial Port and the Hitachi
;* Display 8 Bit inc DD-RAM
;* Pointer with no features
;* - 2 LInes with 16 characters
;*******************************************************
LCDInit:
push mpr ; Save the state of machine
in mpr, SREG ; Save the SREG
push mpr ;
push wait ; Save wait
; Setup the Communication Ports
; Port B: Output
; Port D: Input w/ internal pullup resistors
; Port F: Output on Pin 3
ldi mpr, $00 ; Initialize Port B for outputs
out PORTB, mpr ; Port B outputs high
ldi mpr, $ff ; except for any overrides
out DDRB, mpr ;
ldi mpr, $00 ; Initialize Port D for inputs
out PORTD, mpr ; with Tri-State
ldi mpr, $00 ; except for any overrides
out DDRD, mpr ;
ldi mpr, $00 ; Initialize Port F Pin 3 to
sts PORTF, mpr ; output inorder to twiddle the
ldi mpr, (1<<DDF3) ; LCD interface
sts DDRF, mpr ; Must NOT override this port
; Setup the Serial Functionality
; SPI Type: Master
; SPI Clock Rate: 2*1000.000 kHz
; SPI Clock Phase: Cycle Half
; SPI Clock Polarity: Low
; SPI Data Order: MSB First
ldi mpr, (1<<SPE|1<<MSTR)
out SPCR, mpr ; Set Serial Port Control Register
ldi mpr, (1<<SPI2X)
out SPSR, mpr ; Set Serial Port Status Register
; Setup External SRAM configuration
; $0460 - $7FFF / $8000 - $FFFF
; Lower page wait state(s): None
; Uppoer page wait state(s): 2r/w
ldi mpr, (1<<SRE) ;
out MCUCR, mpr ; Initialize MCUCR
ldi mpr, (1<<SRL2|1<<SRW11)
sts XMCRA, mpr ; Initialize XMCRA
ldi mpr, (1<<XMBK) ;
sts XMCRB, mpr ; Initialize XMCRB
; Initialize USART0
; Communication Parameter: 8 bit, 1 stop, No Parity
; USART0 Rx: On
; USART0 Tx: On
; USART0 Mode: Asynchronous
; USART0 Baudrate: 9600
ldi mpr, $00 ;
out UCSR0A, mpr ; Init UCSR0A
ldi mpr, (1<<RXEN0|1<<TXEN0)
out UCSR0B, mpr ; Init UCSR0B
ldi mpr, (1<<UCSZ01|1<<UCSZ00)
sts UCSR0C, mpr ; Init UCSR0C
ldi mpr, $00 ;
sts UBRR0H, mpr ; Init UBRR0H
ldi mpr, $67 ;
out UBRR0L, mpr ; Init UBRR0L
; Initialize the LCD Display
ldi mpr, 6 ;
LCDINIT_L1:
ldi wait, 250 ; 15ms of Display
rcall LCDWait ; Bootup wait
dec mpr ;
brne LCDINIT_L1 ;
ldi mpr, $38 ; Display Mode set
rcall LCDWriteCmd ;
ldi mpr, $08 ; Display Off
rcall LCDWriteCmd ;
ldi mpr, $01 ; Display Clear
rcall LCDWriteCmd ;
ldi mpr, $06 ; Entry mode set
rcall LCDWriteCmd ;
ldi mpr, $0c ; Display on
rcall LCDWriteCmd ;
rcall LCDClr ; Clear display
pop wait ; Restore wait
pop mpr ; Restore SREG
out SREG, mpr ;
pop mpr ; Restore mpr
ret ; Return from subroutine
;*******************************************************
;* Func: LCDWrite
;* Desc: Generic Write Function that writes both lines
;* of text out to the LCD
;* - Line 1 data is in address space $0100-$010F
;* - Line 2 data is in address space $0110-$010F
;*******************************************************
LCDWrite:
rcall LCDWrLn1 ; Write Line 1
rcall LCDWrLn2 ; Write Line 2
ret ; Return from function
;*******************************************************
;* Func: LCDWrLn1
;* Desc: This function will write the first line of
;* data to the first line of the LCD Display
;*******************************************************
LCDWrLn1:
push mpr ; Save mpr
push ZL ; Save Z pointer
push ZH ;
push count ; Save the count register
push line ; Save the line register
ldi ZL, low(LCDLn1Addr)
ldi ZH, high(LCDLn1Addr)
ldi line, LCDLine1 ; Set LCD line to Line 1
rcall LCDSetLine ; Restart at the beginning of line 1
rcall LCDWriteLine ; Write the line of text
pop line
pop count ; Restore the counter
pop ZH ; Restore Z pointer
pop ZL ;
pop mpr ; Restore mpr
ret ; Return from function
;*******************************************************
;* Func: LCDWrLn2
;* Desc: This function will write the second line of
;* data to the second line of the LCD Display
;*******************************************************
LCDWrLn2:
push mpr ; Save mpr
push ZL ; Save Z pointer
push ZH ;
push count ; Save the count register
push line ; Save the line register
ldi ZL, low(LCDLn2Addr)
ldi ZH, high(LCDLn2Addr)
ldi line, LCDLine2 ; Set LCD line to Line 2
rcall LCDSetLine ; Restart at the beginning of line 2
rcall LCDWriteLine ; Write the line of text
pop line
pop count ; Restore the counter
pop ZH ; Restore Z pointer
pop ZL ;
pop mpr ; Restore mpr
ret ; Return from function
;*******************************************************
;* Func: LCDClr
;* Desc: Generic Clear Subroutine that clears both
;* lines of the LCD and Data Memory storage area
;*******************************************************
LCDClr:
rcall LCDClrLn1 ; Clear Line 1
rcall LCDClrLn2 ; Clear Line 2
ret ; Return from Subroutine
;*******************************************************
;* Func: LCDClrLn1
;* Desc: This subroutine will clear the first line of
;* the data and the first line of the LCD Display
;*******************************************************
LCDClrLn1:
push mpr ; Save mpr
push line ; Save line register
push count ; Save the count register
push ZL ; Save Z pointer
push ZH ;
ldi line, LCDline1 ; Set Access to Line 1 of LCD
rcall LCDSetLine ; Set Z pointer to address of line 1 data
ldi ZL, low(LCDLn1Addr)
ldi ZH, high(LCDLn1Addr)
rcall LCDClrLine ; Call the Clear Line function
pop ZH ; Restore Z pointer
pop ZL ;
pop count ; Restore the count register
pop line ; Restore line register
pop mpr ; Restore mpr
ret ; Return from Subroutine
;*******************************************************
;* Func: LCDClrLn2
;* Desc: This subroutine will clear the second line of
;* the data and the second line of the LCD Display
;*******************************************************
LCDClrLn2:
push mpr ; Save mpr
push line ; Save line register
push count ; Save the count register
push ZL ; Save Z pointer
push ZH ;
ldi line, LCDline2 ; Set Access to Line 2 of LCD
rcall LCDSetLine ; Set Z pointer to address of line 2 data
ldi ZL, low(LCDLn2Addr)
ldi ZH, high(LCDLn2Addr)
rcall LCDClrLine ; Call the Clear Line function
pop ZH ; Restore Z pointer
pop ZL ;
pop count ; Restore the count register
pop line ; Restore line register
pop mpr ; Restore mpr
ret ; Return from Subroutine
;*******************************************************
;* Func: LCDWriteByte
;* Desc: This is a complex and low level function that
;* allows any program to write any ASCII character
;* (Byte) anywhere in the LCD Display. There
;* are several things that need to be initialized
;* before this function is called:
;* count - Holds the index value of the line to where
;* the char is written, 0-15(39). i.e. if
;* count has the value of 3, then the char is
;* going to be written to the third element of
;* the line.
;* line - Holds the line number that the char is going
;* to be written to, (1 or 2).
;* mpr - Contains the value of the ASCII character to
;* be written (0-255)
;*********************************************************
LCDWriteByte:
push mpr ; Save the mpr
push line ; Save the line
push count ; Save the count
; Preform sanity checks on count and line
cpi count, 40 ; Make sure count is within range
brsh LCDWriteByte_3 ; Do nothing and exit function
cpi line, 1 ; If (line == 1)
brne LCDWriteByte_1 ;
ldi line, LCDLine1 ; Load line 1 base LCD Address
rjmp LCDWriteByte_2 ; Continue on with function
LCDWriteByte_1:
cpi line, 2 ; If (line == 2)
brne LCDWriteByte_3 ; Do nothing and exit function
ldi line, LCDLine2 ; Load line 2 base LCD Address
LCDWriteByte_2: ; Write char to LCD
add line, count ; Set the correct LCD address
rcall LCDSetLine ; Set the line address to LCD
rcall LCDWriteChar ; Write Char to LCD Display
LCDWriteByte_3: ; Exit Function
pop count ; Restore the count
pop line ; Restore the line
pop mpr ; Restore the mpr
ret ; Return from function
;*******************************************************
;* Func: Bin2ASCII
;* Desc: Converts a binary number into an ASCII
;* text string equivalent.
;* - The binary number needs to be in the mpr
;* - The Start Address of where the text will
;* be placed needs to be in the X Register
;* - The count of the characters created are
;* added to the count register
;*******************************************************
Bin2ASCII:
push mpr ; save mpr
push r ; save r
push q ; save q
push XH ; save X-pointer
push XL ;
; Determine the range of mpr
cpi mpr, 100 ; is mpr >= 100
brlo B2A_1 ; goto next check
ldi count, 3 ; Three chars are written
adiw XL, 3 ; Increment X 3 address spaces
rjmp B2A_3 ; Continue with program
B2A_1: cpi mpr, 10 ; is mpr >= 10
brlo B2A_2 ; Continue with program
ldi count, 2 ; Two chars are written
adiw XL, 2 ; Increment X 2 address spaces
rjmp B2A_3 ; Continue with program
B2A_2: adiw XL, 1 ; Increment X 1 address space
ldi count, 1 ; One char is written
B2A_3: ;Do-While statement that converts Binary to ASCII
rcall div10 ; Call the div10 function
ldi mpr, '0' ; Set the base ASCII integer value
add mpr, r ; Create the ASCII integer value
st -X, mpr ; Load ASCII value to memory
mov mpr, q ; Set mpr to quotiant value
cpi mpr, 0 ; does mpr == 0
brne B2A_3 ; do while (mpr != 0)
pop XL ; restore X-pointer
pop XH ;
pop q ; restore q
pop r ; restore r
pop mpr ; restore mpr
ret ; return from function
;-------------------------------------------------------
;*******************************************************
;* Private LCD Driver Functions and Subroutines
;* NOTE: It is not recommended to call these functions
;* or subroutines, only call the Public ones.
;*******************************************************
;-------------------------------------------------------
;*******************************************************
;* Func: LCDSetLine
;* Desc: Change line to be written to
;*******************************************************
LCDSetLine:
push mpr ; Save mpr
mov mpr,line ; Copy Command Data to mpr
rcall LCDWriteCmd ; Write the Command
pop mpr ; Restore the mpr
ret ; Return from function
;*******************************************************
;* Func: LCDClrLine
;* Desc: Manually clears a single line within an LCD
;* Display and Data Memory by writing 16
;* consecutive ASCII spaces $20 to both the LCD
;* and the memory. The line to be cleared must
;* first be set in the LCD and the Z pointer is
;* pointing the first element in Data Memory
;*******************************************************
LCDClrLine:
ldi mpr, ' ' ; The space char to be written
ldi count, LCDMaxCnt; The character count
LCDClrLine_1:
st Z+, mpr ; Clear data memory element
rcall LCDWriteChar ; Clear LCD memory element
dec count ; Decrement the count
brne LCDClrLine_1 ; Continue untill all elements are cleared
ret ; Return from function
;*******************************************************
;* Func: LCDWriteLine
;* Desc: Writes a line of text to the LCD Display.
;* This routine takes a data element pointed to
;* by the Z-pointer and copies it to the LCD
;* Display for the duration of the line. The
;* line the Z-pointer must be set prior to the
;* function call.
;*******************************************************
LCDWriteLine:
ldi count, LCDMaxCnt; The character count
LCDWriteLine_1:
ld mpr, Z+ ; Get the data element
rcall LCDWriteChar ; Write element to LCD Display
dec count ; Decrement the count
brne LCDWriteLine_1 ; Continue untill all elements are written
ret ; Return from function
;*******************************************************
;* Func: LCDWriteCmd
;* Desc: Write command that is in the mpr to LCD
;*******************************************************
LCDWriteCmd:
push type ; Save type register
push wait ; Save wait register
ldi type, LCDCmd ; Set type to Command data
rcall LCDWriteData ; Write data to LCD
push mpr ; Save mpr register
ldi mpr, 2 ; Wait approx. 4.1 ms
LCDWC_L1:
ldi wait, 205 ; Wait 2050 us
rcall LCDWait ;
dec mpr ; The wait loop cont.
brne LCDWC_L1 ;
pop mpr ; Restore mpr
pop wait ; Restore wait register
pop type ; Restore type register
ret ; Return from function
;*******************************************************
;* Func: LCDWriteChar
;* Desc: Write character data that is in the mpr
;*******************************************************
LCDWriteChar:
push type ; Save type register
push wait ; Save the wait register
ldi type, LCDTxt ; Set type to Text data
rcall LCDWriteData ; Write data to LCD
ldi wait, 16 ; Delay 160 us
rcall LCDWait ;
pop wait ; Restore wait register
pop type ; Restore type register
ret ; Return from function
;*******************************************************
;* Func: LCDWriteData
;* Desc: Write data or command to LCD
;*******************************************************
LCDWriteData:
out SPDR, type ; Send type to SP
ldi wait, 2 ; Wait 2 us
rcall LCDWait ; Call Wait function
out SPDR,mpr ; Send data to serial port
ldi wait, 2 ; Wait 2 us
rcall LCDWait ; Call Wait function
ldi wait, LCDPulse ; Use wait temporarially to
sts PORTF, wait ; to send write pulse to LCD
ldi wait, $00 ;
sts PORTF, wait ;
ret ; Return from function
;*******************************************************
;* Func: LCDWait
;* Desc: A wait loop that is 10 + 159*wait cycles or
;* roughly wait*10us. Just initialize wait
;* for the specific amount of time in 10us
;* intervals.
;*******************************************************
LCDWait:push mpr ; Save mpr
LCDW_L1:ldi mpr, $49 ; Load with a 10us value
LCDW_L2:dec mpr ; Inner Wait Loop
brne LCDW_L2
dec wait ; Outer Wait Loop
brne LCDW_L1
pop mpr ; Restore mpr
ret ; Return from Wait Function
;*******************************************************
;* Bin2ASCII routines that can be used as a psuedo-
;* printf function to convert an 8-bit binary
;* number into the unigned decimal ASCII text
;*******************************************************
;***********************************************************
;* Func: div10
;* Desc: Divides the value in the mpr by 10 and
;* puts the remander in the 'r' register and
;* and the quotiant in the 'q' register.
;* DO NOT modify this function, trust me, it does
;* divide by 10 :) ~DZ
;***********************************************************
div10:
push r0 ; Save register
; q = mpr / 10 = mpr * 0.000110011001101b
mov q, mpr ; q = mpr * 1.0b
lsr q ; q >> 2
lsr q ; q = mpr * 0.01b
add q, mpr ; q = (q + mpr) >> 1
lsr q ; q = mpr * 0.101b
add q, mpr ; q = (q + mpr) >> 3
lsr q
lsr q
lsr q ; q = mpr * 0.001101b
add q, mpr ; q = (q + mpr) >> 1
lsr q ; q = mpr * 0.1001101b
add q, mpr ; q = (q + mpr) >> 3
lsr q
lsr q
lsr q ; q = mpr * 0.0011001101b
add q, mpr ; q = (q + mpr) >> 1
lsr q ; q = mpr * 0.10011001101b
add q, mpr ; q = (q + mpr) >> 4
lsr q
lsr q
lsr q
lsr q ; q = mpr * 0.000110011001101b
; compute the remainder as r = i - 10 * q
; calculate r = q * 10 = q * 1010b
mov r, q ; r = q * 1
lsl r ; r << 2
lsl r ; r = q * 100b
add r, q ; r = (r + q) << 1
lsl r ; r = q * 1010b
mov r0, r ; r0 = 10 * q
mov r, mpr ; r = mpr
sub r, r0 ; r = mpr - 10 * q
; Fix any errors that occur
div10_1:cpi r, 10 ; Compare with 10
brlo div10_2 ; do nothing if r < 10
inc q ; fix qoutient
subi r, 10 ; fix remainder
rjmp div10_1 ; Continue until error is corrected
div10_2:pop r0 ; Restore registers
ret ; Return from function

View File

@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Atmel Studio Solution File, Format Version 11.00
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{18226A42-8477-4023-8AD2-40C49DA407C9}") = "Corwin_Perren_Lab4_sourcecode", "Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asmproj", "{59B1D629-9DCC-43ED-A0FD-8AB0E4D622AB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AVR = Debug|AVR
Release|AVR = Release|AVR
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{59B1D629-9DCC-43ED-A0FD-8AB0E4D622AB}.Debug|AVR.ActiveCfg = Debug|AVR
{59B1D629-9DCC-43ED-A0FD-8AB0E4D622AB}.Debug|AVR.Build.0 = Debug|AVR
{59B1D629-9DCC-43ED-A0FD-8AB0E4D622AB}.Release|AVR.ActiveCfg = Release|AVR
{59B1D629-9DCC-43ED-A0FD-8AB0E4D622AB}.Release|AVR.Build.0 = Release|AVR
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,108 @@
;***********************************************************
;*
;* Corwin_Perren_Lab4_sourcecode.asm
;*
;* This program loads a two line string from program memory
;* into data memory, then shows it on an LCD
;*
;* This is the skeleton file for Lab 4 of ECE 375
;*
;***********************************************************
;*
;* Author: Corwin Perren
;* Date: 10/17/2018
;*
;***********************************************************
.include "m128def.inc" ; Include definition file
;***********************************************************
;* Internal Register Definitions and Constants
;***********************************************************
.def mpr = r16 ; Multipurpose register is required for LCD Driver
.def dataloopcountreg = r23
.equ datamemstart = 0x0100
.equ stringlen = 32
;***********************************************************
;* Start of Code Segment
;***********************************************************
.cseg ; Beginning of code segment
;***********************************************************
;* Interrupt Vectors
;***********************************************************
.org $0000 ; Beginning of IVs
rjmp INIT ; Reset interrupt
.org $0046 ; End of Interrupt Vectors
;***********************************************************
;* Program Initialization
;***********************************************************
INIT: ; The initialization routine
; Initialize Stack Pointer
ldi mpr, low(RAMEND) ; Load the low and high bytes of ram end to the
; stack pointer
out SPL, mpr
ldi mpr, high(RAMEND)
out SPH, mpr
; Initialize LCD Display
rcall LCDInit ; Call the lcd init function
; Move strings from Program Memory to Data Memory
ldi ZL, low(STRING_BEG << 1) ; Low byte of first byte in string into ZL
ldi ZH, high(STRING_BEG << 1) ; High byte of first byte in string into ZH
ldi YL, low(datamemstart) ; Low byte of data memory start into YL
ldi YH, high(datamemstart) ; High byte of data memory start into YH
ldi dataloopcountreg, stringlen ; Initialize count for loop to string length
INIT_MEMCOPYLOOP: ; Loop to read data from progmem to datamem
lpm mpr, Z+ ; Get byte from address pointed to be Z,
; store in reg, move to next byte
st Y+, mpr ; Store byte from reg into data mem address
; pointed to by Y, then move Y to next open spot
dec dataloopcountreg ; Decrement count as we're done with byte
brne INIT_MEMCOPYLOOP ; If we haven't read in the whole string, loop again
; NOTE that there is no RET or RJMP from INIT, this
; is because the next instruction executed is the
; first instruction of the main program
;***********************************************************
;* Main Program
;***********************************************************
MAIN: ; The Main program
; Display the strings on the LCD Display
rcall LCDWrite ; This writes the data mem to the display, based on
; fixed mem addresses in LCDDriver.asm
rjmp MAIN ; jump back to main and create an infinite
; while loop. Generally, every main program is an
; infinite while loop, never let the main program
; just run off
;***********************************************************
;* Stored Program Data
;***********************************************************
;-----------------------------------------------------------
; An example of storing a string. Note the labels before and
; after the .DB directive; these can help to access the data
;-----------------------------------------------------------
STRING_BEG:
.DB " Corwin Perren Hello World! " ; Declaring data in ProgMem
STRING_END:
;***********************************************************
;* Additional Program Includes
;***********************************************************
.include "LCDDriver.asm" ; Include the LCD Driver

View File

@@ -0,0 +1,91 @@
<?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>ATmega128</avrdevice>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.obj</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<Language>ASSEMBLY</Language>
<AssemblyName>Corwin_Perren_Lab4_sourcecode</AssemblyName>
<Name>Corwin_Perren_Lab4_sourcecode</Name>
<RootNamespace>Corwin_Perren_Lab4_sourcecode</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<EntryFile>$(MSBuildProjectDirectory)\Corwin_Perren_Lab4_sourcecode.asm</EntryFile>
<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>
<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.40.0" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
<avrtool>com.atmel.avrdbg.tool.simulator</avrtool>
<avrtoolserialnumber />
<avrdeviceexpectedsignature>0x1E9702</avrdeviceexpectedsignature>
<com_atmel_avrdbg_tool_simulator>
<ToolOptions xmlns="">
<InterfaceProperties>
</InterfaceProperties>
</ToolOptions>
<ToolType xmlns="">com.atmel.avrdbg.tool.simulator</ToolType>
<ToolNumber xmlns="">
</ToolNumber>
<ToolName xmlns="">Simulator</ToolName>
</com_atmel_avrdbg_tool_simulator>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrAssembler>
<avrasm.assembler.general.AdditionalIncludeDirectories>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\avrasm\inc</Value>
</ListValues>
</avrasm.assembler.general.AdditionalIncludeDirectories>
<avrasm.assembler.general.IncludeFile>m128def.inc</avrasm.assembler.general.IncludeFile>
</AvrAssembler>
</ToolchainSettings>
<OutputType>Executable</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrAssembler>
<avrasm.assembler.general.AdditionalIncludeDirectories>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\avrasm\inc</Value>
</ListValues>
</avrasm.assembler.general.AdditionalIncludeDirectories>
<avrasm.assembler.general.IncludeFile>m128def.inc</avrasm.assembler.general.IncludeFile>
</AvrAssembler>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="Corwin_Perren_Lab4_sourcecode.asm">
<SubType>Code</SubType>
</Compile>
<Compile Include="LCDDriver.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.209\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.209\avrasm\inc\m128def.inc</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>AVRASM</Condition>
<FileContentHash>bd3TUV9UtxpdYQkn+6MWPA==</FileContentHash>
<FileVersion></FileVersion>
<Name>avrasm/inc/m128def.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.209\avrasm\templates\main.asm</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>AVRASM</Condition>
<FileContentHash>pYQtEYjLcSjMDsRgadVFow==</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.209/Atmel.ATmega_DFP.pdsc</PackPath>
<PackVersion>1.2.209</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,42 @@
:020000020000FC
:0200000045C0F9
:10008C001BD0E4EAF0E0C0E0D1E070E20591099306
:10009C007A95E1F750D0FECF20436F7277696E20CE
:1000AC0050657272656E2020202048656C6C6F2044
:1000BC00576F726C642120200F930FB70F931F930F
:1000CC0000E008BB0FEF07BB00E002BB00E001BB88
:1000DC0000E00093620008E00093610000E50DB9B8
:1000EC0001E00EB900E805BF02E400936D0000E8E2
:1000FC0000936C0000E00BB908E10AB906E000932C
:10010C00950000E00093900007E609B906E01AEFAD
:10011C00BFD00A95E1F708E397D008E095D001E04D
:10012C0093D006E091D00CE08FD028D01F910F9186
:10013C000FBF0F91089502D011D008950F93EF9334
:10014C00FF932F933F93E0E0F1E030E86BD076D053
:10015C003F912F91FF91EF910F9108950F93EF9392
:10016C00FF932F933F93E0E1F1E030EC5BD066D04E
:10017C003F912F91FF91EF910F91089502D011D0E3
:10018C0008950F933F932F93EF93FF9330E84AD04A
:10019C00E0E0F1E04CD0FF91EF912F913F910F9166
:1001AC0008950F933F932F93EF93FF9330EC3AD036
:1001BC00E0E1F1E03CD0FF91EF912F913F910F9155
:1001CC0008950F933F932F93283250F4313011F44C
:1001DC0030E803C0323021F430EC320F23D042D05F
:1001EC002F913F910F9108950F936F935F93BF934E
:1001FC00AF93043618F023E0139607C00A3018F0BA
:10020C0022E0129602C0119621E04AD000E3060FBC
:10021C000E93052F0030C9F7AF91BF915F916F918D
:10022C000F9108950F93032F0FD00F91089500E2B3
:10023C0020E1019317D02A95E1F7089520E101916F
:10024C0011D02A95E1F708954F931F9340E013D0F6
:10025C000F9302E01DEC1CD00A95E1F70F911F9152
:10026C004F9108954F931F9341E005D010E110D0AA
:10027C001F914F9108954FB912E00AD00FB912E0B7
:10028C0007D018E01093620010E0109362000895FC
:10029C000F9309E40A95F1F71A95D9F70F91089580
:1002AC000F92502F56955695500F5695500F5695B8
:1002BC0056955695500F5695500F569556955695F2
:1002CC00500F5695500F5695569556955695652F39
:1002DC00660F660F650F660F062E602F60196A3069
:0C02EC0018F053956A50FBCF0F90089556
:00000001FF

View File

@@ -0,0 +1,925 @@
AVRASM ver. 2.2.7 C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm Tue Oct 23 20:41:05 2018
EQU SIGNATURE_000 0000001e
EQU SIGNATURE_001 00000097
EQU SIGNATURE_002 00000002
EQU UCSR1C 0000009d
EQU UDR1 0000009c
EQU UCSR1A 0000009b
EQU UCSR1B 0000009a
EQU UBRR1H 00000098
EQU UBRR1L 00000099
EQU UCSR0C 00000095
EQU UBRR0H 00000090
EQU TCCR3C 0000008c
EQU TCCR3A 0000008b
EQU TCCR3B 0000008a
EQU TCNT3L 00000088
EQU TCNT3H 00000089
EQU OCR3AL 00000086
EQU OCR3AH 00000087
EQU OCR3BL 00000084
EQU OCR3BH 00000085
EQU OCR3CL 00000082
EQU OCR3CH 00000083
EQU ICR3L 00000080
EQU ICR3H 00000081
EQU ETIMSK 0000007d
EQU ETIFR 0000007c
EQU TCCR1C 0000007a
EQU OCR1CL 00000078
EQU OCR1CH 00000079
EQU TWCR 00000074
EQU TWDR 00000073
EQU TWAR 00000072
EQU TWSR 00000071
EQU TWBR 00000070
EQU OSCCAL 0000006f
EQU XMCRA 0000006d
EQU XMCRB 0000006c
EQU EICRA 0000006a
EQU SPMCSR 00000068
EQU PORTG 00000065
EQU DDRG 00000064
EQU PING 00000063
EQU PORTF 00000062
EQU DDRF 00000061
EQU SREG 0000003f
EQU SPL 0000003d
EQU SPH 0000003e
EQU XDIV 0000003c
EQU RAMPZ 0000003b
EQU EICRB 0000003a
EQU EIMSK 00000039
EQU EIFR 00000038
EQU TIMSK 00000037
EQU TIFR 00000036
EQU MCUCR 00000035
EQU MCUCSR 00000034
EQU TCCR0 00000033
EQU TCNT0 00000032
EQU OCR0 00000031
EQU ASSR 00000030
EQU TCCR1A 0000002f
EQU TCCR1B 0000002e
EQU TCNT1L 0000002c
EQU TCNT1H 0000002d
EQU OCR1AL 0000002a
EQU OCR1AH 0000002b
EQU OCR1BL 00000028
EQU OCR1BH 00000029
EQU ICR1L 00000026
EQU ICR1H 00000027
EQU TCCR2 00000025
EQU TCNT2 00000024
EQU OCR2 00000023
EQU OCDR 00000022
EQU WDTCR 00000021
EQU SFIOR 00000020
EQU EEARL 0000001e
EQU EEARH 0000001f
EQU EEDR 0000001d
EQU EECR 0000001c
EQU PORTA 0000001b
EQU DDRA 0000001a
EQU PINA 00000019
EQU PORTB 00000018
EQU DDRB 00000017
EQU PINB 00000016
EQU PORTC 00000015
EQU DDRC 00000014
EQU PINC 00000013
EQU PORTD 00000012
EQU DDRD 00000011
EQU PIND 00000010
EQU SPDR 0000000f
EQU SPSR 0000000e
EQU SPCR 0000000d
EQU UDR0 0000000c
EQU UCSR0A 0000000b
EQU UCSR0B 0000000a
EQU UBRR0L 00000009
EQU ACSR 00000008
EQU ADMUX 00000007
EQU ADCSRA 00000006
EQU ADCH 00000005
EQU ADCL 00000004
EQU PORTE 00000003
EQU DDRE 00000002
EQU PINE 00000001
EQU PINF 00000000
EQU ACME 00000003
EQU ACIS0 00000000
EQU ACIS1 00000001
EQU ACIC 00000002
EQU ACIE 00000003
EQU ACI 00000004
EQU ACO 00000005
EQU ACBG 00000006
EQU ACD 00000007
EQU SPDR0 00000000
EQU SPDR1 00000001
EQU SPDR2 00000002
EQU SPDR3 00000003
EQU SPDR4 00000004
EQU SPDR5 00000005
EQU SPDR6 00000006
EQU SPDR7 00000007
EQU SPI2X 00000000
EQU WCOL 00000006
EQU SPIF 00000007
EQU SPR0 00000000
EQU SPR1 00000001
EQU CPHA 00000002
EQU CPOL 00000003
EQU MSTR 00000004
EQU DORD 00000005
EQU SPE 00000006
EQU SPIE 00000007
EQU I2BR 00000070
EQU TWBR0 00000000
EQU TWBR1 00000001
EQU TWBR2 00000002
EQU TWBR3 00000003
EQU TWBR4 00000004
EQU TWBR5 00000005
EQU TWBR6 00000006
EQU TWBR7 00000007
EQU I2CR 00000074
EQU TWIE 00000000
EQU I2IE 00000000
EQU TWEN 00000002
EQU I2EN 00000002
EQU ENI2C 00000002
EQU TWWC 00000003
EQU I2WC 00000003
EQU TWSTO 00000004
EQU I2STO 00000004
EQU TWSTA 00000005
EQU I2STA 00000005
EQU TWEA 00000006
EQU I2EA 00000006
EQU TWINT 00000007
EQU I2INT 00000007
EQU I2SR 00000071
EQU TWPS0 00000000
EQU TWS0 00000000
EQU I2GCE 00000000
EQU TWPS1 00000001
EQU TWS1 00000001
EQU TWS3 00000003
EQU I2S3 00000003
EQU TWS4 00000004
EQU I2S4 00000004
EQU TWS5 00000005
EQU I2S5 00000005
EQU TWS6 00000006
EQU I2S6 00000006
EQU TWS7 00000007
EQU I2S7 00000007
EQU I2DR 00000073
EQU TWD0 00000000
EQU TWD1 00000001
EQU TWD2 00000002
EQU TWD3 00000003
EQU TWD4 00000004
EQU TWD5 00000005
EQU TWD6 00000006
EQU TWD7 00000007
EQU I2AR 00000072
EQU TWGCE 00000000
EQU TWA0 00000001
EQU TWA1 00000002
EQU TWA2 00000003
EQU TWA3 00000004
EQU TWA4 00000005
EQU TWA5 00000006
EQU TWA6 00000007
EQU UDR00 00000000
EQU UDR01 00000001
EQU UDR02 00000002
EQU UDR03 00000003
EQU UDR04 00000004
EQU UDR05 00000005
EQU UDR06 00000006
EQU UDR07 00000007
EQU MPCM0 00000000
EQU U2X0 00000001
EQU UPE0 00000002
EQU DOR0 00000003
EQU FE0 00000004
EQU UDRE0 00000005
EQU TXC0 00000006
EQU RXC0 00000007
EQU TXB80 00000000
EQU RXB80 00000001
EQU UCSZ02 00000002
EQU UCSZ2 00000002
EQU TXEN0 00000003
EQU RXEN0 00000004
EQU UDRIE0 00000005
EQU TXCIE0 00000006
EQU RXCIE0 00000007
EQU UCPOL0 00000000
EQU UCSZ00 00000001
EQU UCSZ01 00000002
EQU USBS0 00000003
EQU UPM00 00000004
EQU UPM01 00000005
EQU UMSEL0 00000006
EQU UBRR8 00000000
EQU UBRR9 00000001
EQU UBRR10 00000002
EQU UBRR11 00000003
EQU UBRR0 00000000
EQU UBRR1 00000001
EQU UBRR2 00000002
EQU UBRR3 00000003
EQU UBRR4 00000004
EQU UBRR5 00000005
EQU UBRR6 00000006
EQU UBRR7 00000007
EQU UDR10 00000000
EQU UDR11 00000001
EQU UDR12 00000002
EQU UDR13 00000003
EQU UDR14 00000004
EQU UDR15 00000005
EQU UDR16 00000006
EQU UDR17 00000007
EQU MPCM1 00000000
EQU U2X1 00000001
EQU UPE1 00000002
EQU DOR1 00000003
EQU FE1 00000004
EQU UDRE1 00000005
EQU TXC1 00000006
EQU RXC1 00000007
EQU TXB81 00000000
EQU RXB81 00000001
EQU UCSZ12 00000002
EQU TXEN1 00000003
EQU RXEN1 00000004
EQU UDRIE1 00000005
EQU TXCIE1 00000006
EQU RXCIE1 00000007
EQU UCPOL1 00000000
EQU UCSZ10 00000001
EQU UCSZ11 00000002
EQU USBS1 00000003
EQU UPM10 00000004
EQU UPM11 00000005
EQU UMSEL1 00000006
EQU SREG_C 00000000
EQU SREG_Z 00000001
EQU SREG_N 00000002
EQU SREG_V 00000003
EQU SREG_S 00000004
EQU SREG_H 00000005
EQU SREG_T 00000006
EQU SREG_I 00000007
EQU IVCE 00000000
EQU IVSEL 00000001
EQU SM2 00000002
EQU SM0 00000003
EQU SM1 00000004
EQU SE 00000005
EQU SRW10 00000006
EQU SRE 00000007
EQU SRW11 00000001
EQU SRW00 00000002
EQU SRW01 00000003
EQU SRL0 00000004
EQU SRL1 00000005
EQU SRL2 00000006
EQU XMM0 00000000
EQU XMM1 00000001
EQU XMM2 00000002
EQU XMBK 00000007
EQU CAL0 00000000
EQU CAL1 00000001
EQU CAL2 00000002
EQU CAL3 00000003
EQU CAL4 00000004
EQU CAL5 00000005
EQU CAL6 00000006
EQU CAL7 00000007
EQU XDIV0 00000000
EQU XDIV1 00000001
EQU XDIV2 00000002
EQU XDIV3 00000003
EQU XDIV4 00000004
EQU XDIV5 00000005
EQU XDIV6 00000006
EQU XDIVEN 00000007
EQU PORF 00000000
EQU EXTRF 00000001
EQU BORF 00000002
EQU WDRF 00000003
EQU JTRF 00000004
EQU JTD 00000007
EQU RAMPZ0 00000000
EQU SPMCR 00000068
EQU SPMEN 00000000
EQU PGERS 00000001
EQU PGWRT 00000002
EQU BLBSET 00000003
EQU RWWSRE 00000004
EQU ASRE 00000004
EQU RWWSB 00000006
EQU ASB 00000006
EQU SPMIE 00000007
EQU OCDR0 00000000
EQU OCDR1 00000001
EQU OCDR2 00000002
EQU OCDR3 00000003
EQU OCDR4 00000004
EQU OCDR5 00000005
EQU OCDR6 00000006
EQU OCDR7 00000007
EQU IDRD 00000007
EQU PSR321 00000000
EQU PSR1 00000000
EQU PSR2 00000000
EQU PSR3 00000000
EQU PSR0 00000001
EQU PUD 00000002
EQU TSM 00000007
EQU ISC00 00000000
EQU ISC01 00000001
EQU ISC10 00000002
EQU ISC11 00000003
EQU ISC20 00000004
EQU ISC21 00000005
EQU ISC30 00000006
EQU ISC31 00000007
EQU ISC40 00000000
EQU ISC41 00000001
EQU ISC50 00000002
EQU ISC51 00000003
EQU ISC60 00000004
EQU ISC61 00000005
EQU ISC70 00000006
EQU ISC71 00000007
EQU GICR 00000039
EQU GIMSK 00000039
EQU INT0 00000000
EQU INT1 00000001
EQU INT2 00000002
EQU INT3 00000003
EQU INT4 00000004
EQU INT5 00000005
EQU INT6 00000006
EQU INT7 00000007
EQU GIFR 00000038
EQU INTF0 00000000
EQU INTF1 00000001
EQU INTF2 00000002
EQU INTF3 00000003
EQU INTF4 00000004
EQU INTF5 00000005
EQU INTF6 00000006
EQU INTF7 00000007
EQU EEDR0 00000000
EQU EEDR1 00000001
EQU EEDR2 00000002
EQU EEDR3 00000003
EQU EEDR4 00000004
EQU EEDR5 00000005
EQU EEDR6 00000006
EQU EEDR7 00000007
EQU EERE 00000000
EQU EEWE 00000001
EQU EEMWE 00000002
EQU EERIE 00000003
EQU PORTA0 00000000
EQU PA0 00000000
EQU PORTA1 00000001
EQU PA1 00000001
EQU PORTA2 00000002
EQU PA2 00000002
EQU PORTA3 00000003
EQU PA3 00000003
EQU PORTA4 00000004
EQU PA4 00000004
EQU PORTA5 00000005
EQU PA5 00000005
EQU PORTA6 00000006
EQU PA6 00000006
EQU PORTA7 00000007
EQU PA7 00000007
EQU DDA0 00000000
EQU DDA1 00000001
EQU DDA2 00000002
EQU DDA3 00000003
EQU DDA4 00000004
EQU DDA5 00000005
EQU DDA6 00000006
EQU DDA7 00000007
EQU PINA0 00000000
EQU PINA1 00000001
EQU PINA2 00000002
EQU PINA3 00000003
EQU PINA4 00000004
EQU PINA5 00000005
EQU PINA6 00000006
EQU PINA7 00000007
EQU PORTB0 00000000
EQU PB0 00000000
EQU PORTB1 00000001
EQU PB1 00000001
EQU PORTB2 00000002
EQU PB2 00000002
EQU PORTB3 00000003
EQU PB3 00000003
EQU PORTB4 00000004
EQU PB4 00000004
EQU PORTB5 00000005
EQU PB5 00000005
EQU PORTB6 00000006
EQU PB6 00000006
EQU PORTB7 00000007
EQU PB7 00000007
EQU DDB0 00000000
EQU DDB1 00000001
EQU DDB2 00000002
EQU DDB3 00000003
EQU DDB4 00000004
EQU DDB5 00000005
EQU DDB6 00000006
EQU DDB7 00000007
EQU PINB0 00000000
EQU PINB1 00000001
EQU PINB2 00000002
EQU PINB3 00000003
EQU PINB4 00000004
EQU PINB5 00000005
EQU PINB6 00000006
EQU PINB7 00000007
EQU PORTC0 00000000
EQU PC0 00000000
EQU PORTC1 00000001
EQU PC1 00000001
EQU PORTC2 00000002
EQU PC2 00000002
EQU PORTC3 00000003
EQU PC3 00000003
EQU PORTC4 00000004
EQU PC4 00000004
EQU PORTC5 00000005
EQU PC5 00000005
EQU PORTC6 00000006
EQU PC6 00000006
EQU PORTC7 00000007
EQU PC7 00000007
EQU DDC0 00000000
EQU DDC1 00000001
EQU DDC2 00000002
EQU DDC3 00000003
EQU DDC4 00000004
EQU DDC5 00000005
EQU DDC6 00000006
EQU DDC7 00000007
EQU PINC0 00000000
EQU PINC1 00000001
EQU PINC2 00000002
EQU PINC3 00000003
EQU PINC4 00000004
EQU PINC5 00000005
EQU PINC6 00000006
EQU PINC7 00000007
EQU PORTD0 00000000
EQU PD0 00000000
EQU PORTD1 00000001
EQU PD1 00000001
EQU PORTD2 00000002
EQU PD2 00000002
EQU PORTD3 00000003
EQU PD3 00000003
EQU PORTD4 00000004
EQU PD4 00000004
EQU PORTD5 00000005
EQU PD5 00000005
EQU PORTD6 00000006
EQU PD6 00000006
EQU PORTD7 00000007
EQU PD7 00000007
EQU DDD0 00000000
EQU DDD1 00000001
EQU DDD2 00000002
EQU DDD3 00000003
EQU DDD4 00000004
EQU DDD5 00000005
EQU DDD6 00000006
EQU DDD7 00000007
EQU PIND0 00000000
EQU PIND1 00000001
EQU PIND2 00000002
EQU PIND3 00000003
EQU PIND4 00000004
EQU PIND5 00000005
EQU PIND6 00000006
EQU PIND7 00000007
EQU PORTE0 00000000
EQU PE0 00000000
EQU PORTE1 00000001
EQU PE1 00000001
EQU PORTE2 00000002
EQU PE2 00000002
EQU PORTE3 00000003
EQU PE3 00000003
EQU PORTE4 00000004
EQU PE4 00000004
EQU PORTE5 00000005
EQU PE5 00000005
EQU PORTE6 00000006
EQU PE6 00000006
EQU PORTE7 00000007
EQU PE7 00000007
EQU DDE0 00000000
EQU DDE1 00000001
EQU DDE2 00000002
EQU DDE3 00000003
EQU DDE4 00000004
EQU DDE5 00000005
EQU DDE6 00000006
EQU DDE7 00000007
EQU PINE0 00000000
EQU PINE1 00000001
EQU PINE2 00000002
EQU PINE3 00000003
EQU PINE4 00000004
EQU PINE5 00000005
EQU PINE6 00000006
EQU PINE7 00000007
EQU PORTF0 00000000
EQU PF0 00000000
EQU PORTF1 00000001
EQU PF1 00000001
EQU PORTF2 00000002
EQU PF2 00000002
EQU PORTF3 00000003
EQU PF3 00000003
EQU PORTF4 00000004
EQU PF4 00000004
EQU PORTF5 00000005
EQU PF5 00000005
EQU PORTF6 00000006
EQU PF6 00000006
EQU PORTF7 00000007
EQU PF7 00000007
EQU DDF0 00000000
EQU DDF1 00000001
EQU DDF2 00000002
EQU DDF3 00000003
EQU DDF4 00000004
EQU DDF5 00000005
EQU DDF6 00000006
EQU DDF7 00000007
EQU PINF0 00000000
EQU PINF1 00000001
EQU PINF2 00000002
EQU PINF3 00000003
EQU PINF4 00000004
EQU PINF5 00000005
EQU PINF6 00000006
EQU PINF7 00000007
EQU PORTG0 00000000
EQU PG0 00000000
EQU PORTG1 00000001
EQU PG1 00000001
EQU PORTG2 00000002
EQU PG2 00000002
EQU PORTG3 00000003
EQU PG3 00000003
EQU PORTG4 00000004
EQU PG4 00000004
EQU DDG0 00000000
EQU DDG1 00000001
EQU DDG2 00000002
EQU DDG3 00000003
EQU DDG4 00000004
EQU PING0 00000000
EQU PING1 00000001
EQU PING2 00000002
EQU PING3 00000003
EQU PING4 00000004
EQU CS00 00000000
EQU CS01 00000001
EQU CS02 00000002
EQU WGM01 00000003
EQU CTC0 00000003
EQU COM00 00000004
EQU COM01 00000005
EQU WGM00 00000006
EQU PWM0 00000006
EQU FOC0 00000007
EQU TCNT0_0 00000000
EQU TCNT0_1 00000001
EQU TCNT0_2 00000002
EQU TCNT0_3 00000003
EQU TCNT0_4 00000004
EQU TCNT0_5 00000005
EQU TCNT0_6 00000006
EQU TCNT0_7 00000007
EQU OCR0_0 00000000
EQU OCR0_1 00000001
EQU OCR0_2 00000002
EQU OCR0_3 00000003
EQU OCR0_4 00000004
EQU OCR0_5 00000005
EQU OCR0_6 00000006
EQU OCR0_7 00000007
EQU TCR0UB 00000000
EQU OCR0UB 00000001
EQU TCN0UB 00000002
EQU AS0 00000003
EQU TOIE0 00000000
EQU OCIE0 00000001
EQU TOV0 00000000
EQU OCF0 00000001
EQU TOIE1 00000002
EQU OCIE1B 00000003
EQU OCIE1A 00000004
EQU TICIE1 00000005
EQU OCIE1C 00000000
EQU TOV1 00000002
EQU OCF1B 00000003
EQU OCF1A 00000004
EQU ICF1 00000005
EQU OCF1C 00000000
EQU WGM10 00000000
EQU PWM10 00000000
EQU WGM11 00000001
EQU PWM11 00000001
EQU COM1C0 00000002
EQU COM1C1 00000003
EQU COM1B0 00000004
EQU COM1B1 00000005
EQU COM1A0 00000006
EQU COM1A1 00000007
EQU CS10 00000000
EQU CS11 00000001
EQU CS12 00000002
EQU WGM12 00000003
EQU CTC10 00000003
EQU WGM13 00000004
EQU CTC11 00000004
EQU ICES1 00000006
EQU ICNC1 00000007
EQU FOC1C 00000005
EQU FOC1B 00000006
EQU FOC1A 00000007
EQU CS20 00000000
EQU CS21 00000001
EQU CS22 00000002
EQU WGM21 00000003
EQU CTC2 00000003
EQU COM20 00000004
EQU COM21 00000005
EQU WGM20 00000006
EQU PWM2 00000006
EQU FOC2 00000007
EQU TCNT2_0 00000000
EQU TCNT2_1 00000001
EQU TCNT2_2 00000002
EQU TCNT2_3 00000003
EQU TCNT2_4 00000004
EQU TCNT2_5 00000005
EQU TCNT2_6 00000006
EQU TCNT2_7 00000007
EQU OCR2_0 00000000
EQU OCR2_1 00000001
EQU OCR2_2 00000002
EQU OCR2_3 00000003
EQU OCR2_4 00000004
EQU OCR2_5 00000005
EQU OCR2_6 00000006
EQU OCR2_7 00000007
EQU TOIE2 00000006
EQU OCIE2 00000007
EQU TOV2 00000006
EQU OCF2 00000007
EQU OCIE3C 00000001
EQU TOIE3 00000002
EQU OCIE3B 00000003
EQU OCIE3A 00000004
EQU TICIE3 00000005
EQU OCF3C 00000001
EQU TOV3 00000002
EQU OCF3B 00000003
EQU OCF3A 00000004
EQU ICF3 00000005
EQU WGM30 00000000
EQU PWM30 00000000
EQU WGM31 00000001
EQU PWM31 00000001
EQU COM3C0 00000002
EQU COM3C1 00000003
EQU COM3B0 00000004
EQU COM3B1 00000005
EQU COM3A0 00000006
EQU COM3A1 00000007
EQU CS30 00000000
EQU CS31 00000001
EQU CS32 00000002
EQU WGM32 00000003
EQU CTC30 00000003
EQU WGM33 00000004
EQU CTC31 00000004
EQU ICES3 00000006
EQU ICNC3 00000007
EQU FOC3C 00000005
EQU FOC3B 00000006
EQU FOC3A 00000007
EQU TCN3L0 00000000
EQU TCN3L1 00000001
EQU TCN3L2 00000002
EQU TCN3L3 00000003
EQU TCN3L4 00000004
EQU TCN3L5 00000005
EQU TCN3L6 00000006
EQU TCN3L7 00000007
EQU WDTCSR 00000021
EQU WDP0 00000000
EQU WDP1 00000001
EQU WDP2 00000002
EQU WDE 00000003
EQU WDCE 00000004
EQU WDTOE 00000004
EQU MUX0 00000000
EQU MUX1 00000001
EQU MUX2 00000002
EQU MUX3 00000003
EQU MUX4 00000004
EQU ADLAR 00000005
EQU REFS0 00000006
EQU REFS1 00000007
EQU ADCSR 00000006
EQU ADPS0 00000000
EQU ADPS1 00000001
EQU ADPS2 00000002
EQU ADIE 00000003
EQU ADIF 00000004
EQU ADFR 00000005
EQU ADSC 00000006
EQU ADEN 00000007
EQU ADCH0 00000000
EQU ADCH1 00000001
EQU ADCH2 00000002
EQU ADCH3 00000003
EQU ADCH4 00000004
EQU ADCH5 00000005
EQU ADCH6 00000006
EQU ADCH7 00000007
EQU ADCL0 00000000
EQU ADCL1 00000001
EQU ADCL2 00000002
EQU ADCL3 00000003
EQU ADCL4 00000004
EQU ADCL5 00000005
EQU ADCL6 00000006
EQU ADCL7 00000007
EQU LB1 00000000
EQU LB2 00000001
EQU BLB01 00000002
EQU BLB02 00000003
EQU BLB11 00000004
EQU BLB12 00000005
EQU CKSEL0 00000000
EQU CKSEL1 00000001
EQU CKSEL2 00000002
EQU CKSEL3 00000003
EQU SUT0 00000004
EQU SUT1 00000005
EQU BODEN 00000006
EQU BODLEVEL 00000007
EQU BOOTRST 00000000
EQU BOOTSZ0 00000001
EQU BOOTSZ1 00000002
EQU EESAVE 00000003
EQU CKOPT 00000004
EQU SPIEN 00000005
EQU JTAGEN 00000006
EQU OCDEN 00000007
EQU WDTON 00000000
EQU M103C 00000001
DEF XH r27
DEF XL r26
DEF YH r29
DEF YL r28
DEF ZH r31
DEF ZL r30
EQU FLASHEND 0000ffff
EQU IOEND 000000ff
EQU SRAM_START 00000100
EQU SRAM_SIZE 00001000
EQU RAMEND 000010ff
EQU XRAMEND 0000ffff
EQU E2END 00000fff
EQU EEPROMEND 00000fff
EQU EEADRBITS 0000000c
EQU NRWW_START_ADDR 0000f000
EQU NRWW_STOP_ADDR 0000ffff
EQU RWW_START_ADDR 00000000
EQU RWW_STOP_ADDR 0000efff
EQU PAGESIZE 00000080
EQU FIRSTBOOTSTART 0000fe00
EQU SECONDBOOTSTART 0000fc00
EQU THIRDBOOTSTART 0000f800
EQU FOURTHBOOTSTART 0000f000
EQU SMALLBOOTSTART 0000fe00
EQU LARGEBOOTSTART 0000f000
EQU INT0addr 00000002
EQU INT1addr 00000004
EQU INT2addr 00000006
EQU INT3addr 00000008
EQU INT4addr 0000000a
EQU INT5addr 0000000c
EQU INT6addr 0000000e
EQU INT7addr 00000010
EQU OC2addr 00000012
EQU OVF2addr 00000014
EQU ICP1addr 00000016
EQU OC1Aaddr 00000018
EQU OC1Baddr 0000001a
EQU OVF1addr 0000001c
EQU OC0addr 0000001e
EQU OVF0addr 00000020
EQU SPIaddr 00000022
EQU URXC0addr 00000024
EQU UDRE0addr 00000026
EQU UTXC0addr 00000028
EQU ADCCaddr 0000002a
EQU ERDYaddr 0000002c
EQU ACIaddr 0000002e
EQU OC1Caddr 00000030
EQU ICP3addr 00000032
EQU OC3Aaddr 00000034
EQU OC3Baddr 00000036
EQU OC3Caddr 00000038
EQU OVF3addr 0000003a
EQU URXC1addr 0000003c
EQU UDRE1addr 0000003e
EQU UTXC1addr 00000040
EQU TWIaddr 00000042
EQU SPMRaddr 00000044
EQU INT_VECTORS_SIZE 00000046
DEF mpr r16
DEF dataloopcountreg r23
EQU datamemstart 00000100
EQU stringlen 00000020
CSEG INIT 00000046
CSEG LCDInit 00000062
CSEG STRING_BEG 00000052
CSEG INIT_MEMCOPYLOOP 0000004c
CSEG MAIN 00000050
CSEG LCDWrite 000000a1
CSEG STRING_END 00000062
DEF wait r17
DEF count r18
DEF line r19
DEF type r20
DEF q r21
DEF r r22
EQU LCDLine1 00000080
EQU LCDLine2 000000c0
EQU LCDClear 00000001
EQU LCDHome 00000002
EQU LCDPulse 00000008
EQU LCDCmd 00000000
EQU LCDTxt 00000001
EQU LCDMaxCnt 00000010
EQU LCDLn1Addr 00000100
EQU LCDLn2Addr 00000110
CSEG LCDINIT_L1 0000008d
CSEG LCDWait 0000014e
CSEG LCDWriteCmd 0000012a
CSEG LCDClr 000000c4
CSEG LCDWrLn1 000000a4
CSEG LCDWrLn2 000000b4
CSEG LCDSetLine 00000118
CSEG LCDWriteLine 00000124
CSEG LCDClrLn1 000000c7
CSEG LCDClrLn2 000000d7
CSEG LCDClrLine 0000011d
CSEG LCDWriteByte 000000e7
CSEG LCDWriteByte_3 000000f6
CSEG LCDWriteByte_1 000000f0
CSEG LCDWriteByte_2 000000f3
CSEG LCDWriteChar 00000138
CSEG Bin2ASCII 000000fa
CSEG B2A_1 00000104
CSEG B2A_3 0000010b
CSEG B2A_2 00000109
CSEG div10 00000156
CSEG LCDClrLine_1 0000011f
CSEG LCDWriteLine_1 00000125
CSEG LCDWriteData 00000141
CSEG LCDWC_L1 00000130
CSEG LCDW_L1 0000014f
CSEG LCDW_L2 00000150
CSEG div10_1 00000175
CSEG div10_2 0000017a

View File

@@ -0,0 +1,63 @@
<ASSEMBLER_INFO>
<VERSION>2.2.7</VERSION>
<DEVICE>"ATmega128"</DEVICE>
<WORKING_DIR>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Debug</WORKING_DIR>
<INCLUDE_PATH>
<DIR>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc</DIR>
<DIR>C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\Include</DIR>
<DIR></DIR>
</INCLUDE_PATH>
<SOURCE_FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</SOURCE_FILE>
<INCLUDED_FILES>
<FILE>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc\m128def.inc</FILE>
<FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE>
</INCLUDED_FILES>
<OBJECT_FILES>
<FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Debug\Corwin_Perren_Lab4_sourcecode.obj</FILE>
</OBJECT_FILES>
<HEX_FILES>
<FILE>Corwin_Perren_Lab4_sourcecode.hex</FILE>
</HEX_FILES>
<OUTPUT_FILES>
<FILE>Corwin_Perren_Lab4_sourcecode.map</FILE>
<FILE>Corwin_Perren_Lab4_sourcecode.lss</FILE>
</OUTPUT_FILES>
<LABELS>
<INIT><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</FILE><LINE>45</LINE></INIT>
<LCDInit><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>75</LINE></LCDInit>
<STRING_BEG><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</FILE><LINE>101</LINE></STRING_BEG>
<INIT_MEMCOPYLOOP><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</FILE><LINE>65</LINE></INIT_MEMCOPYLOOP>
<MAIN><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</FILE><LINE>82</LINE></MAIN>
<LCDWrite><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>170</LINE></LCDWrite>
<STRING_END><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</FILE><LINE>103</LINE></STRING_END>
<LCDINIT_L1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>139</LINE></LCDINIT_L1>
<LCDWait><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>492</LINE></LCDWait>
<LCDWriteCmd><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>436</LINE></LCDWriteCmd>
<LCDClr><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>230</LINE></LCDClr>
<LCDWrLn1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>180</LINE></LCDWrLn1>
<LCDWrLn2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>205</LINE></LCDWrLn2>
<LCDSetLine><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>388</LINE></LCDSetLine>
<LCDWriteLine><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>423</LINE></LCDWriteLine>
<LCDClrLn1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>240</LINE></LCDClrLn1>
<LCDClrLn2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>265</LINE></LCDClrLn2>
<LCDClrLine><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>404</LINE></LCDClrLine>
<LCDWriteByte><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>302</LINE></LCDWriteByte>
<LCDWriteByte_3><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>323</LINE></LCDWriteByte_3>
<LCDWriteByte_1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>313</LINE></LCDWriteByte_1>
<LCDWriteByte_2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>318</LINE></LCDWriteByte_2>
<LCDWriteChar><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>457</LINE></LCDWriteChar>
<Bin2ASCII><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>339</LINE></Bin2ASCII>
<B2A_1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>352</LINE></B2A_1>
<B2A_3><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>360</LINE></B2A_3>
<B2A_2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>357</LINE></B2A_2>
<div10><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>515</LINE></div10>
<LCDClrLine_1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>407</LINE></LCDClrLine_1>
<LCDWriteLine_1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>425</LINE></LCDWriteLine_1>
<LCDWriteData><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>472</LINE></LCDWriteData>
<LCDWC_L1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>443</LINE></LCDWC_L1>
<LCDW_L1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>493</LINE></LCDW_L1>
<LCDW_L2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>494</LINE></LCDW_L2>
<div10_1><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>554</LINE></div10_1>
<div10_2><FILE>C:\Users\caperren\Github\ECE_375\Labs\Lab 4\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\LCDDriver.asm</FILE><LINE>560</LINE></div10_2>
</LABELS>
</ASSEMBLER_INFO>

View File

@@ -0,0 +1,561 @@
;***********************************************************
;*
;* LCDDriver.asm - V2.0
;*
;* Contains the neccessary functions to display text to a
;* 2 x 16 character LCD Display. Additional functions
;* include a conversion routine from an unsigned 8-bit
;* binary number to and ASCII text string.
;*
;* Version 2.0 - Added support for accessing the LCD
;* Display via the serial port. See version 1.0 for
;* accessing a memory mapped LCD display.
;*
;***********************************************************
;*
;* Author: David Zier
;* Date: March 17, 2003
;* Company: TekBots(TM), Oregon State University - EECS
;* Version: 2.0
;*
;***********************************************************
;* Rev Date Name Description
;*----------------------------------------------------------
;* - 8/20/02 Zier Initial Creation of Version 1.0
;* A 3/7/03 Zier V2.0 - Updated for USART LCD
;*
;*
;***********************************************************
;***********************************************************
;* Internal Register Definitions and Constants
;* NOTE: A register MUST be named 'mpr' in the Main Code
;* It is recomended to use register r16.
;* WARNING: Register r17-r22 are reserved and cannot be
;* renamed outside of the LCD Driver functions. Doing
;* so will damage the functionality of the LCD Driver
;***********************************************************
.def wait = r17 ; Wait Loop Register
.def count = r18 ; Character Counter
.def line = r19 ; Line Select Register
.def type = r20 ; LCD data type: Command or Text
.def q = r21 ; Quotient for div10
.def r = r22 ; Remander for div10
.equ LCDLine1 = $80 ; LCD Line 1 select command
.equ LCDLine2 = $c0 ; LCD Line 2 select command
.equ LCDClear = $01 ; LCD Clear Command
.equ LCDHome = $02 ; LCD Set Cursor Home Command
.equ LCDPulse = $08 ; LCD Pulse signal, used to simulate
; write signal
.equ LCDCmd = $00 ; Constant used to write a command
.equ LCDTxt = $01 ; Constant used to write a text character
.equ LCDMaxCnt = 16 ; Maximum number of characters per line
.equ LCDLn1Addr = $0100 ; Beginning address for Line 1 data
.equ LCDLn2Addr = $0110 ; Beginning address for Line 2 data
;-----------------------------------------------------------
;***********************************************************
;* Public LCD Driver Suboutines and Functions
;* These functions and subroutines can be called safely
;* from within any program
;***********************************************************
;-----------------------------------------------------------
;*******************************************************
;* SubRt: LCDInit
;* Desc: Initialize the Serial Port and the Hitachi
;* Display 8 Bit inc DD-RAM
;* Pointer with no features
;* - 2 LInes with 16 characters
;*******************************************************
LCDInit:
push mpr ; Save the state of machine
in mpr, SREG ; Save the SREG
push mpr ;
push wait ; Save wait
; Setup the Communication Ports
; Port B: Output
; Port D: Input w/ internal pullup resistors
; Port F: Output on Pin 3
ldi mpr, $00 ; Initialize Port B for outputs
out PORTB, mpr ; Port B outputs high
ldi mpr, $ff ; except for any overrides
out DDRB, mpr ;
ldi mpr, $00 ; Initialize Port D for inputs
out PORTD, mpr ; with Tri-State
ldi mpr, $00 ; except for any overrides
out DDRD, mpr ;
ldi mpr, $00 ; Initialize Port F Pin 3 to
sts PORTF, mpr ; output inorder to twiddle the
ldi mpr, (1<<DDF3) ; LCD interface
sts DDRF, mpr ; Must NOT override this port
; Setup the Serial Functionality
; SPI Type: Master
; SPI Clock Rate: 2*1000.000 kHz
; SPI Clock Phase: Cycle Half
; SPI Clock Polarity: Low
; SPI Data Order: MSB First
ldi mpr, (1<<SPE|1<<MSTR)
out SPCR, mpr ; Set Serial Port Control Register
ldi mpr, (1<<SPI2X)
out SPSR, mpr ; Set Serial Port Status Register
; Setup External SRAM configuration
; $0460 - $7FFF / $8000 - $FFFF
; Lower page wait state(s): None
; Uppoer page wait state(s): 2r/w
ldi mpr, (1<<SRE) ;
out MCUCR, mpr ; Initialize MCUCR
ldi mpr, (1<<SRL2|1<<SRW11)
sts XMCRA, mpr ; Initialize XMCRA
ldi mpr, (1<<XMBK) ;
sts XMCRB, mpr ; Initialize XMCRB
; Initialize USART0
; Communication Parameter: 8 bit, 1 stop, No Parity
; USART0 Rx: On
; USART0 Tx: On
; USART0 Mode: Asynchronous
; USART0 Baudrate: 9600
ldi mpr, $00 ;
out UCSR0A, mpr ; Init UCSR0A
ldi mpr, (1<<RXEN0|1<<TXEN0)
out UCSR0B, mpr ; Init UCSR0B
ldi mpr, (1<<UCSZ01|1<<UCSZ00)
sts UCSR0C, mpr ; Init UCSR0C
ldi mpr, $00 ;
sts UBRR0H, mpr ; Init UBRR0H
ldi mpr, $67 ;
out UBRR0L, mpr ; Init UBRR0L
; Initialize the LCD Display
ldi mpr, 6 ;
LCDINIT_L1:
ldi wait, 250 ; 15ms of Display
rcall LCDWait ; Bootup wait
dec mpr ;
brne LCDINIT_L1 ;
ldi mpr, $38 ; Display Mode set
rcall LCDWriteCmd ;
ldi mpr, $08 ; Display Off
rcall LCDWriteCmd ;
ldi mpr, $01 ; Display Clear
rcall LCDWriteCmd ;
ldi mpr, $06 ; Entry mode set
rcall LCDWriteCmd ;
ldi mpr, $0c ; Display on
rcall LCDWriteCmd ;
rcall LCDClr ; Clear display
pop wait ; Restore wait
pop mpr ; Restore SREG
out SREG, mpr ;
pop mpr ; Restore mpr
ret ; Return from subroutine
;*******************************************************
;* Func: LCDWrite
;* Desc: Generic Write Function that writes both lines
;* of text out to the LCD
;* - Line 1 data is in address space $0100-$010F
;* - Line 2 data is in address space $0110-$010F
;*******************************************************
LCDWrite:
rcall LCDWrLn1 ; Write Line 1
rcall LCDWrLn2 ; Write Line 2
ret ; Return from function
;*******************************************************
;* Func: LCDWrLn1
;* Desc: This function will write the first line of
;* data to the first line of the LCD Display
;*******************************************************
LCDWrLn1:
push mpr ; Save mpr
push ZL ; Save Z pointer
push ZH ;
push count ; Save the count register
push line ; Save the line register
ldi ZL, low(LCDLn1Addr)
ldi ZH, high(LCDLn1Addr)
ldi line, LCDLine1 ; Set LCD line to Line 1
rcall LCDSetLine ; Restart at the beginning of line 1
rcall LCDWriteLine ; Write the line of text
pop line
pop count ; Restore the counter
pop ZH ; Restore Z pointer
pop ZL ;
pop mpr ; Restore mpr
ret ; Return from function
;*******************************************************
;* Func: LCDWrLn2
;* Desc: This function will write the second line of
;* data to the second line of the LCD Display
;*******************************************************
LCDWrLn2:
push mpr ; Save mpr
push ZL ; Save Z pointer
push ZH ;
push count ; Save the count register
push line ; Save the line register
ldi ZL, low(LCDLn2Addr)
ldi ZH, high(LCDLn2Addr)
ldi line, LCDLine2 ; Set LCD line to Line 2
rcall LCDSetLine ; Restart at the beginning of line 2
rcall LCDWriteLine ; Write the line of text
pop line
pop count ; Restore the counter
pop ZH ; Restore Z pointer
pop ZL ;
pop mpr ; Restore mpr
ret ; Return from function
;*******************************************************
;* Func: LCDClr
;* Desc: Generic Clear Subroutine that clears both
;* lines of the LCD and Data Memory storage area
;*******************************************************
LCDClr:
rcall LCDClrLn1 ; Clear Line 1
rcall LCDClrLn2 ; Clear Line 2
ret ; Return from Subroutine
;*******************************************************
;* Func: LCDClrLn1
;* Desc: This subroutine will clear the first line of
;* the data and the first line of the LCD Display
;*******************************************************
LCDClrLn1:
push mpr ; Save mpr
push line ; Save line register
push count ; Save the count register
push ZL ; Save Z pointer
push ZH ;
ldi line, LCDline1 ; Set Access to Line 1 of LCD
rcall LCDSetLine ; Set Z pointer to address of line 1 data
ldi ZL, low(LCDLn1Addr)
ldi ZH, high(LCDLn1Addr)
rcall LCDClrLine ; Call the Clear Line function
pop ZH ; Restore Z pointer
pop ZL ;
pop count ; Restore the count register
pop line ; Restore line register
pop mpr ; Restore mpr
ret ; Return from Subroutine
;*******************************************************
;* Func: LCDClrLn2
;* Desc: This subroutine will clear the second line of
;* the data and the second line of the LCD Display
;*******************************************************
LCDClrLn2:
push mpr ; Save mpr
push line ; Save line register
push count ; Save the count register
push ZL ; Save Z pointer
push ZH ;
ldi line, LCDline2 ; Set Access to Line 2 of LCD
rcall LCDSetLine ; Set Z pointer to address of line 2 data
ldi ZL, low(LCDLn2Addr)
ldi ZH, high(LCDLn2Addr)
rcall LCDClrLine ; Call the Clear Line function
pop ZH ; Restore Z pointer
pop ZL ;
pop count ; Restore the count register
pop line ; Restore line register
pop mpr ; Restore mpr
ret ; Return from Subroutine
;*******************************************************
;* Func: LCDWriteByte
;* Desc: This is a complex and low level function that
;* allows any program to write any ASCII character
;* (Byte) anywhere in the LCD Display. There
;* are several things that need to be initialized
;* before this function is called:
;* count - Holds the index value of the line to where
;* the char is written, 0-15(39). i.e. if
;* count has the value of 3, then the char is
;* going to be written to the third element of
;* the line.
;* line - Holds the line number that the char is going
;* to be written to, (1 or 2).
;* mpr - Contains the value of the ASCII character to
;* be written (0-255)
;*********************************************************
LCDWriteByte:
push mpr ; Save the mpr
push line ; Save the line
push count ; Save the count
; Preform sanity checks on count and line
cpi count, 40 ; Make sure count is within range
brsh LCDWriteByte_3 ; Do nothing and exit function
cpi line, 1 ; If (line == 1)
brne LCDWriteByte_1 ;
ldi line, LCDLine1 ; Load line 1 base LCD Address
rjmp LCDWriteByte_2 ; Continue on with function
LCDWriteByte_1:
cpi line, 2 ; If (line == 2)
brne LCDWriteByte_3 ; Do nothing and exit function
ldi line, LCDLine2 ; Load line 2 base LCD Address
LCDWriteByte_2: ; Write char to LCD
add line, count ; Set the correct LCD address
rcall LCDSetLine ; Set the line address to LCD
rcall LCDWriteChar ; Write Char to LCD Display
LCDWriteByte_3: ; Exit Function
pop count ; Restore the count
pop line ; Restore the line
pop mpr ; Restore the mpr
ret ; Return from function
;*******************************************************
;* Func: Bin2ASCII
;* Desc: Converts a binary number into an ASCII
;* text string equivalent.
;* - The binary number needs to be in the mpr
;* - The Start Address of where the text will
;* be placed needs to be in the X Register
;* - The count of the characters created are
;* added to the count register
;*******************************************************
Bin2ASCII:
push mpr ; save mpr
push r ; save r
push q ; save q
push XH ; save X-pointer
push XL ;
; Determine the range of mpr
cpi mpr, 100 ; is mpr >= 100
brlo B2A_1 ; goto next check
ldi count, 3 ; Three chars are written
adiw XL, 3 ; Increment X 3 address spaces
rjmp B2A_3 ; Continue with program
B2A_1: cpi mpr, 10 ; is mpr >= 10
brlo B2A_2 ; Continue with program
ldi count, 2 ; Two chars are written
adiw XL, 2 ; Increment X 2 address spaces
rjmp B2A_3 ; Continue with program
B2A_2: adiw XL, 1 ; Increment X 1 address space
ldi count, 1 ; One char is written
B2A_3: ;Do-While statement that converts Binary to ASCII
rcall div10 ; Call the div10 function
ldi mpr, '0' ; Set the base ASCII integer value
add mpr, r ; Create the ASCII integer value
st -X, mpr ; Load ASCII value to memory
mov mpr, q ; Set mpr to quotiant value
cpi mpr, 0 ; does mpr == 0
brne B2A_3 ; do while (mpr != 0)
pop XL ; restore X-pointer
pop XH ;
pop q ; restore q
pop r ; restore r
pop mpr ; restore mpr
ret ; return from function
;-------------------------------------------------------
;*******************************************************
;* Private LCD Driver Functions and Subroutines
;* NOTE: It is not recommended to call these functions
;* or subroutines, only call the Public ones.
;*******************************************************
;-------------------------------------------------------
;*******************************************************
;* Func: LCDSetLine
;* Desc: Change line to be written to
;*******************************************************
LCDSetLine:
push mpr ; Save mpr
mov mpr,line ; Copy Command Data to mpr
rcall LCDWriteCmd ; Write the Command
pop mpr ; Restore the mpr
ret ; Return from function
;*******************************************************
;* Func: LCDClrLine
;* Desc: Manually clears a single line within an LCD
;* Display and Data Memory by writing 16
;* consecutive ASCII spaces $20 to both the LCD
;* and the memory. The line to be cleared must
;* first be set in the LCD and the Z pointer is
;* pointing the first element in Data Memory
;*******************************************************
LCDClrLine:
ldi mpr, ' ' ; The space char to be written
ldi count, LCDMaxCnt; The character count
LCDClrLine_1:
st Z+, mpr ; Clear data memory element
rcall LCDWriteChar ; Clear LCD memory element
dec count ; Decrement the count
brne LCDClrLine_1 ; Continue untill all elements are cleared
ret ; Return from function
;*******************************************************
;* Func: LCDWriteLine
;* Desc: Writes a line of text to the LCD Display.
;* This routine takes a data element pointed to
;* by the Z-pointer and copies it to the LCD
;* Display for the duration of the line. The
;* line the Z-pointer must be set prior to the
;* function call.
;*******************************************************
LCDWriteLine:
ldi count, LCDMaxCnt; The character count
LCDWriteLine_1:
ld mpr, Z+ ; Get the data element
rcall LCDWriteChar ; Write element to LCD Display
dec count ; Decrement the count
brne LCDWriteLine_1 ; Continue untill all elements are written
ret ; Return from function
;*******************************************************
;* Func: LCDWriteCmd
;* Desc: Write command that is in the mpr to LCD
;*******************************************************
LCDWriteCmd:
push type ; Save type register
push wait ; Save wait register
ldi type, LCDCmd ; Set type to Command data
rcall LCDWriteData ; Write data to LCD
push mpr ; Save mpr register
ldi mpr, 2 ; Wait approx. 4.1 ms
LCDWC_L1:
ldi wait, 205 ; Wait 2050 us
rcall LCDWait ;
dec mpr ; The wait loop cont.
brne LCDWC_L1 ;
pop mpr ; Restore mpr
pop wait ; Restore wait register
pop type ; Restore type register
ret ; Return from function
;*******************************************************
;* Func: LCDWriteChar
;* Desc: Write character data that is in the mpr
;*******************************************************
LCDWriteChar:
push type ; Save type register
push wait ; Save the wait register
ldi type, LCDTxt ; Set type to Text data
rcall LCDWriteData ; Write data to LCD
ldi wait, 16 ; Delay 160 us
rcall LCDWait ;
pop wait ; Restore wait register
pop type ; Restore type register
ret ; Return from function
;*******************************************************
;* Func: LCDWriteData
;* Desc: Write data or command to LCD
;*******************************************************
LCDWriteData:
out SPDR, type ; Send type to SP
ldi wait, 2 ; Wait 2 us
rcall LCDWait ; Call Wait function
out SPDR,mpr ; Send data to serial port
ldi wait, 2 ; Wait 2 us
rcall LCDWait ; Call Wait function
ldi wait, LCDPulse ; Use wait temporarially to
sts PORTF, wait ; to send write pulse to LCD
ldi wait, $00 ;
sts PORTF, wait ;
ret ; Return from function
;*******************************************************
;* Func: LCDWait
;* Desc: A wait loop that is 10 + 159*wait cycles or
;* roughly wait*10us. Just initialize wait
;* for the specific amount of time in 10us
;* intervals.
;*******************************************************
LCDWait:push mpr ; Save mpr
LCDW_L1:ldi mpr, $49 ; Load with a 10us value
LCDW_L2:dec mpr ; Inner Wait Loop
brne LCDW_L2
dec wait ; Outer Wait Loop
brne LCDW_L1
pop mpr ; Restore mpr
ret ; Return from Wait Function
;*******************************************************
;* Bin2ASCII routines that can be used as a psuedo-
;* printf function to convert an 8-bit binary
;* number into the unigned decimal ASCII text
;*******************************************************
;***********************************************************
;* Func: div10
;* Desc: Divides the value in the mpr by 10 and
;* puts the remander in the 'r' register and
;* and the quotiant in the 'q' register.
;* DO NOT modify this function, trust me, it does
;* divide by 10 :) ~DZ
;***********************************************************
div10:
push r0 ; Save register
; q = mpr / 10 = mpr * 0.000110011001101b
mov q, mpr ; q = mpr * 1.0b
lsr q ; q >> 2
lsr q ; q = mpr * 0.01b
add q, mpr ; q = (q + mpr) >> 1
lsr q ; q = mpr * 0.101b
add q, mpr ; q = (q + mpr) >> 3
lsr q
lsr q
lsr q ; q = mpr * 0.001101b
add q, mpr ; q = (q + mpr) >> 1
lsr q ; q = mpr * 0.1001101b
add q, mpr ; q = (q + mpr) >> 3
lsr q
lsr q
lsr q ; q = mpr * 0.0011001101b
add q, mpr ; q = (q + mpr) >> 1
lsr q ; q = mpr * 0.10011001101b
add q, mpr ; q = (q + mpr) >> 4
lsr q
lsr q
lsr q
lsr q ; q = mpr * 0.000110011001101b
; compute the remainder as r = i - 10 * q
; calculate r = q * 10 = q * 1010b
mov r, q ; r = q * 1
lsl r ; r << 2
lsl r ; r = q * 100b
add r, q ; r = (r + q) << 1
lsl r ; r = q * 1010b
mov r0, r ; r0 = 10 * q
mov r, mpr ; r = mpr
sub r, r0 ; r = mpr - 10 * q
; Fix any errors that occur
div10_1:cpi r, 10 ; Compare with 10
brlo div10_2 ; do nothing if r < 10
inc q ; fix qoutient
subi r, 10 ; fix remainder
rjmp div10_1 ; Continue until error is corrected
div10_2:pop r0 ; Restore registers
ret ; Return from function

View File

@@ -0,0 +1,31 @@
<ASSEMBLER_INFO>
<VERSION>2.2.7</VERSION>
<DEVICE>"ATmega128"</DEVICE>
<WORKING_DIR>c:\users\caperren\Documents\Atmel Studio\7.0\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Release</WORKING_DIR>
<INCLUDE_PATH>
<DIR>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc</DIR>
<DIR>C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\Include</DIR>
<DIR></DIR>
</INCLUDE_PATH>
<SOURCE_FILE>c:\users\caperren\Documents\Atmel Studio\7.0\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</SOURCE_FILE>
<INCLUDED_FILES>
<FILE>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\avrasm\inc\m128def.inc</FILE>
</INCLUDED_FILES>
<OBJECT_FILES>
<FILE>c:\users\caperren\Documents\Atmel Studio\7.0\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Release\Corwin_Perren_Lab4_sourcecode.obj</FILE>
</OBJECT_FILES>
<HEX_FILES>
<FILE>Corwin_Perren_Lab4_sourcecode.hex</FILE>
</HEX_FILES>
<OUTPUT_FILES>
<FILE>Corwin_Perren_Lab4_sourcecode.map</FILE>
<FILE>Corwin_Perren_Lab4_sourcecode.lss</FILE>
</OUTPUT_FILES>
<LABELS>
<INIT><FILE>c:\users\caperren\Documents\Atmel Studio\7.0\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</FILE><LINE>40</LINE></INIT>
<MAIN><FILE>c:\users\caperren\Documents\Atmel Studio\7.0\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</FILE><LINE>60</LINE></MAIN>
<FUNC><FILE>c:\users\caperren\Documents\Atmel Studio\7.0\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</FILE><LINE>77</LINE></FUNC>
<STRING_BEG><FILE>c:\users\caperren\Documents\Atmel Studio\7.0\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</FILE><LINE>95</LINE></STRING_BEG>
<STRING_END><FILE>c:\users\caperren\Documents\Atmel Studio\7.0\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode\Corwin_Perren_Lab4_sourcecode.asm</FILE><LINE>97</LINE></STRING_END>
</LABELS>
</ASSEMBLER_INFO>