HI-TECH C Compiler v9.63 code converting to MikroC Pro

Discussion in 'Homework Help' started by Chritoph8r, May 22, 2010.

  1. Chritoph8r

    Thread Starter Member

    Jan 19, 2010
    33
    0
    Hi Again I'm trying to built LC METER .my Friend (here) give
    me a 90% accurate LC meter Project but the problem is the code
    is created in HI-TECH C Compiler v9.63, I want to compile it in
    MikroC Pro. which I'm comfortable to use.


    here the code that make me thinking twice on how to convert:

    ISSUE: 1

    __CONFIG(HS & WDTDIS & PWRTEN & BOREN); <<---- __config

    #define LC_select RB0 //L or C select (from DPDT switch) <<----
    #define lc_tris() TRISB0 = 1 //as input
    #define add_ccal() RC0 = 1 //relay on
    #define remove_ccal() RC0 = 0 //relay off
    #define relay_tris() TRISC0 = 0 //as output to drive the relay coil

    Q1. I want to know what is the equal function to MikroC Pro of __CONFiG?
    Q2. (RB0) WHICH ONE is right to use PORTB.B0 or PORTB.RB0 or PORTB.F1 ?
    all of them working properly when I'd Compile without generating Error.
    Q3. (TRISB) WHICH ONE is right to use TRISB.B0 or TRISB.RB0 or TRISB.F1 ?
    all of them working properly when I'd Compile without generating Error.


    ISSUE: 2

    void initialize(void)
    {
    //setup comparator
    CMCON = 0b00000101;
    TRISA = 0b11001111;
    //setup timer0 for frequency counter
    T0CS = 1; //Transition on T0CKI pin
    T0SE = 1; //Increment on high-to-low transition on T0CKI pin
    PSA = 0; //Prescaler is assigned to the Timer0 module
    PS2 = 1; //PS2:pS0 -> Prescaler Rate = divide by 256
    PS1 = 1;
    PS0 = 1;
    //initialize 3310 lcd
    lcd_init();
    lcd_clear();
    //others
    lc_tris();
    relay_tris();
    RBPU = 0; // enable portB internal pullup
    }


    Q1. (T0CS,T0SE,PSA,PS2,PS1,PS0) WHICH ONE is right to use?
    example: T0CON.T0CS, PORTA.T0CS , TRISA.T0CS, OPTION_REG.T0CS.... whatKingOfRegister.T0CS ?
    all of them working properly when I'd Compile without generating Error.
    Q2. (RBPU = 0;) is this portb=0?
     
Loading...