Allen Mulvey wrote 2014-07-19 20:50: > I'm afraid I don't have an XC8 compiler. Both the compiler and (more important!) the documentation is free to download. This might be of interest *if* one would like to check that what one is writing as an reply to a question actualy is correct. What is described below is not (or maybe partly) correct for XC8. > Some PIC16s (16F88x) use notation like PIE1.TMR1IE... Well, the *compiler* might do that. :-) And the correct syntax for XC8 is "PIE1bits.TMR1IE" or simply to use "TMR1IE". "PIE1.TMR1IE" or "PIE1.B0" *looks* like MikroC, but I'm not 100% sure on that (have no direct reason right now to look it up, since the thread is about XC8). Best Regards, Jan-Erik. I would double check the defines. > These have the letter 'I' in them which can easily be mistaken for a digi= t > '1' in many fonts. TMR1IF_bit is the interrupt flag bit. TMR1IE_bit is th= e > interrupt enable bit. > > Some PIC16s (16F88x) use notation like PIE1.TMR1IE (PIE1.B0) and PIR1.TMR= 1IF > (PIR1.B0). These are in the peripheral interrupt registers. > > Allen > >> -----Original Message----- >> From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf > Of >> Richard R. Pope >> Sent: Saturday, July 19, 2014 1:40 PM >> To: Microcontroller discussion list - Public. >> Subject: Re: [Pic] Making a special timer! >> >> Allan, >> I'm using the MicroChip XC8 compiler. I just looked through the >> macros in the pic16f684 include file and the code should work. Would you >> please take a look at this code section? The values that are being >> flagged are the TMR1IF_bit and TMR1IE_bit definitions. Here is the code >> with the flagged sections commented out: >> >> void InitTimer1(){ >> T1CON =3D 0x31; >> //TMR1IF_bit =3D 0; >> TMR1H =3D 0x0B; >> TMR1L =3D 0xDC; >> //TMR1IE_bit =3D 1; >> INTCON =3D 0xC0; >> } >> >> void Interrupt(){ >> //if (TMR1IF_bit){ >> //TMR1IF_bit =3D 0; >> TMR1H =3D 0x0B; >> TMR1L =3D 0xDC; >> //Enter your code here >> //} >> } >> I can't see what is wrong as these definitions are in the include >> file. With these statements commented out the code compiles. >> Thanks, >> rich! >> >> On 7/19/2014 10:53 AM, Allen Mulvey wrote: >>> What compiler are you using? This code is for MikroC. You may have to >>> translate a few things. For instance, they may express things like >>> "TMR1IF_bit" differently. These are PIC specific and not a part of > standard >>> ANSI C so each compiler developer is free to define them as they see > fit. >>> >>> Allen >>> >>>> -----Original Message----- >>>> From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On > Behalf >>> Of >>>> Richard R. Pope >>>> >> >> -- >> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist > > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .