Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/06/09 20:29
Read: times


 
#162153 - Ok I'm here now.......
Responding to: ???'s previous message
I have a memory array that will be counting in hex. So using an arbitrary number that has been assigned as a long (count will exceed 64k and rollover is not an option) an example will be 0x1388h > 5000 decimal.

My bit pattern array is set as:



ulong Count[] = {0x1388};

code uchar DataLookup[] ={
0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x67, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71, 0x6F, 0x76, 0x30, 0x0E, 0x80,
0x38, 0x80, 0x80, 0x5C, 0x73, 0x80, 0x80, 0x6D, 0x80, 0x3E, 0x80, 0x80, 0x80, 0x80,
0x80};

 


So my only problem is getting a conversion for the 0 array index parser for the hex value in the array. I know I have to convert it from hex to decimal and store each digit in a separate memory array and then push them out one digit at a time over the communication bus to the display.

I was going to try:


ulong Ascii;
Ascii = Count[0]; 
 


and convert the Ascii to a string, but I get compile error.

I can't seem to convert it from hex to ASCII. My other hex to ASCII did it nibble by nibble which was ok for that app, but this new project requires that I display the information in decimal according to the bit patterns in the array.

SO that is where I'm stuck, typically Keil could just use a 'string' and do the conversion automatically, but I have to convert the number. Not sure how to handle Count[] to ASCII. I sprintf() appropriate here? My understanding was that those functions require a lot of overhead to process in the 8051. Any pointers to solve this seemingly easy issue?




List of 12 messages in thread
TopicAuthorDate
Looking for a fast elegant solution to an SAA1064            01/01/70 00:00      
   several ways            01/01/70 00:00      
   Simple Table Lookup            01/01/70 00:00      
      Constructing the table symbolically            01/01/70 00:00      
      That looks like it will do the trick            01/01/70 00:00      
      Ok I'm here now.......            01/01/70 00:00      
         first convert to decimal, then to ASCII            01/01/70 00:00      
            So...            01/01/70 00:00      
               Keep track of binary/BCD/hex/ASCII            01/01/70 00:00      
                  Final answer and it works            01/01/70 00:00      
                     But '0' - 0x30 is zero :)            01/01/70 00:00      
               not exactly            01/01/70 00:00      

Back to Subject List