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
********************************************
******* 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 valuesBIN2ASC 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