floating point coprocessor
jonesdeere
Posts: 5
Hi folks,
This is my first forum post.··I am doim doing ym senior project rhis semester at the University of memphis were I am an Electronics Engineering Technology· major.· this is my first ever basic stamp programming experience and the only other microcontroller I have ever programmed is the 68HC11.· several of my professor suggested using a Basic Stamp.··I need some help with programming· because i amrunning out of time.··I am designing a trailer weight meassurement system.· Here are the specifics of my project:
1. I need to be able to ask the user to input a weight (up to a 5 digit number) for three variables: Tongue,· Max Trailer, Axle. those values need to be stored for a later comparison to the actual values obtained from the weight sensors.
2. the weight sensors have a 0.5-5.5vdc output so·an analog to digital converter will have to be used.· I have·to use the following formula to obtain the weight from the weight sensors:
··· weight= ((volts-.5)*40)*PI()*((d^2)/4)
············ where d= diameter (which is a constant)
3. I purchased a floating point·coprocessor·to preform the calculations but I am lost as to how to program it.· I do know that it has a buit in 12-bit ADC which is good enough for this project.
4.··After the Analog to Digital converersions are done and converted to weight, the values form sensor one (tongue weight) and sensor two (axle weight)must be added together and stored in another memory location (max trailer). Sensor 1 should be within 10% to 15%·of the total value·of the two sensors (this will be known as·weight balance).·
5.··A 4*20 Parallax LCD screen will be used to display the following floating point values: tongue weight, axle weight, weight balance, and max trailer.these values will be displayed one per line consistently excet for when the "overload" message is diaplayed.
6. If tongue weight >= Tongue,· max trailer >= Max Trailer, or axle >= Axle, then dispaly a flashing·"Overload" message on the screen.·
Any programming help or advice would be much appreciated.
Steven
This is my first forum post.··I am doim doing ym senior project rhis semester at the University of memphis were I am an Electronics Engineering Technology· major.· this is my first ever basic stamp programming experience and the only other microcontroller I have ever programmed is the 68HC11.· several of my professor suggested using a Basic Stamp.··I need some help with programming· because i amrunning out of time.··I am designing a trailer weight meassurement system.· Here are the specifics of my project:
1. I need to be able to ask the user to input a weight (up to a 5 digit number) for three variables: Tongue,· Max Trailer, Axle. those values need to be stored for a later comparison to the actual values obtained from the weight sensors.
2. the weight sensors have a 0.5-5.5vdc output so·an analog to digital converter will have to be used.· I have·to use the following formula to obtain the weight from the weight sensors:
··· weight= ((volts-.5)*40)*PI()*((d^2)/4)
············ where d= diameter (which is a constant)
3. I purchased a floating point·coprocessor·to preform the calculations but I am lost as to how to program it.· I do know that it has a buit in 12-bit ADC which is good enough for this project.
4.··After the Analog to Digital converersions are done and converted to weight, the values form sensor one (tongue weight) and sensor two (axle weight)must be added together and stored in another memory location (max trailer). Sensor 1 should be within 10% to 15%·of the total value·of the two sensors (this will be known as·weight balance).·
5.··A 4*20 Parallax LCD screen will be used to display the following floating point values: tongue weight, axle weight, weight balance, and max trailer.these values will be displayed one per line consistently excet for when the "overload" message is diaplayed.
6. If tongue weight >= Tongue,· max trailer >= Max Trailer, or axle >= Axle, then dispaly a flashing·"Overload" message on the screen.·
Any programming help or advice would be much appreciated.
Steven
Comments
2) It's a nice project and you've divided up your tasks very nicely. One thing missing is how you plan to have users enter the weights. Are you going to use an attached PC? Will you have a keypad? If so, how will you interface it?
3) I suggest you take each of these tasks in turn and get each to work separately, then you can combine them. There are examples, usually linked from the specific product page on Parallax's webstore. I suggest you familiarize yourself with the series of Nuts and Volts columns that are downloadable from the Parallax website (under the Downloads menu item). Several of them cover topics you'll need (like scanning keyboards and ADCs).
4) I suggest you use one of the Stamps in the BS2p series (BS2p / BS2pe / BS2px) because of their additional memory, particularly the scratchpad RAM.
5) Regarding the floating point coprocessor ... Read the manual, then try the examples, then start taking bits and pieces from the examples to do your calculations.
6) You have a lot of work ahead of you and a lot of useful learning. Take small steps. Understand what you're doing before moving on to the next, more complicated thing.
7) In programming, get used to using the Debug window to display intermediate results and status reports ... like "Just passed label X" or "Now doing Y". Once you see how to use it, you can use the LCD display to do the same thing.
I am about through writing the program.·Once I get the values written from the floating point coprocessor to the parallax serial lcd, I will be done with the program.· The ·floating point coprocessor is setup to convert the results of the its calculations to ASCII strings that are 5 characters long.· These strings come in through the SHIFTIN command as a variable named dataWord.· These values display easily·in the debug window but do not display at all on the serial lcd. How do I solve this problem?
also, the way the code is written currently, everytime the values are updated, the screen is cleared an the labels a written to the screen again. Is there any way to make the labels static· while the incoming values are constantly being updated?
You may notice that there is a lot of code commented out, but ths is my very first basic stamp project and·I didnot have time to go throught the learning excerises since the project is due Nov. 16, 2007.
Any help would be much appreciated.
Thanks,
Steven········
I just figured out how to keeep the labels static while the data values are changing.
The Serial lcd only shows the last digit of the incoming five digit number.·The debug window shows all five digits of the incoming data.· How can·I fix this?
Any help would be much appreciated.
Thanks,
Steven