Question
I'm currently writing a program that asks for user input via command line that asks a user for an EEPROM address and 8-bit data to
I'm currently writing a program that asks for user input via command line that asks a user for an EEPROM address and 8-bit data to be stored inside the same address.
I currently have the assembly code that reads and writes the 8-bit data from the user and stores it in a predefined address which is then moved into a register.
The part I'm having trouble with is asking the user for the address where they want to have their 8-bit data stored. This is what I have so far inside the functions:
EEPROM_Write: sbic EECR,EEPE rjmp EEPROM_Write ; Wait for completion of previous write ldi r18,0x00 ; Set up address (r18:r17) in address register ldi r17,0x05 call UART_Get ; Used to get 8-bit user input lds r16, ASCII ; Set up user input in r16 out EEARH, r18 out EEARL, r17 out EEDR,r16 ; Write data (r16) to Data Register sbi EECR,EEMPE ; Write logical one to EEMPE sbi EECR,EEPE ; Start eeprom write by setting EEPE ret EEPROM_Read: sbic EECR,EEPE rjmp EEPROM_Read ; Wait for completion of previous write ldi r18,0x00 ; Set up address (r18:r17) in EEPROM address register ldi r17,0x05 ldi r16,0x00 out EEARH, r18 out EEARL, r17 sbi EECR,EERE ; Start eeprom read by writing EERE in r16,EEDR ; Read data from Data Register sts ASCII,r16 ret
Can someone give me some pointers on how to ask for user input and convert it into an address inside a register?
Thanks in advance.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started