HC11 LCD Display problem

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

Thanks Peter

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 don't see how any of that works towards solving the first problem you mentioned. In fact it's likely to worsen it.

Reply to
Garrett Mace

I take that back, the eleventh line from the end of your listing may help somewhat.

Reply to
Garrett Mace

Thanks for your real helpful advise.

Reply to
Peter Pohlmann

Lighten up, it was funny. Maybe.

Anyway in the third line it looks like you're only loading one byte into your message table, and never setting a stop character ($00 or $04) at all! So the first two letters which will be "FF" will display fine, but when the loop comes around to load more characters or detect a stop character, you've set nothing. Therefore the program will spit out whatever happens to be in that memory location and won't quit until it finds a $00 or $04.

At least that's my feeble, never-having-used-an-HC11-myself opinion.

Hope that helps.

(hee hee, don't forget to strip that upper, uh, "nibble")

Reply to
Garrett Mace

Hey that was helpful. Thanks for the advise.

Reply to
Peter Pohlmann

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