Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/12/04 02:49
Read: times


 
#68337 - RE: Serial Communication
Responding to: ???'s previous message
Dear Erik, Charles and Michael

Here is the code which I have used.
The crystal is 11.0592 Mhz. Further I have used UART
in mode 1.

The doubts I have is that the instrument is not transmitting the data with said Procols. Even though they confirm this repeatedly. Anyone can suggest as to how I confirm this or check this that data exactly communicated with what protocls.


ORG 0000H
LJMP CLD_START

ORG 0050H

CLD_START: MOV PCON,#80H ; SMOD = 1

MOV SP,#08H ;load stack pointer
MOV PSW,#00 ;Load Program status
;word
;select RB0

LCALL SETSER

CCCX: LCALL RCVBYT
CJNE A,#")",CCCX ;wait till
;ASCII = ")" is recd.

MOV R6,#09 ;Receive FIRST 9 DATA
; INCLUDING "("
MOV R1,#40H ;DATA will be stored
; from 40h memory
;locations (upto 48h)

CCC4X: LCALL RCVBYT
MOV @R1,A
INC R1
DJNZ R6,CCC4X
LJMP CCCX

;-----------------------------------------------------
rcvbyt: JNB RI,RCVBYT ;RI bit will be
;set when SBUF has byte
MOV A,SBUF ;move SBUFF to ACC
CLR RI
MOV C,PAR
CPL C
ANL A,#7FH ;MASK THE 8TH BIT
JNC RCVBYT
RET
;------------------------------------------------------
; INITIALISE ROUTINE FOR SERIAL COMMUNICATION

setser: MOV SCON,#50H ;set up TIMER 1 for
; UART IN MODE 1
;8 BIT UART, VARIABLE
; BAUD RATE,
;Receiver Enble bit = 1

MOV TH1,#0E8H ;2400 BAUD RATE,
;CRYSTAL = 11.0592 MHZ

ORL TMOD,#20H ;8 BIT AUTO RELOAD.
; THx HOLDS THE
;VALUE TO BE LOADED TO
; TLx EACH TIME
;IT OVERFLOWS, TIMER
;MODE = 2

SETB TR1 ;timer 1 run control bit


setb TI
CLR RI

;Clear pending interupts before enabling serial interupts

CLR RI
SETB REN ;Enable Serial Reception of
; data

RET
;---------------------------------------------------

List of 15 messages in thread
TopicAuthorDate
Serial Communication            01/01/70 00:00      
   RE: Serial Communication            01/01/70 00:00      
      RE: Serial Communication            01/01/70 00:00      
   RE: Serial Communication            01/01/70 00:00      
   RE: Serial Communication            01/01/70 00:00      
   RE: Serial Communication            01/01/70 00:00      
   sorry 12:39 + 12:40 same, 12:43 other            01/01/70 00:00      
   RE: Serial Communication            01/01/70 00:00      
      RE: Serial Communication            01/01/70 00:00      
   RE: Serial Communication            01/01/70 00:00      
      RE: Serial Communication            01/01/70 00:00      
         RE: Serial Communication            01/01/70 00:00      
            RE: Serial Communication            01/01/70 00:00      
               RE: Serial Communication            01/01/70 00:00      
                  RE: Serial Communication            01/01/70 00:00      

Back to Subject List