Code:
'$regfile = "m8def.dat"
$regfile = "m168def.dat"
'$regfile = "m32def.dat"
$crystal = 7372800
'$crystal = 14745600
'$crystal = 16000000
$baud = 9600
$hwstack = 64
$swstack = 64
$framesize = 64
$lib "mcsbyteint.lbx"
Config Adc = Free , Prescaler = Auto
Config Pind.3 = Output
Dim Value0 As Word
Dim Value1 As Word
'-------------------------------------------------------------------------------
nop
nop
nop
nop
nop
Start Adc
Do
Set Portd.3 'ggf. für Oszi-überwachung
Value0 = Getadc(0)
Value1 = Getadc(1)
Reset Portd.3
Loop
nop
nop
nop
nop
End
'Im FREE Modus (ADC triggert sich ständig selbst) ------------------------------
'
'kurz und knackig, allerdings werden u.U. Werte mehrmals gelesen...
'+0000005a : 9170007a Lds R23 , 0x007a Load Direct From Data Space
'+0000005C: 6870 ORI R23,0x80 Logical OR with immediate
'+0000005D: 9370007A STS 0x007A,R23 Store direct to data space
'
'
'+0000005F: 9A5B SBI 0x0B,3 Set bit in I/O register
'+00000060: E080 LDI R24,0x00 Load immediate
'+00000061: 9380007C STS 0x007C,R24 Store direct to data space
'+00000063: 91800078 LDS R24,0x0078 Load direct from data space
'+00000065: 91900079 LDS R25,0x0079 Load direct from data space
'+00000067: E0AF LDI R26,0x0F Load immediate
'+00000068: E0B1 LDI R27,0x01 Load immediate
'+00000069: 938D ST X+,R24 Store indirect and postincr
'+0000006A: 939C ST X,R25 Store indirect
'+0000006B: E081 LDI R24,0x01 Load immediate
'+0000006C: 9380007C STS 0x007C,R24 Store direct to data space
'+0000006E: 91800078 LDS R24,0x0078 Load direct from data space
'+00000070: 91900079 LDS R25,0x0079 Load direct from data space
'+00000072: E1A1 LDI R26,0x11 Load immediate
'+00000073: E0B1 LDI R27,0x01 Load immediate
'+00000074: 938D ST X+,R24 Store indirect and postincr
'+00000075: 939C ST X,R25 Store indirect
'+00000076: 985B CBI 0x0B,3 Clear bit in I/O register
'+00000077: 940C005F JMP 0x0000005F Jump
'Im SINGLE Modus --------------------------------------------------------------
'Hier wird's dann lang und umständlich, dafür ist aber das Ergebnis garantiert
'richtig.
'+0000005A: 9170007A LDS R23,0x007A Load direct from data space
'+0000005C: 6870 ORI R23,0x80 Logical OR with immediate
'+0000005D: 9370007A STS 0x007A,R23 Store direct to data space
'+0000005F: 9A5B SBI 0x0B,3 Set bit in I/O register
'+00000060: E080 LDI R24,0x00 Load immediate
'+00000061: 9380007C STS 0x007C,R24 Store direct to data space
'+00000063: 940E0084 CALL 0x00000084 Call subroutine
'+00000065: E0AF LDI R26,0x0F Load immediate
'+00000066: E0B1 LDI R27,0x01 Load immediate
'+00000067: 938D ST X+,R24 Store indirect and postincr
'+00000068: 939C ST X,R25 Store indirect
'+00000069: E081 LDI R24,0x01 Load immediate
'+0000006A: 9380007C STS 0x007C,R24 Store direct to data space
'+0000006C: 940E0084 CALL 0x00000084 Call subroutine
'+0000006E: E1A1 LDI R26,0x11 Load immediate
'+0000006F: E0B1 LDI R27,0x01 Load immediate
'+00000070: 938D ST X+,R24 Store indirect and postincr
'+00000071: 939C ST X,R25 Store indirect
'+00000072: 985B CBI 0x0B,3 Clear bit in I/O register
'+00000073: 940C005F JMP 0x0000005F Jump
'+00000075: 0000 NOP No operation
'+00000076: 0000 NOP No operation
'+00000077: 0000 NOP No operation
'+00000078: 0000 NOP No operation
'+00000079: 94F8 CLI Global Interrupt Disable
'+0000007A: CFFF RJMP PC-0x0000 Relative jump
'+0000007B: 9731 SBIW R30,0x01 Subtract immediate from word
'+0000007C: F7F1 BRNE PC-0x01 Branch if not equal
'+0000007D: 9508 RET Subroutine return
'+0000007E: 9468 SET Set T in SREG
'+0000007F: F862 BLD R6,2 Bit load from T to register
'+00000080: 9508 RET Subroutine return
'+00000081: 94E8 CLT Clear T in SREG
'+00000082: F862 BLD R6,2 Bit load from T to register
'+00000083: 9508 RET Subroutine return
'+00000084: 9180007A LDS R24,0x007A Load direct from data space
'+00000086: 6C80 ORI R24,0xC0 Logical OR with immediate
'+00000087: 9380007A STS 0x007A,R24 Store direct to data space
'+00000089: 9180007A LDS R24,0x007A Load direct from data space
'+0000008B: FD86 SBRC R24,6 Skip if bit in register clear
'+0000008C: CFFC RJMP PC-0x0003 Relative jump
'+0000008D: 91800078 LDS R24,0x0078 Load direct from data space
'+0000008F: 91900079 LDS R25,0x0079 Load direct from data space
'+00000091: 9508 RET Subroutine return
'+00000092: 0078 ??? Data or unknown opcode
'+00000093: 91900079 LDS R25,0x0079 Load direct from data space
'+00000095: 9508 RET Subroutine return
An den NOPS bitte nicht stören, die sind nur drin, damit ich die richtige Stelle im Disassembler schnell finde.
Lesezeichen