Jump to content


  • Content Count

  • Joined

  • Last visited

Posts posted by julian265

  1. Thanks for checking Mike, I am using the TMR0IF, however the snippet posted is used for debouncing an input which is potentially too fast to use full tmr0 cycles for. Hence I'm recording the starting value of tmr0, then its value when the input pulse has finished, and a comparison is done to work out the duration. I have also dealt with the cases of single and multiple tmr0 interrupts between the start and finish of the input.

  2. Hi, my problem seems pretty simple, but has stumped me....


    I'm trying to read the tmr0 register using this chunk of code, called on INT interrupt:


    //	PULSE INTERUPT	==================================
    void pulse_int (void)
    unsigned short temp_short;
    if (pulse == 1)
    {	pulse_timer1 = TMR0;


    the line "pulse_timer1 = TMR0;" will place a 1 in the (unsigned char) pulse_timer1 register, no matter what the value of TMR0 is.


    Can anyone think of a reason for this?


    I have been using TMR0 in this program successfully, it is incrementing and giving the TMR0IF normally. The only problem is that I can't write it's value to another register.

  3. Hello,


    I'm trying to begin using the C language for PIC's, having done my previous projects in assembly. (ra68gi's post for beginners makes it seem pretty straight-forward! Thanks!)


    This is my first program, written simply to learn the compiler's ropes, before I start to flash a few lights.


    I've read the BoostC compiler manual, done searches, and am still stumped as to why I get a "FATAL: Unexpected EOF" error from this:


    #include <system.h>
    #pragma CLOCK_FREQ 20000000 //20MHz
    void main()
    unsigned char test;
    trisa = 0xFF;
    trisb = 0xFF;
    trisc = 0xFF;
    clear_bit(option_reg,T0CS);	//internal clock
    clear_bit(option_reg,PSA);	//prescaller assigned to T0
    clear_bit(option_reg,PS2);	//prescaler 000 = 1:2 T0
    while( 1 )
    	test = 0x1;


    The full error message:





    FATAL: Unexpected EOF



    Error: preprocessing error

    "C:\Program Files\SourceBoost\boostc.pic16.exe" 876a_flash_led.c -t PIC16F876A

    Exit code was 1.

    Removing target: 876a_flash_led.obj

    Failed to locate output file 'C:\Program Files\SourceBoost\Projects\876a flash\876a_flash_led.hex'





    So what am I missing? Is it in the code, or some setup issue?



  • Create New...