1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help with tuner programming!

Discussion in 'C' started by kimmerose, Mar 26, 2013.

  1. kimmerose

    kimmerose New Member

    Joined:
    Mar 26, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    hi.. need some help with my partial coding.. its such a huge code, but i am stuck on this particular part that i am posting. the situation is that i need to change the frequency on different channels (initially, the frequency are all the same for all channels)

    so to have the different freq for each channel, i defined the lowest FM for each channels. this seems to "work", but not really. because my lower FM (lower than the ones defined) are not included in the range.

    please help!

    Code:
    #define FM_MAX_1    (FM_LMT - FM_LOW_1)*2        // for ch 1
    #define FM_MAX_2    (FM_LMT - FM_LOW_2)*2        // for ch 2
     
     
    #define FM_LMT        1080        // for all ch available
     
     
    #define FM_LOW_2    879        // for ch 1
    #define FM_LOW_3    981        // for ch 2
     
     
    static uint max (void);
    static uint min (void);
     
     
    static uint max (void)
    {
        switch (ra_getRaBand())
            {
            case FM1:
                switch (ra_getPCH())
                {
                case 0:
                    break;
                case 1:
                    return FM_MAX_1;
                case 2:
                    return FM_MAX_2;
                default:
                    return FM_MAX_1;
                }
            case FM2:
                return FM_MAX_1;
            case FM3:
                return FM_MAX_1;
            default:
                return FM_MAX_1;
            }
    }    
     
     
    static uint min (void)
    {
        switch (ra_getRaBand())
            {
            case FM1:
                switch (ra_getPCH())
                {
                case 0:
                    break;
                case 1:
                    return FM_LOW_1;
                case 2:
                    return FM_LOW_2;
                default:
                    return FM_LOW_1;
                }
            case FM2:
                return FM_LOW_1;
            case FM3:
                return FM_LOW_1;
            default:
                return FM_LOW_1;
            }
    }
     
     
    /*the FM range must start from 87.5MHz and ends at 108.0MHz, therefore the FM_LMT is the highest fm range and FM_LOW is the lowest fm range. 
    Initially, the program has #define FM_LOW    875, and will display on LCD as 87.5MHz. Now the task is to change it to have different frequencies on each channels
    once the tuner is turned on. By using the method above, I am missing the low frequency (87.5MHz until what is set to be the lowest FM range, in this case, 
    until 87.9MHz and 98.1MHz*/
    
     

Share This Page