Image Map Image Map
Results 1 to 3 of 3

Thread: Comands for polling Serial data rs-232 port ?

  1. #1

    Default Comands for polling Serial data rs-232 port ?

    I cant find anything on how to poll the serial port. I saw a reference to needing machine code but not list of the commands. Any help would be appreciated.

  2. #2

    Default

    Quote Originally Posted by bobconan View Post
    i cant find anything on how to poll the serial port. I saw a reference to needing machine code but not list of the commands. Any help would be appreciated.
    Here's what I use. I think it originally came from one of Bill Barden's books but not sure now.

    Code:
    ;these are the rs232 ports
    modem		equ	232
    config		equ	233
    status		equ	234
    data		equ	235
    
    
    ;initialize uart
    ; input a is baud rate
    rsinit::
    
    	out	(modem),a	;reset uart
    	out	(config),a	;set baud
    	ld	a,0e4h
    ;even parity,8 bits, 1 stop bit
    	out	(status),a
    	ret
    
    ;receive byte
    rsin::
    	in	a,(status)	; check status
    	bit	7,a		; byte ready
    	ret	z		; no, return z flag set
    	in	a,(data)	; get byte into a
    	ret			; return in a with z reset
    
    ;transmit byte
    rsout::
    	ld	c,a		;save char in c
    notrdy	in	a,(status)	;check status
    	bit	6,a		;ready?
    	jr	z,notrdy	;no
    	ld	a,c		;get char in a
    	out	(data),a	;transmit it
    	ret
    
    	end

  3. #3
    Join Date
    Mar 2017
    Location
    Eindhoven, The Netherlands
    Posts
    17

    Default

    The above is correct for the model 1, III/4.
    For a Model II, 12, etc it is a bit more complicated to program the SIO, but then polling Serial Port A or B is similar.

    Regards,
    LaserVision

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •