Trying to interface a 6551 to my pc's serial port
Trying to interface a 6551 to my pc's serial port
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.
Hi ioncannon
can you remind us what kind of debugging equipment you have to hand?
have you changed the character you send and found that it does change the character you receive? That would be quite positive: it means you have data transmission but something wrong with flow control
are you sending several characters or do you only try to send one? it isn't clear from your code snippet.
thanks
Ed
can you remind us what kind of debugging equipment you have to hand?
have you changed the character you send and found that it does change the character you receive? That would be quite positive: it means you have data transmission but something wrong with flow control
are you sending several characters or do you only try to send one? it isn't clear from your code snippet.
thanks
Ed
- GARTHWILSON
- Forum Moderator
- Posts: 8774
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
ioncannon,
Put [code] and [/code] around your code so the spaces you put in for readability won't get eaten up. (I did a different trick here to make them show instead of doing their job.)
You might need to put a capacitor in the 65c51 circuit to make it work right. See http://www.6502.org/users/garth/project ... chematic=4
Put [code] and [/code] around your code so the spaces you put in for readability won't get eaten up. (I did a different trick here to make them show instead of doing their job.)
You might need to put a capacitor in the 65c51 circuit to make it work right. See http://www.6502.org/users/garth/project ... chematic=4
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Trying to interface a 6551 to my pc's serial port
ioncannon wrote:
x86? We ain't got no x86. We don't NEED no stinking x86!
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Trying to interface a 6551 to my pc's serial port
ioncannon wrote:
Nevermind, found out I was using the wrong capacitors for the max232.
x86? We ain't got no x86. We don't NEED no stinking x86!
BigEd: I didn't have 1uf capacitors on hand so will test today when I pick em up. Only thing I noticed is a random character (usually a Cyrillic y or something) appears on powerup, and if TX is connected by itself (w/o RTC or CTS) it starts to output the y over and over. However an X should be being sent.
BigDino: Sorry, basically I send one character down the serial line, and then output a ! onto the LCD screen, when the register empties. It seems to be stuck waiting for the register to empty. Yea the circuit said 10u which threw me off. Should have read the datasheet instead. Hopefully it didn't kill the chip.
Garth: Does that say 22pf?
BigDino: Sorry, basically I send one character down the serial line, and then output a ! onto the LCD screen, when the register empties. It seems to be stuck waiting for the register to empty. Yea the circuit said 10u which threw me off. Should have read the datasheet instead. Hopefully it didn't kill the chip.
Garth: Does that say 22pf?
- GARTHWILSON
- Forum Moderator
- Posts: 8774
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Super, now it's outputting Xs onto the terminal
. I can now being actually coding a monitor or something! Thank's Garth about the info with the 22pf cap, wasn't working w/o it.
So there was a lot of confusion I had with 10u and 1uf. I thought f was the unit and u just ment micro? Don't know much about capacitors (just looking through the 8+ kinds is intimidating lol. At least I know for future use.
So there was a lot of confusion I had with 10u and 1uf. I thought f was the unit and u just ment micro? Don't know much about capacitors (just looking through the 8+ kinds is intimidating lol. At least I know for future use.
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Trying to interface a 6551 to my pc's serial port
ioncannon wrote:
So there was a lot of confusion I had with 10u and 1uf. I thought f was the unit and u just ment micro? Don't know much about capacitors (just looking through the 8+ kinds is intimidating lol. At least I know for future use.
BTW, a one farad capacitor can store a lot of energy. If you had one that could be charged to, say, 250 volts and then shorted it out, the resulting discharge would be like a shotgun blast.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Trying to interface a 6551 to my pc's serial port
BigDumbDinosaur wrote:
You may also see the symbol mf, which is the same as µf.
André
- GARTHWILSON
- Forum Moderator
- Posts: 8774
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Trying to interface a 6551 to my pc's serial port
fachat wrote:
BigDumbDinosaur wrote:
You may also see the symbol mf, which is the same as µf.
André
x86? We ain't got no x86. We don't NEED no stinking x86!
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
GARTHWILSON wrote:
Yes, and the production workers at our company kept writing MF, and I kept kidding them about a capacitor the size of a car (10^12uF per MF).
x86? We ain't got no x86. We don't NEED no stinking x86!