Number to hex and include the decimal

crazynight

Senior Member
I am playing around with one of these displays http://www.ebay.co.uk/itm/380464860626?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649.

I have surprised myself and have it working fine to display digits, what I am trying to do now is have it display say the temperature or time.

if I use a lookup i can manage to lookup the value and convert it to a hex code and then send it to the display all is fine apart from the decimal place.

Should I just use a separate lookup for the 2nd digit which takes into account of the decimal or can you add hex codes together?

Sorry no code as I am away from my PC with all my code.

I am happy to be directed towards a manual or another thread as i am unable to find anything
 

geoff07

Senior Member
Bearing in mind that the Picaxe doesn't do real numbers, only integers, you will have to send the two parts either side of the point, and the point itself, as separate data items. But that should be simple as you must already have the integer and fractional parts separate in different variables.

If you can explain a bit more about where the data is coming from and what you are doing with it you will get more helpful answers!
 

inglewoodpete

Senior Member
if I use a lookup i can manage to lookup the value and convert it to a hex code and then send it to the display all is fine apart from the decimal place.

Should I just use a separate lookup for the 2nd digit which takes into account of the decimal or can you add hex codes together?
It will probably be a matter of reading the bit pattern for the 7-segment digit and then OR'ing the decimal point bit to turn it on when required.

Edit: after checking the data sheet, the DP appears to mapped to bit 0 (if mapped at all). In the case, use code like the following:

Code:
Read <digit pattern address in EEPROM>, b16
b16 = b16 Or %00000001     'Turn decimal point on.
Edit2: the data sheet discusses the use of ULN2003 as the segment driver. Unfortunately, this is only a 7-bit device. so probably no decimal points:(
 
Last edited:

crazynight

Senior Member
It will probably be a matter of reading the bit pattern for the 7-segment digit and then OR'ing the decimal point bit to turn it on when required.

Edit: after checking the data sheet, the DP appears to mapped to bit 0 (if mapped at all). In the case, use code like the following:

Code:
Read <digit pattern address in EEPROM>, b16
b16 = b16 Or %00000001     'Turn decimal point on.
Edit2: the data sheet discusses the use of ULN2003 as the segment driver. Unfortunately, this is only a 7-bit device. so probably no decimal points:(
the device is working over SPI

you only send 4 digits the DP's are within that transmission.
eg
%11111100 will give you "0" while %11111101 will display "0." I am converting these 8 bits to hex to reduce the size of the program although thats not an issue.
 
Top