Maxim-integrated Secure Microcontroller Manuel d'utilisateur Page 168

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 187
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 167
Secure Microcontroller User’s Guide
168 of 187
Programmer’s Note: In the Write subroutine at the end of this example program, there is one unusual
statement. The action of writing a byte to the RTC is actually done using a read instruction (MOVX A,
@DPTR). This is because a write instruction would write to the RAM under
CE2
if one were present.
Since the RTC uses A2 as a write enable and A0 as the data bit, this instruction is acceptable.
; Program DEMODS5T
;
; This program responds to commands received over the serial
; I/O port to send or receive the date/time information between
; the RTC in the DS5000T and the serial I/O port. This allows
; an external program or user to access the date/time information.
;
; The program first sets up the serial port for transmission at
; 9600 baud with eight data bits, no parity, and one stop bit.
;
; Next, the program begins execution of a loop waiting for an
; instruction from the serial port. Two valid instructions, R and W,
; are recognized.
;
; Receipt of the R character causes the DEMODS5T program
; to read eight bytes of date/time information from the RTC
; and send them out over the serial port.
;
; Receipt of the W character causes the DEMODS5T program
; to wait for eight bytes of date/time information from the serial
; port and write them to the RTC.
;
; Any other byte received from the serial port is incremented and
; then sent back out to the serial port.
;
;
PCON equ 87H
MCON equ 0C6H
TA equ 0C7H
;
cseg at 0
sjmp START
cseg at 30H
START: ;Initialization.
mov TA, #0AAH ;Timed
mov TA, #55H ;access.
mov PCON, #0 ;Reset watchdog timer.
mov MCON, #0F8H ;Turn off CE2 for memory access.
lcall CLOSE ;Close date/time registers.
mov IE, #0
mov TMOD, #20H ;Initialize the
mov TH1, #0FAH ;serial port
mov TL1, #0FAH ;for 9600
orl PCON, #80H ;baud using 11.0592MHz crystal.
mov SCON, #52H
mov TCON, #40H
L:
jnb RI, L ;Wait for character.
clr RI ;Clear the receiver.
mov A, SBUF ;Load in the character.
cjne A, #’R, H ;Skip if not a read.
Vue de la page 167
1 2 ... 163 164 165 166 167 168 169 170 171 172 173 ... 186 187

Commentaires sur ces manuels

Pas de commentaire