EASy68K  
It is currently Sat Dec 15, 2018 9:43 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: NEED HELP ON A LAB!
PostPosted: Tue Apr 26, 2011 10:38 pm 
Offline

Joined: Tue Feb 22, 2011 11:53 pm
Posts: 2
I have a lab to create for school. The tasks are:

-Prompt an operator to input a series of characters, up to 160 (sentence,quote)...this should show up in Terminal
-Hit Enter on the keypad and the text should print to the LCD, a character at a time (.5 second delay).
-Only 20 characters per line, 4 lines total
-If inputed text is larger than 80 characters...it should display first 80, delay, clear and display the remaining characters.

This is what I have so far, basically the beginning of what the Professor started us with (2 subroutines):

STATREGR EQU $010002
XMIT EQU $010000
CR EQU $0D
LF EQU $0A
ST EQU $00
STATREGT EQU $010003
RECREG EQU $010001
INPORT EQU $020001
OUTPORT EQU $020001
ORG $1000
START:











**********************************************************************
SUBRTNE1:
MOVE.L #MESSAGE,A1 ;first instruction of program
WAIT MOVE.W STATREGR,D1 ;test TDRE bit 3 of STATREGR
AND.W #0008,D1 ;transmit data register empty?
BEQ WAIT
MOVE.W (A1)+,D0
ROL.W #8,D0
MOVE.B D0,XMIT ;sends a character
ROL.W #8,D0
WAIT1 MOVE.W STATREGR,D1 ;test TDRE bit 3 of stareg
AND.W #0008,D1
BEQ WAIT1
MOVE.B D0,XMIT ;sends another character
BNE WAIT ;checks for the st = string terminator

TRAP #14

* Variables and Strings

MESSAGE DC.B 'Hello, World! This is DE-1.',CR,CR,LF,LF,ST,ST

**********************************************************************
SUBRTNE2:
CLR.L D1
GETCH: BTST.B #0,STATREGT ; Test the RDRF bit to see if a character is in the UART waiting for de-serilization of the incoming bit stream

BEQ.S GETCH ; Branch back until Receive Data Register is full
MOVE.B RECREG,D1 ; Character received and placed into D1
AND.B #$7F,D1 ; Mask off the parity bit so that it is just ASCII
MOVE.B D1,OUTPORT ; Write the byte to the LED readout displays
BRA START ; Just do it again and again

END START ; last line of source


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 27, 2011 12:26 am 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
Well that code isn't going to get you far, they aren't real standalone subroutines (they don't return), one for outputting a string to a serial port, and another to read a character from a serial port and stick it into an LED register.

You're going to have to find some more information about your board, we have no idea from your post about the board you are using, it's peripherals, how to communicate with the LCD (presumably an 40x4 type display at a guess). What documentation do you have for the board?

Start by building your own routines to input the string from the serial port, echoing back each character until you get a RETURN/ENTER.

You will need to modify and complete the two subroutines you have to be more general getchar and putchar type functions.

You will need to create some routines to clear, navigate and print data to the LCD.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 27, 2011 1:41 am 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
Is your board a softcore 68K running on an Altera board?

Based on a quick analysis of provided code, haven't test
Code:
**********************************************************************
* Clive's Simple Board Support Package for the ????
**********************************************************************

CR      EQU     $0D             ; Carriage Return
LF      EQU     $0A             ; Line Feed

                                ; UART Model?
XMIT    EQU     $010000         ; UART Transmit Register
RECREG  EQU     $010001         ; UART Receive Register
STATREG EQU     $010003         ; UART Status Register

INPORT  EQU     $020001         ; 8 Switches/Buttons?
OUTPORT EQU     $020001         ; 8 LEDs

        ORG     $1000
START:

        LEA     MESSAGE,A0      ; Address of message string
        BSR     PUTS

ECHO    BSR     GETCH           ; Echo back serial input until CR or LF
        CMP.B   #CR,D0
        BEQ     DONE
        CMP.B   #LF,D0
        BEQ     DONE
        BSR     PUTCH
        BRA     ECHO

DONE    TRAP    #14             ; Halt Board? Trap to Monitor

**********************************************************************
* Output character in D0 to UART

PUTCH   BTST.B  #3,STATREG      ; Test TDRE bit to see if transmit buffer empty
        BEQ     PUTCH           ; Branch back until Transmit Data Register is empty
        MOVE.B  D0,XMIT         ; Send a character
        RTS                     ; Return

**********************************************************************
* Output string pointed to by A0, destroys D0 and A0

PUTS    MOVE.B  (A0)+,D0        ; Get next character from string
        BEQ     PUTS1           ; End-of-string NUL detected
        BSR     PUTCH           ; Output character
        BRA     PUTS            ; repeat
PUTS1   RTS                     ; Return

**********************************************************************
* Get character from UART in D0 (7-bit)

GETCH:  BTST.B  #0,STATREG      ; Test RDRF bit to see if receive buffer full
        BEQ.S   GETCH           ; Branch back until Receive Data Register is full
        MOVE.B  RECREG,D0       ; Character received and placed into D0
        AND.B   #$7F,D0         ; Mask off the parity bit so that it is just ASCII
        RTS                     ; Return

**********************************************************************
* Variables and Strings

MESSAGE DC.B    'Jello World! If Bill Cosby had invented the first C program',CR,LF,0

**********************************************************************

        END     START           ; last line of source, code entry point


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 28, 2011 9:54 pm 
Offline

Joined: Tue Feb 22, 2011 11:53 pm
Posts: 2
Thanks Clive! That is half of the battle for me! The terminal shows up everything I type with no problem....I now just have to get it to print to the LCD Screen when I hit ENTER (along with the restrictions)....If you need information on my board...I am using an Altera (Cyclone II FPGA Starter Board) with an Adapter board (DE1 68EC000) that has an LCD. My PC is connected with the board via a serial cable.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 28, 2011 11:55 pm 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
Do you have any documentation for the board, I'm not able to find much on Google.

Do you have any more details on the UART, is it an FPGA implementation?

What LCD module are you using? How is it connected? Do you have addressing information, or a schematic?


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 4 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:  
cron
Powered by phpBB® Forum Software © phpBB Group