Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help with 68HC11 and Assembler

Status
Not open for further replies.

user01

New Member
My project is for MC68HC11. It's almost complete.

I’m adjusting RTC with keypad - scan the keypad and compare every key if it’s pressed. If it’s pressed I write his value in variable and display it on the LCD.

This is working without problems:
adj21: jsr keypad_wytec
stab Oldkey
ldaa Oldkey
cmpa #$03
bne adj21
jsr adj1
rts

adj1:
ldaa #$32
staa value
ldx #value
ldab #1
jsr lcd_line1
rts


I want to do the following thing, but I don’t know how: Compare if a key is pressed and write its value to “Index Register Y”. After than again to compare if a key is pressed and writes the second value again in “Index Register Y”. I know how to make the compares. I don't know how to write to “Index Register Y” and after that read the value.
Example: press 2 and write to LCD; after that press 5 and display 25 on LCD.
 
Aren't there a family of one byte instructions that transfer bytes from Accumulator A or Accumulator B to the index registers X and Y:
Code:
    TYA    ; Trasnfer Y to A
    TAY    ; Transfer A to Y
I don't think it could be much simpler. BTW, Do you have an instruction set referance for the 68HC11? Something like:

**broken link removed**
 
Last edited:
I've this thing: **broken link removed**

I read about this calculator where is done the same thing, but I didn't understand it: **broken link removed**
 
What you have is a datasheet for the part, and that is fine as far as it goes. What you are missing is the instruction set reference for which I discovered the link after considerable effort. Please follow that link and examine the document before you try to convince me of the sufficiency of the documents that you currently have access to.
 
I'm adjusting RTC with keypad. Show the press key on the LCD.

Example: I compare if the press key is $5 - if it's pressed I write it to variable and show on the LCD. After that I compare if another key is pressed, write its value in second variable and show it on the next position on the LCD.

I don't know how to do the following thing: I have the value $5 in one variable and $9 in other variable. I have to write in the RTC $59. How to do this?

After the call of "keypad_wytec": if a key is down, the carry bit =1 and the accumulator B holds the key number, if no key is down the carry bit =0


adjustment:
jsr lcd_ini_blink
ldx #str3
ldab #40
jsr lcd_line1
adj21: jsr keypad_wytec
stab Oldkey
ldaa Oldkey
cmpa #$05
bne adj21
staa value1
adda #$30
jsr adj1
adj22: jsr keypad_wytec
stab Oldkey
ldaa Oldkey
cmpa #$09
bne adj22
staa value2
adda #$30
jsr adj2
rts

adj1:
staa str4
jsr show_strings1
rts

adj2:
staa str4+1
jsr show_strings1
rts

str4 fcc ' '

show_strings1:
pshx
ldx #str4
ldab #2
jsr lcd_line2
pulx
rts


This code is only for test if everything is working.
 
Did you donload and read the instruction set reference from the link that I provided? Is RTC an abbreviation for "Real Time Clock"? Which one are you using? It is quite impossible to help you unless you provide such information. Do you have a schematic for your system? Can you post it?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top