Motorolla MC68HC11 Microcontroller-to convert a Hex digit.
Electronics Forum Index Electronics
Circuits, theory, electrons and discussions.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web ElectronicsHelp.net
Motorolla MC68HC11 Microcontroller-to convert a Hex digit.

 
Post new topic   Reply to topic    Electronics Forum Index -> Electronics General
Author Message
NiCeBoY



Joined: 02 Sep 2008
Posts: 6

Posted: Tue Oct 28, 2008 12:48 pm    Post subject: Motorolla MC68HC11 Microcontroller-to convert a Hex digit. Reply with quote

Hello,
I am require to write a program module to convert a Hex digit passed to it in the lower nibble of Accumulator A to its ASCII character code. The upper nibble should be treated as "don't care".
Return the ASCII code in Accumulator A and save it in a suitable memory location.
All other CPU register values are to remain unchanged.


Thanks in advance for your help...

Regards...

Back to top
View user's profile Send private message
neon



Joined: 25 Feb 2006
Posts: 598

Posted: Wed Oct 29, 2008 8:09 pm    Post subject: Reply with quote

You may end up making it all wrong but the idea still remain that you will know where the wrong is that is the process of learning. Take care
Back to top
View user's profile Send private message Send e-mail
NiCeBoY



Joined: 02 Sep 2008
Posts: 6

Posted: Thu Oct 30, 2008 7:16 am    Post subject: Reply with quote

Hello,
Thats allrite... but the problem is that this is due monday.. and its an assignment...


Anyway i finally got the answer for it...

The solution is

Quote:
clear the upper bits by doing an AND with immediate data 0x0F.
Then compare the remaining number with 9. If it's less than or equal to 9, then do an OR with 0x30H and that is the ASCII code.

If the number is greater than 9, then subtract 9 and then do an OR with 0x40H to get the ASCII code.


Now i got another task which is :

Quote:
to write a program module to convert a Hex byte passed to it in AccA to its ASCII coded word.
Return the word in AccD and then save it in a suitable area memory.
NB. This module affects AccA & AccB.


Can you help me out for this one...
I can't find the solution.. and whats the diference between the first and this one...
thanks u..

Back to top
View user's profile Send private message
NiCeBoY



Joined: 02 Sep 2008
Posts: 6

Posted: Mon Nov 03, 2008 10:13 am    Post subject: Reply with quote

thats allrite man.. i got help from other forum...
thx ya anayway...

bye
Back to top
View user's profile Send private message
 
Post new topic   Reply to topic    Electronics Forum Index -> Electronics General All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Home & Living New Topics
Contact Us
Powered by phpBB