HC 11 Guru - Help please bin2ascii and lcd display

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Gurus,

I am a virgin and need some help here. I want to display the content of a
location on the LCD Display. Please have a look at the code and help me.
With the current progra the problem is that it displays correctly the value
at the first
2 postions of the display, but after these positions there is junk
displayed.

Below is the relevant code. IT is for an HC11

LDA #$01 ;CLEAR AND HOME
BSR WCTRL ;WRITE CONTROL BYTE TO LCD
LDA #%11111111 ; load something.. in this case the display should show FF
JSR BIN2ASC ; convert bin2ascii
STD 0,X
BSR LCDTEXT ; show it
SWI ; break here for now

***************************************************
* SEND A LINE OF TEXT TO LCD
* PASS START ADDRESS OF TEXT IN X
* TEXT STRING TERMINATED BY $00 OR $04
***************************************************
LCDTEXT PSHA
LCD LDAA 0,X ;GET BYTE FROM MESSAGE TABLE
CMPA #$00 ;Check for end of string
BEQ DLCD ;$00 OR $04
CMPA #$04
BEQ DLCD
BSR WDAT ;SEND CHARACTER TO LCD
INX
BRA LCD
DLCD PULA
RTS

********************************************
******* BIN TO ASCII ************
********************************************
*Converts 8 bit binary value in ACCA to ACII
*PASSED : Binary value in ACCA
*RETURNS: ASCII in D
*EFFECTS: ACCB is destroyed
********************************************
HEX_TABLE FCC "0123456789ABCDEF" ; Table for conversion values

BIN2ASC PSHA ; Save a copy of the input number on the stack
TAB ; Copy into ACCB
ANDB #%00001111 ; Strip the upper nibble of ACCB
CLRA ; D now contains 000n where n is the LS nibble
ADDD #HEX_TABLE ; setup for indexed load
XGDX
LDA 0,X ; GEt the LSnibble Character
PULB ; retrieve the input number into ACCB
PSHA ; put the LSNIBBLE into place
RORB ; Move the upper nipple into of the input number
RORB ; into the llower position
RORB
RORB
ANDB #%00001111 ; strip off the upper nipple
CLRA ; D now contains 000n where n is the msnibble
ADDD #HEX_TABLE
XGDX
LDAA 0,X ; Get the MSnibble character in ACCA
PULB ; retrieve the LSnibble character into ACCB
RTS



Re: HC 11 Guru - Help please bin2ascii and lcd display

Quoted text here. Click to load it
I can't help you with your virginity problem, but ...

Quoted text here. Click to load it
value
You are converting two characters to ascii, and storing them at the location
pointed to by the index register.

You are then calling a routine that copies characters from the location
pointed to by the index register until either a 00 or 04 character is found.
Unfortunately you are not putting either a 00 or 04 character at the end of
the text (two characters) that you wish to display.   The following code
just before the BSR LCDTEXT should cure your problem.

CLR 02, X    ; Put a terminator at the end of the desired text.

Of  course, later you might want to improve it by putting a 00 or
04character at the end of a variable length string.

Keep plugging away at it.

Cheers,
Alf

--
Alf Katz
snipped-for-privacy@remove.the.obvious.ieee.org
We've slightly trimmed the long signature. Click to see the full one.
Re: HC 11 Guru - Help please bin2ascii and lcd display
Quoted text here. Click to load it
location
found.
of


Ah, he didn't crosspost but did dupepost. I cleared him up on the problem
over in comp.robotics.misc about an hour ago, but picked on him a little bit
more for his word choice in communicating that he is inexperienced. ;-)  Too
mean...



Re: HC 11 Guru - Help please bin2ascii and lcd display

Quoted text here. Click to load it

....




You won't stay a virgin long that way...


Re: HC 11 Guru - Help please bin2ascii and lcd display
Guys,

thanks for the help.
Maybe one day I will be no virgin anymore.. but it always hurts the first
time :)

Thanks again, I will bug you in the near future again.

Peter


Quoted text here. Click to load it



Site Timeline