Jump to content

Haluk

EstablishedMember
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Haluk

  • Rank
    Newbrie
  1. how can i access in asm of function result char fnc (aaa,bbb) { asm { bcf _status, RP0 bcf _status, RP1 comf _aaa, W subwf _bbb, W movwf _fnc } return W; } error: movwf _fnc error: movwf _return error: movwf _result error: return W; how can i access function result (fnc) in asm...
  2. Haluk

    #define Fn(x)

    pr2 = 0xFF ; // THIS FALSE (IN test.asm) pr2 = 0xCF ; // THIS TRUE ... Please ReTest test.c in below... but, this define work properly ::: #define Period2(Hz) ((62500 / Hz) - 1) {{{ in test.c ...::: #include <system.h> // PIC16F628 ... #define ClockFrequency 4000000 #define Timer2PreScale 16 #define Period(Hz) ((ClockFrequency / (Hz * Timer2PreScale * 4)) - 1) #define DutyCycle(Hz) (ClockFrequency / (Hz * Timer2PreScale)) void MyFn(void) { pr2 = Period(300);//pr2=207; // 300Hz=207; 333Hz=186 ... }; void main() { MyFn(); }; /* //// in test.asm //// MyFn_00000 ; { MyFn; function begin MOVLW 0xFF :P BSF STATUS, RP0 MOVWF gbl_pr2 RETURN ; } MyFn function end //////// */ }}} {Excuse My Poor English} Regards, Haluk.
  3. Haluk

    #define Fn(x)

    IDEVersion: SourceBoost IDE v603 Compiler: BoostC, C2C-plus, C2C++ or P2C-plus) CompilerVersion: ??? TargetDevice: PIC16F628 OS: WinXP in BoostC #define fn(x) dont work properly in test.c ...::: // PIC16F628 ... #define ClockFrequency 4000000 #define Timer2PreScale 16 #define Period(Hz) ((ClockFrequency / (Hz * Timer2PreScale * 4)) - 1) #define DutyCycle(Hz) (ClockFrequency / (Hz * Timer2PreScale)) #define CharToBCD© ((c % 10) + (( c / 10 ) << 4)) //#define BCDToChar(bcd) () void PWMInit( /* unsigned short Frequency */ ) { t2con = 00000011b; //set_bit(t2con, T2CKPS1); //set_bit(t2con, T2CKPS0); pr2 = Period(300);//pr2=207; // 300Hz=207 ; 333Hz=186 ... // 207=69*3 ; 69,138,207 ... ccpr1l = 0; ccp1con = 00001100b; //set_bit(ccp1con, CCP1M3); set_bit(ccp1con, CCP1M2); //return; }; in test.asm ...::: PWMInit_00000 ; { PWMInit ; function begin MOVLW 0x03 MOVWF gbl_t2con MOVLW 0xFF BSF STATUS, RP0 MOVWF gbl_pr2 BCF STATUS, RP0 CLRF gbl_ccpr1l MOVLW 0x0C MOVWF gbl_ccp1con RETURN ; } PWMInit function end in .asm pr2=0xFF ; But pr2 set to be happen 0xCF (pr2=0xCF)(pr2=207) ... {Excuse My Poor English}
  4. #pragma DATA 0x2100, 0x00, 0x01, 0x02, 0x03 this pragma is Equal too ::: |ORG 0x00002100 |DW 0x0000 |DW 0x0001 |DW 0x0002 |DW 0x0003 |DW 0x0000 ... How can i set, Byte variables into EEPROM on BoostC |ORG 0x00002100 |DB 0x00 |DB 0x01 |DB 0x02 |DB 0x03 |DB 0x00
  5. Hello Guys, (First Excuse my Poor English). How can i do this ::: {{{ unsigned char VariableA = 0x20; volatile bit VarBit5 @ VariableA.5 = 1; bit VarBit5 @ VariableA.5 = 1; }}} Can you please help me?. Thanks for your reply, Regards.
  6. Dear Pavel and other Guys, First Excuse my Poor English. i wish create a PWM library for various port pins {PortC.2(RC2) and PortB.3(RB3)(Pic16f628) pin(s)}, and various Clock Frequency... i need help(s). Does anyone know of an example for PWM on various Port Pins and/or various Clock Frequency. I find and example from http://degroof.home.mindspring.com/c2c/pwm.c Can you please help me?. Thanks for your reply, Regards. {{{ #pragma CLOCK_FREQ 4000000 // OR #pragma CLOCK_FREQ 20000000 #define ClockFrequency 4000000 // OR #define ClockFrequency 20000000 PWM_Init(Pin, frequency); PWM_Start(); PWM_Change_Duty(frequency); PWM_Stop(); }}}
×