HC 11 Guru - Help please bin2ascii and lcd display

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 * TEXT STRING TERMINATED BY $00 OR $04 OR
*************************************************** 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

Reply to
Peter Pohlmann
Loading thread data ...

I can't help you with your virginity problem, but ...

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

formatting link

Reply to
Unbeliever

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...

Reply to
Garrett Mace

....

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

Reply to
Paul Burke

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

Reply to
Peter Pohlmann

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.