Society of Robots - Robot Forum
Software => Software => Topic started by: BANE on July 16, 2008, 04:44:24 PM
-
Hello, this is really simple. I have a sharp IR sensor thats value is set to a byte. What i want to do is convert this number to inches and the tricky part (what i really wanted input on) if you can make a program filter or decipher or something sense objects lease than 6". Any ideas?
Bane
-
http://www.acroname.com/robotics/info/articles/irlinear/irlinear.html (http://www.acroname.com/robotics/info/articles/irlinear/irlinear.html)
note: in the results section the math is based on 10-bit a2d where on the $50 robot mcu is using 8-bit
however in the avrlib a2d.h file there are functions for both.
-
Figure out what voltage your sensor outputs when something is 6" away and have your program do something if the output voltage ever equals or exceeds that amount (assuming that by "lease than" you really mean "less than").
- Ben
-
Here is a related question. I've been using hex workshop and parsing the file. I often get confused on when to use a byte or unsigned int or short to fit the data into structures that I'm parsing. Little endian also screws me up. Can anyone explain when to use these data types for different fields in a hex file.
Thanks,
-
Why are you working directly with hex files?
-
I work with hex files to reverse engineer and troubleshoot products.
-
If you're looking at the flash hex file, it contains machine instructions. You basically need to figure out how to generate the assembly from it. Open it in AVR Studio and it will do this for you. I don't think you're going to achieve anything all that productive by trying to troubleshoot or reverse-engineer hex files directly. I imagine you could probably write the program itself faster than you could decode the hex and figure out how the assembly works.
If you're looking at EEPROM hex, it contains data in whatever format the user decided to store it in. There's no way to tell from the hex file itself what the data means or what the data types are.
- Ben
-
BANE, you can use my code straight from my Axon software:
http://www.societyofrobots.com/robotforum/index.php?topic=2822.msg36335#msg36335