Read temp ok !
This commit is contained in:
parent
d0e6eb4795
commit
29bb1b4034
24
1-wire.asm
24
1-wire.asm
|
@ -137,20 +137,16 @@ MainReadTemp:
|
|||
ldi YH,HIGH(TempWord)
|
||||
rcall OWReset ; One wire reset
|
||||
brts MainReadTemp ; If device not present go to MainLoop
|
||||
rcall OWReset ; One wire reset
|
||||
brts MainReadTemp ; If device not present go to MainLoop
|
||||
rcall OWReset ; One wire reset
|
||||
brts MainReadTemp ; If device not present go to MainLoop
|
||||
ldi r16,SkipRom ; Write Skip Rom one wire in "single-drop"
|
||||
rcall OWWriteByte ;
|
||||
ldi r16, RScratch ; Write ConvertCommand
|
||||
rcall OWWriteByte ;
|
||||
rcall OWReadByte
|
||||
st Y+, r16 ; Store TEMPERATURE LSB(50h) byte to table, and increment pointer
|
||||
mov r21, r16
|
||||
;rcall LCD_WriteHex8
|
||||
rcall OWReadByte
|
||||
st Y+, r16 ; Store TEMPERATURE MSB(05h) byte to table, and increment pointer
|
||||
mov r22, r16
|
||||
;rcall LCD_WriteHex8
|
||||
ret
|
||||
|
||||
TempRequest:
|
||||
|
@ -174,22 +170,20 @@ ConvertTempForLCD: ;r18 contiendra la partie décimal et xl la partie entiere
|
|||
ld XH, Y+
|
||||
lsr XL
|
||||
lsr XL ;Sup des deux bit inutilisé
|
||||
ldi r16, 0x03
|
||||
mov r18, XL
|
||||
AND r18, r16
|
||||
mov r16, XL
|
||||
ldi r18, 0x03 ;Masque des 3 bit de fraction
|
||||
AND r18, XL ;3bit fraction
|
||||
ldi r16, 25
|
||||
mul r18, r16
|
||||
movw r18, r0
|
||||
lsr XL
|
||||
lsr XL ;Sup des deux bit de fraction
|
||||
ldi r16, 15
|
||||
ldi r16, 0b00001111
|
||||
and XH,r16
|
||||
ROR XH
|
||||
ROR XH
|
||||
ROR XH
|
||||
ROR XH
|
||||
ROR XH ; xh>>4+1(+1 pour le carry)
|
||||
SWAP XH
|
||||
or XL,XH
|
||||
;mov r16, R18
|
||||
;rcall LCD_WriteHex8
|
||||
|
||||
pop r17
|
||||
pop r16
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
:020000020000FC
|
||||
:0200000070C1CD
|
||||
:0200000068C1D5
|
||||
:0200040018954D
|
||||
:02000800189549
|
||||
:02000C00189545
|
||||
|
@ -50,30 +50,24 @@
|
|||
:1001D400A4E0209AC8DF2098B0E0A4E1C4DFE8944A
|
||||
:1001E40018996894B0E0A8ECBEDF08940EF08894E7
|
||||
:1001F40008951F9310E0EBDF079513951830D9F796
|
||||
:100204001F910895C8E0D1E0BCDFE6F3BADFD6F36E
|
||||
:10021400B8DFC6F30CECD2DF0EEBD0DFEADF0993D4
|
||||
:10022400502FE7DF0993602F0895ABDF5EF30CECEA
|
||||
:10023400C5DF04E4C3DF0CEB99DF18950F931F931C
|
||||
:10024400C8E0D1E0A991B991A695A69503E02A2F1B
|
||||
:10025400202309E1209F9001A695A6950FE0B023E5
|
||||
:10026400B795B795B795B795B795AB2B1F910F91E8
|
||||
:1002740008950F931F932F930F9318E0209110016B
|
||||
:10028400022707950091100110F428E10227079531
|
||||
:10029400009310010F9106950F931A9579F70F911A
|
||||
:1002A4002F911F910F9108950F9300E00093100177
|
||||
:1002B4000F91089500911001089569427574746F47
|
||||
:1002C4006E2052656164657200006176722D6D6303
|
||||
:1002D400752E6478702E706C00002E0000000FEFF5
|
||||
:1002E4000DBF21DF01E019DFEEEBF2E0EEDE01E409
|
||||
:1002F40014DF47DFF6F30CEC61DF0EE45FDF002769
|
||||
:100304005DDF5CDF0FE35ADF01E407DF3ADFE6F38A
|
||||
:100314008CDF78DF93DF0C94A4016BDF0030A1F352
|
||||
:10032400A8DFC0E0D1E0099317E063DFA2DF0993FF
|
||||
:100334001A95D9F7BFDF003039F700E4EEDEC0E0EC
|
||||
:10034400D1E012E00F930A2F0F9330EF032320D054
|
||||
:100354000695069506950695BEDE0F9119D02FE0F9
|
||||
:100364000223B9DE022F0F9330EF032311D0069539
|
||||
:10037400069506950695AFDE0F910AD02FE002236D
|
||||
:10038400AADE0000000000000C948601D9F6BCCF60
|
||||
:1003940055270A5010F0505FFCCF065F050F0895F3
|
||||
:100204001F910895C8E0D1E0BCDFE6F30CECD6DF23
|
||||
:100214000EEBD4DFEEDF0993ECDF09930895B1DF31
|
||||
:100224008EF30CECCBDF04E4C9DF0CEB9FDF1895F5
|
||||
:100234000F931F93C8E0D1E0A991B991A695A69513
|
||||
:100244000A2F23E02A2309E1209F9001A695A69571
|
||||
:100254000FE0B023B295AB2B1F910F9108950F932C
|
||||
:100264001F932F930F9318E02091100102270795F5
|
||||
:100274000091100110F428E1022707950093100162
|
||||
:100284000F9106950F931A9579F70F912F911F915E
|
||||
:100294000F9108950F9300E0009310010F910895BA
|
||||
:1002A40000911001089574656D7020726561646534
|
||||
:1002B40072207E302E32350000006176722D6D631F
|
||||
:1002C400752E6478702E706C00002E0000000FEF05
|
||||
:1002D4000DBF29DF01E021DFEAEAF2E0F6DE01E406
|
||||
:1002E4001CDF4FDFF6F30CEC69DF0EE467DF002759
|
||||
:1002F40065DF64DF0FE362DF01E40FDF42DFE6F373
|
||||
:100304008EDF80DF95DF0000000000000F930A2FCE
|
||||
:1003140008D0EBDE022F05D0E8DE0C947E01B1F7A5
|
||||
:10032400EBCF5F9355270A5010F0505FFCCF065F68
|
||||
:06033400050F5F91089522
|
||||
:00000001FF
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
AVRASM ver. 2.2.7 C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm Sun Jun 10 03:42:22 2018
|
||||
AVRASM ver. 2.2.7 C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm Sun Jun 10 10:18:03 2018
|
||||
|
||||
[builtin](2): Including file 'C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.150\avrasm\inc\m328pdef.inc'
|
||||
C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(34): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\vectors.asm'
|
||||
|
@ -1039,7 +1039,7 @@ C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM
|
|||
#include "vectors.asm"
|
||||
|
||||
.org 0 ; Reset
|
||||
000000 c170 rjmp ProgramEntryPoint
|
||||
000000 c168 rjmp ProgramEntryPoint
|
||||
.org INT0addr
|
||||
000002 9518 reti
|
||||
.org INT1addr
|
||||
|
@ -1598,63 +1598,57 @@ C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM
|
|||
000105 e0d1 ldi YH,HIGH(TempWord)
|
||||
000106 dfbc rcall OWReset ; One wire reset
|
||||
000107 f3e6 brts MainReadTemp ; If device not present go to MainLoop
|
||||
000108 dfba rcall OWReset ; One wire reset
|
||||
000109 f3d6 brts MainReadTemp ; If device not present go to MainLoop
|
||||
00010a dfb8 rcall OWReset ; One wire reset
|
||||
00010b f3c6 brts MainReadTemp ; If device not present go to MainLoop
|
||||
00010c ec0c ldi r16,SkipRom ; Write Skip Rom one wire in "single-drop"
|
||||
00010d dfd2 rcall OWWriteByte ;
|
||||
00010e eb0e ldi r16, RScratch ; Write ConvertCommand
|
||||
00010f dfd0 rcall OWWriteByte ;
|
||||
000110 dfea rcall OWReadByte
|
||||
000111 9309 st Y+, r16 ; Store TEMPERATURE LSB(50h) byte to table, and increment pointer
|
||||
000112 2f50 mov r21, r16
|
||||
000113 dfe7 rcall OWReadByte
|
||||
000114 9309 st Y+, r16 ; Store TEMPERATURE MSB(05h) byte to table, and increment pointer
|
||||
000115 2f60 mov r22, r16
|
||||
000116 9508 ret
|
||||
000108 ec0c ldi r16,SkipRom ; Write Skip Rom one wire in "single-drop"
|
||||
000109 dfd6 rcall OWWriteByte ;
|
||||
00010a eb0e ldi r16, RScratch ; Write ConvertCommand
|
||||
00010b dfd4 rcall OWWriteByte ;
|
||||
00010c dfee rcall OWReadByte
|
||||
00010d 9309 st Y+, r16 ; Store TEMPERATURE LSB(50h) byte to table, and increment pointer
|
||||
;rcall LCD_WriteHex8
|
||||
00010e dfec rcall OWReadByte
|
||||
00010f 9309 st Y+, r16 ; Store TEMPERATURE MSB(05h) byte to table, and increment pointer
|
||||
;rcall LCD_WriteHex8
|
||||
000110 9508 ret
|
||||
|
||||
TempRequest:
|
||||
000117 dfab rcall OWReset ; One wire reset
|
||||
000118 f35e brts MainReadTemp ; If device not present go to MainLoop
|
||||
000111 dfb1 rcall OWReset ; One wire reset
|
||||
000112 f38e brts MainReadTemp ; If device not present go to MainLoop
|
||||
|
||||
000119 ec0c ldi r16,SkipRom ; Write Skip Rom one wire in "single-drop"
|
||||
00011a dfc5 rcall OWWriteByte ;
|
||||
00011b e404 ldi r16, ConvertTemp ; Write ConvertCommand
|
||||
00011c dfc3 rcall OWWriteByte ;
|
||||
00011d eb0c ldi r16, 188
|
||||
00011e df99 rcall WaitMiliseconds
|
||||
00011f 9518 reti
|
||||
000113 ec0c ldi r16,SkipRom ; Write Skip Rom one wire in "single-drop"
|
||||
000114 dfcb rcall OWWriteByte ;
|
||||
000115 e404 ldi r16, ConvertTemp ; Write ConvertCommand
|
||||
000116 dfc9 rcall OWWriteByte ;
|
||||
000117 eb0c ldi r16, 188
|
||||
000118 df9f rcall WaitMiliseconds
|
||||
000119 9518 reti
|
||||
|
||||
ConvertTempForLCD: ;r18 contiendra la partie décimal et xl la partie entiere
|
||||
000120 930f push r16
|
||||
000121 931f push r17
|
||||
000122 e0c8 ldi YL,LOW(TempWord)
|
||||
000123 e0d1 ldi YH,HIGH(TempWord)
|
||||
000124 91a9 ld XL, Y+
|
||||
000125 91b9 ld XH, Y+
|
||||
000126 95a6 lsr XL
|
||||
000127 95a6 lsr XL ;Sup des deux bit inutilisé
|
||||
000128 e003 ldi r16, 0x03
|
||||
000129 2f2a mov r18, XL
|
||||
00012a 2320 AND r18, r16
|
||||
00012b e109 ldi r16, 25
|
||||
00012c 9f20 mul r18, r16
|
||||
00012d 0190 movw r18, r0
|
||||
00012e 95a6 lsr XL
|
||||
00012f 95a6 lsr XL ;Sup des deux bit de fraction
|
||||
000130 e00f ldi r16, 15
|
||||
000131 23b0 and XH,r16
|
||||
000132 95b7 ROR XH
|
||||
000133 95b7 ROR XH
|
||||
000134 95b7 ROR XH
|
||||
000135 95b7 ROR XH
|
||||
000136 95b7 ROR XH ; xh>>4+1(+1 pour le carry)
|
||||
000137 2bab or XL,XH
|
||||
00011a 930f push r16
|
||||
00011b 931f push r17
|
||||
00011c e0c8 ldi YL,LOW(TempWord)
|
||||
00011d e0d1 ldi YH,HIGH(TempWord)
|
||||
00011e 91a9 ld XL, Y+
|
||||
00011f 91b9 ld XH, Y+
|
||||
000120 95a6 lsr XL
|
||||
000121 95a6 lsr XL ;Sup des deux bit inutilisé
|
||||
000122 2f0a mov r16, XL
|
||||
000123 e023 ldi r18, 0x03 ;Masque des 3 bit de fraction
|
||||
000124 232a AND r18, XL ;3bit fraction
|
||||
000125 e109 ldi r16, 25
|
||||
000126 9f20 mul r18, r16
|
||||
000127 0190 movw r18, r0
|
||||
000128 95a6 lsr XL
|
||||
000129 95a6 lsr XL ;Sup des deux bit de fraction
|
||||
00012a e00f ldi r16, 0b00001111
|
||||
00012b 23b0 and XH,r16
|
||||
00012c 95b2 SWAP XH
|
||||
00012d 2bab or XL,XH
|
||||
;mov r16, R18
|
||||
;rcall LCD_WriteHex8
|
||||
|
||||
000138 911f pop r17
|
||||
000139 910f pop r16
|
||||
00013a 9508 ret
|
||||
00012e 911f pop r17
|
||||
00012f 910f pop r16
|
||||
000130 9508 ret
|
||||
#include "crc8.asm"
|
||||
|
||||
; CRC8 computing functions
|
||||
|
@ -1677,49 +1671,49 @@ C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM
|
|||
; Update crc value
|
||||
;------------------------------------------------------------------------------
|
||||
CRC8Update:
|
||||
00013b 930f push r16
|
||||
00013c 931f push r17
|
||||
00013d 932f push r18
|
||||
00013e 930f push r16
|
||||
000131 930f push r16
|
||||
000132 931f push r17
|
||||
000133 932f push r18
|
||||
000134 930f push r16
|
||||
|
||||
00013f e018 ldi r17, 8
|
||||
000135 e018 ldi r17, 8
|
||||
CRC8L:
|
||||
000140 9120 0110 lds r18, _crc
|
||||
000142 2702 eor r16, r18
|
||||
000143 9507 ror r16
|
||||
000144 9100 0110 lds r16, _crc
|
||||
000146 f410 brcc CRC8zero
|
||||
000147 e128 ldi r18, 0x18
|
||||
000148 2702 eor r16, r18
|
||||
000136 9120 0110 lds r18, _crc
|
||||
000138 2702 eor r16, r18
|
||||
000139 9507 ror r16
|
||||
00013a 9100 0110 lds r16, _crc
|
||||
00013c f410 brcc CRC8zero
|
||||
00013d e128 ldi r18, 0x18
|
||||
00013e 2702 eor r16, r18
|
||||
|
||||
CRC8zero:
|
||||
000149 9507 ror r16
|
||||
00014a 9300 0110 sts _crc, r16
|
||||
00014c 910f pop r16
|
||||
00014d 9506 lsr r16
|
||||
00014e 930f push r16
|
||||
00014f 951a dec r17
|
||||
000150 f779 brne CRC8L
|
||||
000151 910f pop r16
|
||||
000152 912f pop r18
|
||||
000153 911f pop r17
|
||||
000154 910f pop r16
|
||||
000155 9508 ret
|
||||
00013f 9507 ror r16
|
||||
000140 9300 0110 sts _crc, r16
|
||||
000142 910f pop r16
|
||||
000143 9506 lsr r16
|
||||
000144 930f push r16
|
||||
000145 951a dec r17
|
||||
000146 f779 brne CRC8L
|
||||
000147 910f pop r16
|
||||
000148 912f pop r18
|
||||
000149 911f pop r17
|
||||
00014a 910f pop r16
|
||||
00014b 9508 ret
|
||||
;------------------------------------------------------------------------------
|
||||
; Clear crc value
|
||||
;------------------------------------------------------------------------------
|
||||
CRC8Init:
|
||||
000156 930f push r16
|
||||
000157 e000 ldi r16,0
|
||||
000158 9300 0110 sts _crc, r16
|
||||
00015a 910f pop r16
|
||||
00015b 9508 ret
|
||||
00014c 930f push r16
|
||||
00014d e000 ldi r16,0
|
||||
00014e 9300 0110 sts _crc, r16
|
||||
000150 910f pop r16
|
||||
000151 9508 ret
|
||||
;------------------------------------------------------------------------------
|
||||
; Copy crc value to r16
|
||||
;------------------------------------------------------------------------------
|
||||
GetCRC8:
|
||||
00015c 9100 0110 lds r16, _crc
|
||||
00015e 9508 ret
|
||||
000152 9100 0110 lds r16, _crc
|
||||
000154 9508 ret
|
||||
;------------------------------------------------------------------------------
|
||||
; End of crc8.asm file
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -1727,151 +1721,90 @@ C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM
|
|||
; Constants definition
|
||||
;------------------------------------------------------------------------------
|
||||
Text1 :
|
||||
00015f 4269
|
||||
000160 7475
|
||||
000161 6f74
|
||||
000162 206e
|
||||
000163 6552
|
||||
000164 6461
|
||||
000165 7265
|
||||
000166 0000 .db "iButton Reader",0,0
|
||||
000155 6574
|
||||
000156 706d
|
||||
000157 7220
|
||||
000158 6165
|
||||
000159 6564
|
||||
00015a 2072
|
||||
00015b 307e
|
||||
00015c 322e
|
||||
00015d 0035
|
||||
C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(43): warning: .cseg .db misalignment - padding zero byte
|
||||
00015e 0000 .db "temp reader ~0.25",0,0
|
||||
Text2 :
|
||||
000167 7661
|
||||
000168 2d72
|
||||
000169 636d
|
||||
00016a 2e75
|
||||
00016b 7864
|
||||
00016c 2e70
|
||||
00016d 6c70
|
||||
00016e 0000 .db "avr-mcu.dxp.pl",0,0
|
||||
00015f 7661
|
||||
000160 2d72
|
||||
000161 636d
|
||||
000162 2e75
|
||||
000163 7864
|
||||
000164 2e70
|
||||
000165 6c70
|
||||
000166 0000 .db "avr-mcu.dxp.pl",0,0
|
||||
Tp :
|
||||
00016f 002e
|
||||
000167 002e
|
||||
C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(47): warning: .cseg .db misalignment - padding zero byte
|
||||
000170 0000 .db ".",0,0
|
||||
000168 0000 .db ".",0,0
|
||||
;------------------------------------------------------------------------------
|
||||
; Program entry point
|
||||
;------------------------------------------------------------------------------
|
||||
ProgramEntryPoint:
|
||||
000171 ef0f ldi r16, LOW(RAMEND) ; Initialize stack pointer
|
||||
000172 bf0d out SPL, r16 ;
|
||||
000169 ef0f ldi r16, LOW(RAMEND) ; Initialize stack pointer
|
||||
00016a bf0d out SPL, r16 ;
|
||||
|
||||
000173 df21 rcall LCD_Init ; Initialize LCD
|
||||
00016b df29 rcall LCD_Init ; Initialize LCD
|
||||
|
||||
000174 e001 ldi r16, (HD44780_LINE0 + 1) ;
|
||||
000175 df19 rcall LCD_SetAddressDD ; Set Display Data address to (0,1)
|
||||
00016c e001 ldi r16, (HD44780_LINE0 + 1) ;
|
||||
00016d df21 rcall LCD_SetAddressDD ; Set Display Data address to (0,1)
|
||||
|
||||
000176 ebee ldi ZL, LOW(Text1 << 1) ; Load string address to Z
|
||||
000177 e0f2 ldi ZH, HIGH(Text1<< 1) ;
|
||||
000178 deee rcall LCD_WriteString ; Display string
|
||||
00016e eaea ldi ZL, LOW(Text1 << 1) ; Load string address to Z
|
||||
00016f e0f2 ldi ZH, HIGH(Text1<< 1) ;
|
||||
000170 def6 rcall LCD_WriteString ; Display string
|
||||
|
||||
000179 e401 ldi r16, (HD44780_LINE1 + 1) ;
|
||||
00017a df14 rcall LCD_SetAddressDD ; Set Display Data address to (1,1);
|
||||
000171 e401 ldi r16, (HD44780_LINE1 + 1) ;
|
||||
000172 df1c rcall LCD_SetAddressDD ; Set Display Data address to (1,1);
|
||||
|
||||
;ldi ZL, LOW(Text2 << 1) ;
|
||||
;ldi ZH, HIGH(Text2<< 1) ; Load string address to Z
|
||||
;rcall LCD_WriteString ; Display string
|
||||
ConfigResolTo10Bits:
|
||||
00017b df47 rcall OWReset
|
||||
00017c f3f6 brts ConfigResolTo10Bits
|
||||
00017d ec0c ldi r16, SkipRom ; Write Skip Rom one wire in "single-drop"
|
||||
00017e df61 rcall OWWriteByte
|
||||
00017f e40e ldi r16, WScratch
|
||||
000180 df5f rcall OWWriteByte
|
||||
000181 2700 clr r16
|
||||
000182 df5d rcall OWWriteByte ;th,tl
|
||||
000183 df5c rcall OWWriteByte ;th,tl
|
||||
000184 e30f ldi r16, 63
|
||||
000185 df5a rcall OWWriteByte ;resol
|
||||
000173 df4f rcall OWReset
|
||||
000174 f3f6 brts ConfigResolTo10Bits
|
||||
000175 ec0c ldi r16, SkipRom ; Write Skip Rom one wire in "single-drop"
|
||||
000176 df69 rcall OWWriteByte
|
||||
000177 e40e ldi r16, WScratch
|
||||
000178 df67 rcall OWWriteByte
|
||||
000179 2700 clr r16
|
||||
00017a df65 rcall OWWriteByte ;th,tl
|
||||
00017b df64 rcall OWWriteByte ;th,tl
|
||||
00017c e30f ldi r16, 63
|
||||
00017d df62 rcall OWWriteByte ;resol
|
||||
|
||||
|
||||
|
||||
MainLoop:
|
||||
000186 e401 ldi r16, (HD44780_LINE1 + 1) ;
|
||||
000187 df07 rcall LCD_SetAddressDD ; Set Display Data address to (1,1);
|
||||
000188 df3a rcall OWReset ; One wire reset
|
||||
000189 f3e6 brts MainLoop ; If device not present go to MainLoop
|
||||
00017e e401 ldi r16, (HD44780_LINE1 + 1) ;
|
||||
00017f df0f rcall LCD_SetAddressDD ; Set Display Data address to (1,1);
|
||||
000180 df42 rcall OWReset ; One wire reset
|
||||
000181 f3e6 brts MainLoop ; If device not present go to MainLoop
|
||||
|
||||
00018a df8c rcall TempRequest
|
||||
00018b df78 rcall MainReadTemp
|
||||
00018c df93 rcall ConvertTempForLCD
|
||||
000182 df8e rcall TempRequest
|
||||
000183 df80 rcall MainReadTemp
|
||||
000184 df95 rcall ConvertTempForLCD
|
||||
000185 0000 nop
|
||||
000186 0000 nop
|
||||
000187 0000 nop
|
||||
;jmp PC-1;LoadLoop
|
||||
|
||||
;rcall CRC8Init ; Initialize CRC8 value
|
||||
00018d 940c 01a4 jmp LoadLoop
|
||||
00018f df6b rcall OWReadByte ; Read first byte (Family ID)
|
||||
000190 3000 cpi r16,0 ; If first byte equal to zero, go to MainLoop
|
||||
000191 f3a1 breq MainLoop ; (short circuit on one wire bus)
|
||||
|
||||
000192 dfa8 rcall CRC8Update ; Update the CRC
|
||||
|
||||
000193 e0c0 ldi YL, LOW(SerialNumber) ;
|
||||
000194 e0d1 ldi YH, HIGH(SerialNumber) ; Load to Y address of SerialNumber table
|
||||
|
||||
000195 9309 st Y+, r16 ; Store first byte to table, and increment pointer
|
||||
|
||||
000196 e017 ldi r17, 7 ; 7 bytes remaining
|
||||
StoreLoop:
|
||||
000197 df63 rcall OWReadByte ; read next byte
|
||||
000198 dfa2 rcall CRC8Update ; update the CRC
|
||||
000199 9309 st Y+, r16 ; store next byte to table, and increment pointer
|
||||
00019a 951a dec r17 ; decrement loop counter
|
||||
00019b f7d9 brne StoreLoop ; if greater than zero, jump to StoreLoop
|
||||
|
||||
00019c dfbf rcall GetCRC8 ; Read computet CRC8
|
||||
00019d 3000 cpi r16,0 ; copmare with zero
|
||||
00019e f739 brne MainLoop ; if not equal, jump to MainLoop (bad CRC)
|
||||
; else
|
||||
00019f e400 ldi r16, (HD44780_LINE1 + 0) ;
|
||||
0001a0 deee rcall LCD_SetAddressDD ; Set DisplayData address to (0,1)
|
||||
|
||||
0001a1 e0c0 ldi YL, LOW(SerialNumber) ;
|
||||
0001a2 e0d1 ldi YH, HIGH(SerialNumber) ; Load to Y address of SerialNumber table
|
||||
0001a3 e012 ldi r17,2 ; 8 digits to display
|
||||
LoadLoop:
|
||||
0001a4 930f push r16
|
||||
0001a5 2f0a mov r16, XL ; load to r16 byte from table
|
||||
|
||||
0001a6 930f push r16
|
||||
0001a7 ef30 ldi r19,0xF0
|
||||
0001a8 2303 and r16,r19
|
||||
0001a9 d020 rcall bin2bcd8
|
||||
0001aa 9506 lsr r16
|
||||
0001ab 9506 lsr r16
|
||||
0001ac 9506 lsr r16
|
||||
0001ad 9506 lsr r16
|
||||
0001ae debe rcall LCD_WriteHexDigit ; display it on LCD in HEX
|
||||
0001af 910f pop r16
|
||||
0001b0 d019 rcall bin2bcd8
|
||||
0001b1 e02f ldi r18,0x0F
|
||||
0001b2 2302 and r16,r18
|
||||
0001b3 deb9 rcall LCD_WriteHexDigit ; display it on LCD in HEX
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0001b4 2f02 mov r16, r18 ; load to r16 byte from table
|
||||
|
||||
0001b5 930f push r16
|
||||
0001b6 ef30 ldi r19,0xF0
|
||||
0001b7 2303 and r16,r19
|
||||
0001b8 d011 rcall bin2bcd8
|
||||
0001b9 9506 lsr r16
|
||||
0001ba 9506 lsr r16
|
||||
0001bb 9506 lsr r16
|
||||
0001bc 9506 lsr r16
|
||||
0001bd deaf rcall LCD_WriteHexDigit ; display it on LCD in HEX
|
||||
0001be 910f pop r16
|
||||
0001bf d00a rcall bin2bcd8
|
||||
0001c0 e02f ldi r18,0x0F
|
||||
0001c1 2302 and r16,r18
|
||||
0001c2 deaa rcall LCD_WriteHexDigit ; display it on LCD in HEX
|
||||
0001c3 0000 nop
|
||||
0001c4 0000 nop
|
||||
0001c5 0000 nop
|
||||
0001c6 940c 0186 jmp MainLoop
|
||||
0001c8 f6d9 brne LoadLoop ; if not zero, jump to LoadLoop
|
||||
0001c9 cfbc rjmp MainLoop ; jump to MainLoop
|
||||
000188 930f push r16
|
||||
000189 2f0a mov r16, XL ; chargement partie entière
|
||||
00018a d008 rcall bin2bcd8
|
||||
00018b deeb rcall LCD_WriteHex8 ; display it on LCD in HEX
|
||||
00018c 2f02 mov r16, r18 ; load DEC
|
||||
00018d d005 rcall bin2bcd8
|
||||
00018e dee8 rcall LCD_WriteHex8 ; display it on LCD in HEX
|
||||
00018f 940c 017e jmp MainLoop
|
||||
000191 f7b1 brne LoadLoop ; if not zero, jump to LoadLoop
|
||||
000192 cfeb rjmp MainLoop ; jump to MainLoop
|
||||
;------------------------------------------------------------------------------
|
||||
; End of file
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -1889,15 +1822,17 @@ C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM
|
|||
;.def tBCD = r21 ;add this to main asm file
|
||||
;
|
||||
bin2bcd8:
|
||||
0001ca 2755 clr r21 ;clear temp reg
|
||||
000193 935f push r21
|
||||
000194 2755 clr r21 ;clear temp reg
|
||||
bBCD8_1:
|
||||
0001cb 500a subi r16,10 ;input = input - 10
|
||||
0001cc f010 brcs bBCD8_2 ;abort if carry set
|
||||
0001cd 5f50 subi r21,-$10 ;tBCD = tBCD + 10
|
||||
0001ce cffc rjmp bBCD8_1 ;loop again
|
||||
000195 500a subi r16,10 ;input = input - 10
|
||||
000196 f010 brcs bBCD8_2 ;abort if carry set
|
||||
000197 5f50 subi r21,-$10 ;tBCD = tBCD + 10
|
||||
000198 cffc rjmp bBCD8_1 ;loop again
|
||||
bBCD8_2:
|
||||
0001cf 5f06 subi r16,-10 ;compensate extra subtraction
|
||||
0001d0 0f05 add r16,r21
|
||||
000199 5f06 subi r16,-10 ;compensate extra subtraction
|
||||
00019a 0f05 add r16,r21
|
||||
00019b 915f pop r21
|
||||
|
||||
|
||||
RESOURCE USE INFORMATION
|
||||
|
@ -1915,40 +1850,40 @@ counted separately from r26..r31 here.
|
|||
.dseg memory usage only counts static data declared with .byte
|
||||
|
||||
"ATmega328P" register use summary:
|
||||
x : 0 y : 6 z : 1 r0 : 1 r1 : 0 r2 : 0 r3 : 0 r4 : 0
|
||||
x : 0 y : 4 z : 1 r0 : 1 r1 : 0 r2 : 0 r3 : 0 r4 : 0
|
||||
r5 : 0 r6 : 0 r7 : 0 r8 : 0 r9 : 0 r10: 0 r11: 0 r12: 0
|
||||
r13: 0 r14: 3 r15: 6 r16: 117 r17: 32 r18: 17 r19: 4 r20: 0
|
||||
r21: 4 r22: 1 r23: 0 r24: 0 r25: 0 r26: 21 r27: 21 r28: 4
|
||||
r29: 4 r30: 1 r31: 1
|
||||
Registers used: 17 out of 35 (48.6%)
|
||||
r13: 0 r14: 3 r15: 6 r16: 93 r17: 29 r18: 13 r19: 0 r20: 0
|
||||
r21: 5 r22: 0 r23: 0 r24: 0 r25: 0 r26: 22 r27: 17 r28: 2
|
||||
r29: 2 r30: 1 r31: 1
|
||||
Registers used: 15 out of 35 (42.9%)
|
||||
|
||||
"ATmega328P" instruction use summary:
|
||||
.lds : 0 .sts : 0 adc : 0 add : 5 adiw : 0 and : 6
|
||||
.lds : 0 .sts : 0 adc : 0 add : 5 adiw : 0 and : 2
|
||||
andi : 2 asr : 0 bclr : 0 bld : 0 brbc : 0 brbs : 0
|
||||
brcc : 3 brcs : 1 break : 0 breq : 2 brge : 0 brhc : 0
|
||||
brcc : 3 brcs : 1 break : 0 breq : 1 brge : 0 brhc : 0
|
||||
brhs : 0 brid : 0 brie : 0 brlo : 1 brlt : 0 brmi : 0
|
||||
brne : 12 brpl : 0 brsh : 0 brtc : 0 brts : 7 brvc : 0
|
||||
brne : 10 brpl : 0 brsh : 0 brtc : 0 brts : 5 brvc : 0
|
||||
brvs : 0 bset : 0 bst : 0 call : 0 cbi : 12 cbr : 0
|
||||
clc : 2 clh : 0 cli : 0 cln : 0 clr : 4 cls : 0
|
||||
clt : 2 clv : 0 clz : 0 com : 0 cp : 0 cpc : 0
|
||||
cpi : 7 cpse : 0 dec : 6 eor : 2 fmul : 0 fmuls : 0
|
||||
fmulsu: 0 icall : 0 ijmp : 0 in : 0 inc : 3 jmp : 2
|
||||
ld : 2 ldd : 0 ldi : 77 lds : 3 lpm : 1 lsl : 0
|
||||
lsr : 13 mov : 5 movw : 1 mul : 1 muls : 0 mulsu : 0
|
||||
neg : 0 nop : 3 or : 1 ori : 2 out : 1 pop : 18
|
||||
push : 19 rcall : 77 ret : 25 reti : 26 rjmp : 7 rol : 2
|
||||
ror : 9 sbc : 0 sbci : 0 sbi : 15 sbic : 1 sbis : 1
|
||||
cpi : 5 cpse : 0 dec : 5 eor : 2 fmul : 0 fmuls : 0
|
||||
fmulsu: 0 icall : 0 ijmp : 0 in : 0 inc : 3 jmp : 1
|
||||
ld : 2 ldd : 0 ldi : 66 lds : 3 lpm : 1 lsl : 0
|
||||
lsr : 5 mov : 3 movw : 1 mul : 1 muls : 0 mulsu : 0
|
||||
neg : 0 nop : 3 or : 1 ori : 2 out : 1 pop : 17
|
||||
push : 18 rcall : 65 ret : 25 reti : 26 rjmp : 7 rol : 2
|
||||
ror : 4 sbc : 0 sbci : 0 sbi : 15 sbic : 1 sbis : 1
|
||||
sbiw : 1 sbr : 0 sbrc : 4 sbrs : 4 sec : 2 seh : 0
|
||||
sei : 0 sen : 0 ser : 0 ses : 0 set : 2 sev : 0
|
||||
sez : 0 sleep : 0 spm : 0 st : 4 std : 0 sts : 2
|
||||
sub : 2 subi : 3 swap : 3 tst : 0 wdr : 0
|
||||
sez : 0 sleep : 0 spm : 0 st : 2 std : 0 sts : 2
|
||||
sub : 2 subi : 3 swap : 4 tst : 0 wdr : 0
|
||||
Instructions used: 51 out of 113 (45.1%)
|
||||
|
||||
"ATmega328P" memory use summary [bytes]:
|
||||
Segment Begin End Code Data Used Size Use%
|
||||
---------------------------------------------------------------
|
||||
[.cseg] 0x000000 0x0003a4 846 36 882 32768 2.7%
|
||||
[.cseg] 0x000000 0x00033a 736 40 776 32768 2.4%
|
||||
[.dseg] 0x000100 0x000111 0 17 17 2048 0.8%
|
||||
[.eseg] 0x000000 0x000000 0 0 0 1024 0.0%
|
||||
|
||||
Assembly complete, 0 errors, 3 warnings
|
||||
Assembly complete, 0 errors, 4 warnings
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
AVRASM ver. 2.2.7 C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm Sun Jun 10 03:42:22 2018
|
||||
AVRASM ver. 2.2.7 C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm Sun Jun 10 10:18:03 2018
|
||||
|
||||
|
||||
EQU SIGNATURE_000 0000001e
|
||||
|
@ -696,7 +696,7 @@ EQU TWIaddr 00000030
|
|||
EQU SPMRaddr 00000032
|
||||
EQU INT_VECTORS_SIZE 00000034
|
||||
DSEG SerialNumber 00000100
|
||||
CSEG ProgramEntryPoint 00000171
|
||||
CSEG ProgramEntryPoint 00000169
|
||||
EQU LCD_PORT 0000000b
|
||||
EQU LCD_DDR 0000000a
|
||||
EQU LCD_PIN 00000009
|
||||
|
@ -752,21 +752,20 @@ CSEG OWReadBitEnd 000000fa
|
|||
CSEG OWReadByte 000000fb
|
||||
CSEG OWReadLoop 000000fd
|
||||
CSEG MainReadTemp 00000104
|
||||
CSEG TempRequest 00000117
|
||||
CSEG ConvertTempForLCD 00000120
|
||||
CSEG TempRequest 00000111
|
||||
CSEG ConvertTempForLCD 0000011a
|
||||
DSEG _crc 00000110
|
||||
CSEG CRC8Update 0000013b
|
||||
CSEG CRC8L 00000140
|
||||
CSEG CRC8zero 00000149
|
||||
CSEG CRC8Init 00000156
|
||||
CSEG GetCRC8 0000015c
|
||||
CSEG Text1 0000015f
|
||||
CSEG Text2 00000167
|
||||
CSEG Tp 0000016f
|
||||
CSEG ConfigResolTo10Bits 0000017b
|
||||
CSEG MainLoop 00000186
|
||||
CSEG LoadLoop 000001a4
|
||||
CSEG StoreLoop 00000197
|
||||
CSEG bin2bcd8 000001ca
|
||||
CSEG bBCD8_1 000001cb
|
||||
CSEG bBCD8_2 000001cf
|
||||
CSEG CRC8Update 00000131
|
||||
CSEG CRC8L 00000136
|
||||
CSEG CRC8zero 0000013f
|
||||
CSEG CRC8Init 0000014c
|
||||
CSEG GetCRC8 00000152
|
||||
CSEG Text1 00000155
|
||||
CSEG Text2 0000015f
|
||||
CSEG Tp 00000167
|
||||
CSEG ConfigResolTo10Bits 00000173
|
||||
CSEG MainLoop 0000017e
|
||||
CSEG LoadLoop 00000188
|
||||
CSEG bin2bcd8 00000193
|
||||
CSEG bBCD8_1 00000195
|
||||
CSEG bBCD8_2 00000199
|
||||
|
|
Binary file not shown.
|
@ -67,8 +67,8 @@
|
|||
<OWReadByte><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\1-wire.asm</FILE><LINE>120</LINE></OWReadByte>
|
||||
<OWReadLoop><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\1-wire.asm</FILE><LINE>123</LINE></OWReadLoop>
|
||||
<MainReadTemp><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\1-wire.asm</FILE><LINE>134</LINE></MainReadTemp>
|
||||
<TempRequest><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\1-wire.asm</FILE><LINE>156</LINE></TempRequest>
|
||||
<ConvertTempForLCD><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\1-wire.asm</FILE><LINE>168</LINE></ConvertTempForLCD>
|
||||
<TempRequest><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\1-wire.asm</FILE><LINE>152</LINE></TempRequest>
|
||||
<ConvertTempForLCD><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\1-wire.asm</FILE><LINE>164</LINE></ConvertTempForLCD>
|
||||
<_crc><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\crc8.asm</FILE><LINE>13</LINE></_crc>
|
||||
<CRC8Update><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\crc8.asm</FILE><LINE>21</LINE></CRC8Update>
|
||||
<CRC8L><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\crc8.asm</FILE><LINE>28</LINE></CRC8L>
|
||||
|
@ -78,12 +78,11 @@
|
|||
<Text1><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>42</LINE></Text1>
|
||||
<Text2><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>44</LINE></Text2>
|
||||
<Tp><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>46</LINE></Tp>
|
||||
<ConfigResolTo10Bits><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>70</LINE></ConfigResolTo10Bits>
|
||||
<MainLoop><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>85</LINE></MainLoop>
|
||||
<LoadLoop><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>126</LINE></LoadLoop>
|
||||
<StoreLoop><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>109</LINE></StoreLoop>
|
||||
<bin2bcd8><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>188</LINE></bin2bcd8>
|
||||
<bBCD8_1><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>190</LINE></bBCD8_1>
|
||||
<bBCD8_2><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>195</LINE></bBCD8_2>
|
||||
<ConfigResolTo10Bits><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>67</LINE></ConfigResolTo10Bits>
|
||||
<MainLoop><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>82</LINE></MainLoop>
|
||||
<LoadLoop><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>97</LINE></LoadLoop>
|
||||
<bin2bcd8><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>124</LINE></bin2bcd8>
|
||||
<bBCD8_1><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>127</LINE></bBCD8_1>
|
||||
<bBCD8_2><FILE>C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm</FILE><LINE>132</LINE></bBCD8_2>
|
||||
</LABELS>
|
||||
</ASSEMBLER_INFO>
|
||||
|
|
86
main.asm
86
main.asm
|
@ -40,7 +40,7 @@ SerialNumber: .byte 8
|
|||
; Constants definition
|
||||
;------------------------------------------------------------------------------
|
||||
Text1 :
|
||||
.db "iButton Reader",0,0
|
||||
.db "temp reader ~0.25",0,0
|
||||
Text2 :
|
||||
.db "avr-mcu.dxp.pl",0,0
|
||||
Tp :
|
||||
|
@ -64,9 +64,6 @@ ProgramEntryPoint:
|
|||
ldi r16, (HD44780_LINE1 + 1) ;
|
||||
rcall LCD_SetAddressDD ; Set Display Data address to (1,1);
|
||||
|
||||
;ldi ZL, LOW(Text2 << 1) ;
|
||||
;ldi ZH, HIGH(Text2<< 1) ; Load string address to Z
|
||||
;rcall LCD_WriteString ; Display string
|
||||
ConfigResolTo10Bits:
|
||||
rcall OWReset
|
||||
brts ConfigResolTo10Bits
|
||||
|
@ -83,7 +80,7 @@ ConfigResolTo10Bits:
|
|||
|
||||
|
||||
MainLoop:
|
||||
ldi r16, (HD44780_LINE1 + 1) ;
|
||||
ldi r16, (HD44780_LINE1 + 1) ;
|
||||
rcall LCD_SetAddressDD ; Set Display Data address to (1,1);
|
||||
rcall OWReset ; One wire reset
|
||||
brts MainLoop ; If device not present go to MainLoop
|
||||
|
@ -91,81 +88,20 @@ ldi r16, (HD44780_LINE1 + 1) ;
|
|||
rcall TempRequest
|
||||
rcall MainReadTemp
|
||||
rcall ConvertTempForLCD
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
;jmp PC-1;LoadLoop
|
||||
|
||||
;rcall CRC8Init ; Initialize CRC8 value
|
||||
jmp LoadLoop
|
||||
rcall OWReadByte ; Read first byte (Family ID)
|
||||
cpi r16,0 ; If first byte equal to zero, go to MainLoop
|
||||
breq MainLoop ; (short circuit on one wire bus)
|
||||
|
||||
rcall CRC8Update ; Update the CRC
|
||||
|
||||
ldi YL, LOW(SerialNumber) ;
|
||||
ldi YH, HIGH(SerialNumber) ; Load to Y address of SerialNumber table
|
||||
|
||||
st Y+, r16 ; Store first byte to table, and increment pointer
|
||||
|
||||
ldi r17, 7 ; 7 bytes remaining
|
||||
StoreLoop:
|
||||
rcall OWReadByte ; read next byte
|
||||
rcall CRC8Update ; update the CRC
|
||||
st Y+, r16 ; store next byte to table, and increment pointer
|
||||
dec r17 ; decrement loop counter
|
||||
brne StoreLoop ; if greater than zero, jump to StoreLoop
|
||||
|
||||
rcall GetCRC8 ; Read computet CRC8
|
||||
cpi r16,0 ; copmare with zero
|
||||
brne MainLoop ; if not equal, jump to MainLoop (bad CRC)
|
||||
; else
|
||||
ldi r16, (HD44780_LINE1 + 0) ;
|
||||
rcall LCD_SetAddressDD ; Set DisplayData address to (0,1)
|
||||
|
||||
ldi YL, LOW(SerialNumber) ;
|
||||
ldi YH, HIGH(SerialNumber) ; Load to Y address of SerialNumber table
|
||||
ldi r17,2 ; 8 digits to display
|
||||
LoadLoop:
|
||||
push r16
|
||||
mov r16, XL ; load to r16 byte from table
|
||||
|
||||
push r16
|
||||
ldi r19,0xF0
|
||||
and r16,r19
|
||||
mov r16, XL ; chargement partie entière
|
||||
rcall bin2bcd8
|
||||
lsr r16
|
||||
lsr r16
|
||||
lsr r16
|
||||
lsr r16
|
||||
rcall LCD_WriteHexDigit ; display it on LCD in HEX
|
||||
pop r16
|
||||
rcall LCD_WriteHex8 ; display it on LCD in HEX
|
||||
mov r16, r18 ; load DEC
|
||||
rcall bin2bcd8
|
||||
ldi r18,0x0F
|
||||
and r16,r18
|
||||
rcall LCD_WriteHexDigit ; display it on LCD in HEX
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
mov r16, r18 ; load to r16 byte from table
|
||||
|
||||
push r16
|
||||
ldi r19,0xF0
|
||||
and r16,r19
|
||||
rcall bin2bcd8
|
||||
lsr r16
|
||||
lsr r16
|
||||
lsr r16
|
||||
lsr r16
|
||||
rcall LCD_WriteHexDigit ; display it on LCD in HEX
|
||||
pop r16
|
||||
rcall bin2bcd8
|
||||
ldi r18,0x0F
|
||||
and r16,r18
|
||||
rcall LCD_WriteHexDigit ; display it on LCD in HEX
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
rcall LCD_WriteHex8 ; display it on LCD in HEX
|
||||
jmp MainLoop
|
||||
brne LoadLoop ; if not zero, jump to LoadLoop
|
||||
rjmp MainLoop ; jump to MainLoop
|
||||
|
@ -186,6 +122,7 @@ LoadLoop:
|
|||
;.def tBCD = r21 ;add this to main asm file
|
||||
;
|
||||
bin2bcd8:
|
||||
push r21
|
||||
clr r21 ;clear temp reg
|
||||
bBCD8_1:
|
||||
subi r16,10 ;input = input - 10
|
||||
|
@ -195,4 +132,5 @@ bBCD8_1:
|
|||
bBCD8_2:
|
||||
subi r16,-10 ;compensate extra subtraction
|
||||
add r16,r21
|
||||
pop r21
|
||||
ret
|
Loading…
Reference in New Issue