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.

converting hexadecimal to decimal in Oshonsoft

Status
Not open for further replies.
how do i do it ?

Its this subr from snippets

'convert the bin number to packed bcd for RTC write
'enter with temp1 holding the binary byte
'exit with temp1 holding the packed BCD byte
'also ascbfr1,ascbfr0 hold the ASCII value
bin2bcd:
tens = temp1 / 10
units = temp1 Mod 10
ascbfr1 = tens Or 0x30
ascbfr0 = units Or 0x30
tens = ShiftLeft(tens, 4)
temp1 = tens Or units
Return

If you dont want the digits to be ASCII, delete the two lines 0f OR 0x30
 
Its this subr from snippets

'convert the bin number to packed bcd for RTC write
'enter with temp1 holding the binary byte
'exit with temp1 holding the packed BCD byte
'also ascbfr1,ascbfr0 hold the ASCII value
bin2bcd:
tens = temp1 / 10
units = temp1 Mod 10
ascbfr1 = tens Or 0x30
ascbfr0 = units Or 0x30
tens = ShiftLeft(tens, 4)
temp1 = tens Or units
Return

If you dont want the digits to be ASCII, delete the two lines 0f OR 0x30
thanks ..... :)

also , watch my new video

https://www.electro-tech-online.com/threads/4017-running-led.112715/#post921693
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top