6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 01, 2024 9:41 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Jun 09, 2006 4:52 pm 
Offline

Joined: Wed Nov 24, 2004 6:24 pm
Posts: 26
Location: Adelaide
Hi, been a while since I've been here.

I found myself an Oceanic 1541 clone at my favorite electronics salvage shop a few weeks ago and threw together Douglas Beattie's DIY6502 SBC (minus the 6522, not enough room on the piece of board I used) to get back into 6502 programming.

I don't know what's going on but I can't seem to receive characters to the 6551 ACIA. I'm using a MAX232 chip for the RS-232 levels which works fine. If I remove the ACIA and 6502, and loop the RxD and TxD lines on the ACIA socket my terminal echo's characters correctly, so it's not that. I've checked the wiring plenty of times and haven't found any problems. I know it works fine because I can make it print "HELLO WORLD!!!" on the terminal nicely. Attaching an LED to the TTL RxD line shows data when I press keys on the terminal, so the ACIA is receiving the data, it's just not seeing it :?

Anyway, maybe Murphy's Law will kick in when I post this and I'll find the problem.

Here's the code I'm using in the ROM (Using the AS Macro Assembler):

Code:
        CPU     6502
        ORG     $F000

ACIA    EQU $D000       ; BASE ADDRESS OF 6551 ACIA

ACIAD   EQU ACIA+0      ; ACIA DATA
ACIAS   EQU ACIA+1      ; ACIA STATUS
ACIACMD EQU ACIA+2      ; ACIA COMMAND
ACIACTL EQU ACIA+3      ; ACIA CONTROL

START   NOP
        NOP
        NOP
        SEI                     ; NO INTERRUPTS
                                ; INITIALIZE ACIA
        STA     ACIAS           ; RESET ACIA
        LDA     #$8B            ; TRANSMIT AND RECEIVE, NO INTERRUPTS
        STA     ACIACMD
        LDA     #$1E            ; 9600 8 N 1, USE BAUD RATE GENERATOR
        STA     ACIACTL

        LDX     #$00            ; START OF STRING
LOOP    LDA     ACIAS           ; GET FLAGS
        AND     #$10            ; MASK TRANSMIT DATA FLAG
        BEQ     LOOP            ; WAIT FOR FLAG TO RAISE
        LDA     MESG,X          ; GET CHARACTER
        CMP     #$00            ; ZERO END OF STRING
        BEQ     ECHO            ; JUMP TO NEXT SECTION ON ZERO
        STA     ACIAD           ; SEND CHARACTER
        INX                     ; NEXT CHARACTER
        CLC                     ; ALWAYS BRANCH
        BCC     LOOP

ECHO    LDA     ACIAS           ; GET FLAGS
        AND     #$08            ; MASK RECEIVE DATA FLAG
        BEQ     ECHO            ; WAIT FOR FLAG TO RAISE
        LDX     ACIAD           ; GET CHARACTER FROM ACIA
ECHO1   LDA     ACIAS           ; GET FLAGS
        AND     #$10            ; MASK TRANSMIT DATA FLAG
        BEQ     ECHO1           ; WAIT FOR FLAG TO RAISE
        STX     ACIAD           ; ECHO CHARACTER TO ACIA
        CLC                     ; ALWAYS BRANCH
        BCC ECHO

MESG    BYT     "HELLO WORLD!!!",$0A,$0D,0

        ORG     $FFFC
        ADR     START



_________________
Check out my 8080 project: http://kaput.homeunix.org


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 09, 2006 5:10 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1745
Location: Sacramento, CA
try this:

Code:
...
...
      LDA     #$0B            ; TRANSMIT AND RECEIVE, NO INTERRUPTS
      STA     ACIACMD
...
...


This is how I init my 6551.

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 09, 2006 5:22 pm 
Offline

Joined: Wed Nov 24, 2004 6:24 pm
Posts: 26
Location: Adelaide
8BIT wrote:
try this:

Code:
...
...
      LDA     #$0B            ; TRANSMIT AND RECEIVE, NO INTERRUPTS
      STA     ACIACMD
...
...


This is how I init my 6551.

Daryl


That's how I did it as well, until I found #$8B in Douglas' code.

Tried it again with #$0B with no luck.

I forgot to mention that I have two ACIA's which act exactly the same.

Thanks.

_________________
Check out my 8080 project: http://kaput.homeunix.org


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 09, 2006 6:21 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1745
Location: Sacramento, CA
two suggestions:

Skip the software reset (I've never used it)

Since it transmits OK, create some test code to just send the contents of the status register. This might help you find out whats wrong.


Code:
       LDA     #$0B            ; TRANSMIT AND RECEIVE, NO INTERRUPTS
       STA     ACIACMD
       LDA     #$1E            ; 9600 8 N 1, USE BAUD RATE GENERATOR
       STA     ACIACTL

LOOP   LDA     ACIAS           ; GET FLAGS
       AND     #$2F            ; mask out bits to test (bits 0-5)
       ORA     #$40            ; make it a VALID ASCII CHR
       TAX
ECHO1  LDA     ACIAS           ; GET FLAGS
       AND     #$10            ; MASK TRANSMIT DATA FLAG
       BEQ     ECHO1           ; WAIT FOR FLAG TO RAISE
       STX     ACIAD           ; SEND CHARACTER
       CLC                     ; ALWAYS BRANCH
       BCC     LOOP


Now, watch the output when you send characters to see if the data rcv bit gets set, of there are any other errors, etc.

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 09, 2006 6:43 pm 
Offline

Joined: Wed Nov 24, 2004 6:24 pm
Posts: 26
Location: Adelaide
I tried a similar thing before I posted except with a hexadecimal subroutine, it gave zero's. This does the same (@'s). This is with and without the software reset. It's definitely getting the serial data because the LED flickers when I touch it to the RxD pin and hold down a key.

:x

_________________
Check out my 8080 project: http://kaput.homeunix.org


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 09, 2006 7:01 pm 
Offline

Joined: Wed Nov 24, 2004 6:24 pm
Posts: 26
Location: Adelaide
Different baud rates give the same result.

EDIT:

How interesting. I got so infuriated I bashed it (yeah I know...) and the characters went from @ to H to L, looking at my ASCII chart @ means nothing, H translates to "buffer full" and L translates to "buffer full and overrun". Looks like I'm on to something...

Another EDIT:

Would you belive, of all the pins to bend and not go into the socket, the RxD pin was sticking out. When I touch it it receives a character, at least that's something and it tells me the ACIA isn't dead.

_________________
Check out my 8080 project: http://kaput.homeunix.org


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 09, 2006 8:10 pm 
Offline

Joined: Wed Nov 24, 2004 6:24 pm
Posts: 26
Location: Adelaide
Ok, found the problem. The MAX232 must be faulty. I disconnected the data receive pins and wired them up to a trusty MC1489. It receives characters fine now.

What I don't understand is why the LED flickered (both when it was attached directly to +5v and GND) when I typed on the terminal.

I'll grab another MAX232 today (it's 5:30AM at the moment), hopefully it will work, else I'll try and squeeze the MC1489 onto the board somewhere.

_________________
Check out my 8080 project: http://kaput.homeunix.org


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: