Step 10Tuning the Meter Calibration Arrays
The 2 arrays are named m_cal (used with minute meter) and h_cal (used with hour meter). The 12 members of the array represent the number of clock pulses required to move the meter movement one major division. In the case of the hour meter, this is one hour. In the case of the minute meter, this is 5 minutes. The period for the PWM for both meters is the same. It is 10000 clock pulses. The sum of all 12 members of a given tuning array will be less than the period. I tried to leave about 10% of the PWM period as head room. So typically the arrays will sum to about 9000.
The minute scale has 5 sub-divisions (1 min) per major division (5 mins). The hour meter sweeps every major minute division (5 mins), so there are 12 sub-divisions for the hour meter per each major division (1 hr). For this reason the numbers in m_cal should be divisible by 5, and the numbers in h_cal should be divisible by 12. This isn't an absolute requirement, but using other numbers will result in remainders being dropped and could cause confusion.
Let us look at an example. If the hour array (h_cal) is equal to h_cal[] = {720, 708, 696, 736, ...}, to move the meter to 3 O'clock you need to set the PWM pulse count to the sum of 720, 708, and 696, which is equal to 2124. If you were at one O'clock and wanted to go half way between one and two you would add 360 (708 divided by 2 and rounded up to the next number divisible by 12) to 720.
The arrays that are in the program should be close to what you need regardless of the meter sensitivity you use, since you change the resistors to change the current provided to the meters. You should only have to tune them up.
How to tune the meter cal array:
Step 1:
We will start with the minute meter. To make things easier we will change the minute advance from 1 minute per button push to 5 minutes per button push. Locate in the code the following lines and un-comment them. They are part of the port_1 interrupt service routine.
// for (int j = 1; j <= 4; j++) // inc 4 mins Uncomment these 4 lines when tuning m_cal
// {
// one_min();
// }
Disconnect the battery pack of the project board and make the "spy-by-wire" connections between the project board and the Launchpad. Load the modified program onto the MSP430. Now everytime we push the minute increment button the minute meter will jump 5 minutes instead of 1.
Step 2:
Remove the "spy-by-wire" connections form the project board test points and reconnect the battery pack. Press the Reset button. Next adjust the zero of the meter. Then press the minute increment button and observe where the meter comes to on the scale. It should be close to 5 minutes. Write down whether it is less than 5, exactly at 5, or greater than five. Press the minute increment button again and determine how close to 10 minutes it is. Do this to about 20 minutes (4 button presses).
Step 3:
Disconnect the battery pack of the project board and make the "spy-by-wire" connections between the project board and the Launchpad. Using your notes adjust the first four members of m_cal based on what you observed. If the meter was higher than expected then adjust the member down. If the meter was below what you expected adjust the member up. Start from the lower end of the scale and move up. If you see a trend where each time you push the button the difference becomes greater from the desired point reduce all the numbers. If the first one is off a little and the others seem to be off about the same offset, than adjust the first member that is off. I usually make adjustments of 5 or 10, unless I am way off then I make adjustments of 20. After you have made the adjustments to m_cal, enter the debugger and download the changes to the chip.
Step 4:
Remove the "spy-by-wire" connections form the project board test points and reconnect the battery pack. Observe the results of the changes you made. Repeat steps 2 (without adjusting the meter zero), 3, and 4 as needed, slowly moving up the scale (25 minutes to 60 minutes) until every time you hit the minute increment button, the meter goes exactly to a 5 minute major division of the scale.
Step 5:
When you are happy with the tuning of the minute meter you can move to the hour meter. I suggest that you re-comment the 4 lines we uncommented in step 1 and make sure the changed code gets back on the chip.
Step 6:
The tuning of the hour meter h_cal array is similar to what you did on minute meter. When you hit the hour increment button it should jump to the next hour on the scale. The adjustments should be multiples of 12 instead of multiples of 5. I typically make adjustments of 12 and 24.
I know this procedure sounds difficult, but it is really simple once you determine how much the meter will move to your adjustment. The whole thing should take no more than 30 minutes.
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|
















































