Jump to content

julian265

EstablishedMember
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral

About julian265

  • Rank
    Newbrie
  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. mmmm capitals.... It works if I use tmr0, not TMR0. The PIC's include file has TMR0 in upper case, so I'm a bit confused there!
  3. 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; clear_bit(intcon,INTF); if (pulse == 1) { pulse_timer1 = TMR0; SNIP 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.
  4. 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 #pragma DATA _CONFIG, _CP_OFF &_DEBUG_OFF & _WRT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _PWRTE_OFF & _WDT_OFF & _HS_OSC void main() { unsigned char test; trisa = 0xFF; trisb = 0xFF; trisc = 0xFF; //OPTION_REG 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 clear_bit(option_reg,PS1); clear_bit(option_reg,PS0; while( 1 ) { test = 0x1; } } The full error message: "Building... <snip> 876a_flash_led.c FATAL: Unexpected EOF failure 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' Done Failed" So what am I missing? Is it in the code, or some setup issue? Thanks!
×
×
  • Create New...