ADC 400F Spezifikationen Seite 23

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 26
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 22
19
The second byte of data is tranferred between the TLC2543 and the 80C51 by repeating the entire sequence of eight sets
of data transfer and clock pulse. The MSByte is placed in register 2 (R2) and the LSByte is placed in register 3 (R3).
The subroutine STORE is used to map the MSByte and LSByte conversion results into even and odd number RAM
addresses corresponding to the particular channel number which has been selected.
List 4
LINE LOC OBJ SOURCE
1 ;* * * * * * * * * * * * * * * *
2 ;* *
3 ;* TLC2543 12–bit Serial Out ADC to 80C51 *
4 ;* *
5 ;* Microcontroller Interface Program *
6 ;* *
7 ;* * * * * * * * * * * * * * * *
8 ;This program reads mode/channel select data into the
9 ;80C51 via Port 4 and transmits this data to the
10 ;TLC2543 at the same time as reading the result from
11 ;the previous conversion and storing the result in an
12 ;adjacent pair of memory locations from 30H to 4CH.
13 ;MSByte – Even Address LSByte – Odd Address
14 ;MSByte Channel 0 in 30H, MSByte Channel 1 in 32H etc.
15 ;
0100 16 ORG 100H
0100 758150 17 START: MOV SP,#50H ;Initialise Stack Pointer
0103 759004 18 MOV P1,#04H ;Initialize port 1 I/O Pins
0106 C290 19 CLR P1.0 ;Set I/O clock low
0108 D293 20 SETB P1.3 ;Set chip select high
010A 74FF 21 MOV A,#00FFH
010C 3112 22 ACALL TLC2543
010E 313F 23 ACALL STORE
0110 80EE 24 JMP START
25
0112 ACB0 26 TLC2543:MOV R4,P3 ;Read mode/channel data into R4
0114 EC 27 MOV A,R4 ;and A
0115 C293 28 CLR P1.3 ;Set chip select low
0117 20E112 29 JB ACC.1,LSB ;If bit 1 of A is 1,
30 ;do LSByte first
011A 7D08 31 MSB: MOV R5,#08 ;Load MS bit counter
011C A292 32 LOOP1: MOV C,P1.2 ;Read data bit into carry
011E 33 33 RLC A ;Rotate into accumulator
011F 9291 34 MOV P1.1,C ;Output mode/channel bit
0121 D290 35 SETB P1.0 ;Set I/O clock high
0123 C290 36 CLR P1.0 ;Set I/O clock low
0125 DDF5 37 DJNZ R5,LOOP1 ;Get/send another bit
0127 FA 38 MOV R2,A ;Put MSByte in R2
0128 EC 39 MOV A,R4 ;Put mode/channel data in A
0129 20E112 40 JB ACC.1,RETURN ;
012C 7D08 41 LSB: MOV R5,#08 ;Load LS bit counter
012E A292 42 LOOP2: MOV C,P1.2 ;Read data bit into carry
0130 33 43 RLC A ;Rotate into accumulator
0131 9291 44 MOV P1.1,C ;Output mode/channel bit
0133 D290 45 SETB P1.0 ;Set I/O clock high
0135 C290 46 CLR P1.0 ;Set I/O clock low
0137 DDF5 47 DJNZ R5,LOOP2 ;Get/send another bit
0139 FB 48 MOV R3,A ;Put LSByte in R3
013A EC 49 MOV A,R4 ;Put mode/channel data in A
013B 20E1DC 50 JB ACC.1,MSB ;If bit 1 of R4 is 1,
51 ;do MSbyte next
013E 22 52 RETURN: RET
53
013F EC 54 STORE: MOV A,R4 ;Put mode/channel data in A
0140 54F0 55 ANL A,#0F0H ;Retain only channel number
0142 C4 56 SWAP A ;Swap high and low nibble of A
0143 75F002 57 MOV B,#02
Seitenansicht 22
1 2 ... 18 19 20 21 22 23 24 25 26

Kommentare zu diesen Handbüchern

Keine Kommentare