Jump to content
ELFORUM - Forumul electronistilor

Convertire dec to hex


Mihai Popa

Recommended Posts

Buna ziua.Va rog sa ma ajutati in a converti un numar din dec in hex.Lucrez in MikroBasic pentru PIC.Practic ma intereseaza codul pe care trebuie sa il implementez in PIC.Va multumesc.

Link to comment
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

  • Mihai Popa

    3

  • francezu

    2

Popular Days

Top Posters In This Topic

Multumesc de raspuns.Treaba sta asa:vreau sa fac un ceas cu afisare cu tuburi Nixie.Fiecare tub este comandat de catre un 74141.Ceasul este cu DS1307.Ceea ce citest de la DS1307 este in hex si fac conversia in dec pentru a afisa pe tub.Acum as dori sa fac conversia inversa pentru a seta ceasul din butoane si a-l scrie in DS1307.conversia din hex in dec o fac cam asa:sec = ((sec and 0x70) >> 4)*10 + (sec and 0x0F)Ma intereseaza invers.Va multumesc.

Link to comment

Ceea ce citesti din DS1307 nu este in hexazecimal ci in BCD.

Pentru conversia din BCD in zecimal si invers in compilator ai functiile Bcd2Dec si Dec2Bcd.

Exemplu luat din help:

dim a, b as byte...a = 22b = Dec2Bcd(a) ' b equals 34
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines