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.

Using VRef as a D/A output

Status
Not open for further replies.

Azaruk

New Member
I am using SRF04 in a sonar application.

I need the range to be displayed on an LED bargraph - LM3914 prefrably.

I have the SRF04 echo captured through the CCP module, which results in a 16-bit value.

How do I scale the 16-bit value into a 4-bit representation to present to the VRef module to give me a voltage level proportional to the SRF04 echo signal length.

I'm sure there's a imple solution, but my mind has gone blank over this, and what little hair I have left is steadily being pulled out!

Any ideas?
 
'imple!!!

Nigel Goodwin said:
It's not even as difficult as 'simple' :D

Just use the top 4 bits of the 16.

Thanks Nigel. I'll try it. Looks too simple!! I didn't consider that, but began thinking about all sorts of high level maths and bit manipulations.

I have the utmost respect for those among us who can see the simplest solution. Thanks again.

As to 'imple - and a few other spelling errors, I could, of course, blame a faulty keyboard, but it was more a case of late nights, trying to type too fast, and not checking my post!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top