Trying to interface a 6551 to my pc's serial port
Posted: Fri Apr 29, 2011 1:23 am
Hey again, the R65c51 I ordered finally arrived. Been trying to get it to work. I connected it up pretty much to how it's connected in this circuit
http://members.multimania.co.uk/leeedav ... index.html.
Only thing different is I wired the XTAL1 and 2 to a actual crystal. The crystal is rated at 1.84320mhz. I wired the phi2 to the clock.
From the MAX232, I wired the the RTS, CTS, TXD, and RXD lines into the holes in a DB25 null modem cable I had (was using it for my Amiga). Sadly only thing I get is a bunch of garbage once in a while.
Code (pretty much from that site, but changed the address:
; initialise 6551 ACIA
STA $6001 ; soft reset (value not important)
LDA #$0B ; set specific modes and functions
; no parity, no echo, no Tx interrupt
; no Rx interrupt, enable Tx/Rx
STA $6002 ; save to command register
; all the following 8-N-1 with the baud rate
; generator selected. uncomment the line with
; the required baud rate.
; LDA #$1A ; 8-N-1, 2400 baud
; LDA #$1C ; 8-N-1, 4800 baud
LDA #$1E ; 8-N-1, 9600 baud
; LDA #$1F ; 8-N-1, 19200 baud
STA $6003 ; set control register
Then I loop this forever, and output a ! after the STA.
LAB_WAIT_Tx:
LDA $6001 ; get status byte
AND #$10 ; mask transmit buffer status flag
BEQ LAB_WAIT_Tx ; loop if tx buffer full
LDA #"X"
STA $6000 ; save byte to ACIA data port
I get two ! to appear, then it just sits there.
Added:
Nevermind, found out I was using the wrong capacitors for the max232.
http://members.multimania.co.uk/leeedav ... index.html.
Only thing different is I wired the XTAL1 and 2 to a actual crystal. The crystal is rated at 1.84320mhz. I wired the phi2 to the clock.
From the MAX232, I wired the the RTS, CTS, TXD, and RXD lines into the holes in a DB25 null modem cable I had (was using it for my Amiga). Sadly only thing I get is a bunch of garbage once in a while.
Code (pretty much from that site, but changed the address:
; initialise 6551 ACIA
STA $6001 ; soft reset (value not important)
LDA #$0B ; set specific modes and functions
; no parity, no echo, no Tx interrupt
; no Rx interrupt, enable Tx/Rx
STA $6002 ; save to command register
; all the following 8-N-1 with the baud rate
; generator selected. uncomment the line with
; the required baud rate.
; LDA #$1A ; 8-N-1, 2400 baud
; LDA #$1C ; 8-N-1, 4800 baud
LDA #$1E ; 8-N-1, 9600 baud
; LDA #$1F ; 8-N-1, 19200 baud
STA $6003 ; set control register
Then I loop this forever, and output a ! after the STA.
LAB_WAIT_Tx:
LDA $6001 ; get status byte
AND #$10 ; mask transmit buffer status flag
BEQ LAB_WAIT_Tx ; loop if tx buffer full
LDA #"X"
STA $6000 ; save byte to ACIA data port
I get two ! to appear, then it just sits there.
Added:
Nevermind, found out I was using the wrong capacitors for the max232.