Jump to content

paulgreeny83

EstablishedMember
  • Content Count

    14
  • Joined

  • Last visited

Community Reputation

0 Neutral

About paulgreeny83

  • Rank
    Newbrie
  1. Hi Paul here again! I decided to start a new post as the last one got too long. From before I was having trouble with getting the timer 2 interrupt to work on the PIC16F88 chip. I now have timer 2 working fine producing an interrupt every 5 seconds, which takes the values stored in TMR0and TMR1L regs, calculations are done on these in function main before displaying the results to the LCD screen. (Please see 'Urgent Problem With 16f88 Interrupt!, Can't get code to do interrupt?!?' post to view code). On the first reset to the chip after programming, the two values are displayed boldly for the world to see! After the 2nd interrupt however, the display resets to 0 and does not display any more results. When I take the sensor out and put it back again however, I get results for 5 seconds, then resets again to 0?! Both pins are setup correctly to increment from a low to high trasitition, where the result is stored in each of timer0 and timer1's registers. The counting registers are cleared at the end of the interrupt to be ready for the next 5 seconds of counting. What is causing them to count and display after the 1st interrupt?? The fault seems very tempremental as the first time it was done timer 0 displayed the results fine indefinatly, increasing when the frequency of the signal increased and visa versa. Timer 1 does not seem to work at all, this is a different reg due to its two regs (TMR1L and TMR1H) cascaded together... but seems to be set-up correctly?... Any ideas why i'm having these problems? Cheers Paul
  2. Hi Fran. The PIC is actually running as I have LCD characters on the display I.E. 'MPH:' and 'BPM:'. I also get to see the contents of my timer0 and timer1 counters when I put: speed = tmr0; beats = tmr1l; inside function main. Obviously the numbers I get are not valid as the values change every time the program cycles through main. It just seems that timer2 is not working correctly. FSR and INDF are the working registers that get stored one I enter my interrupt into variables, they get put back at the end of the interrupt. This seems common practice in interrupts... Cheers Paul
  3. Hi Frans, Cheers for the post. You're right the ANSEL address is quoted out, this was done during troubleshooting, it has been included before and timer 2 still not worked. PR2 was also changed to 10 during troubleshooting, and is normally 255. I can only think that there is a register some where that is connected to timer 2 that requires configuring correctly for timer 2 to work correctly, either that or when a timer 2 to PR2 match occurs and sets PIR1,TMR2IF, the interrupt routine i.e. if (PIR & 2) is not correct format, although I have changed this into several possible alternatives. There may be some registers that are defaulted to a certain condition, whereas I want the opposite for my code to work (such as the ANSEL reg which sets pins to analogue as default).... Any more ideas guys? Thanks for your help Paul
  4. Hi Dave Thanks for your reply. PR2 register is actually in there in the hardware setup function. In the post I have it equal to 10, this was when I was trouble shooting, I normally have it set to 255, although from what I can gather PR2 defaults to 255 at reset.. if no value is written to it.. I'm sure it's something like that that I have missed though!! Any more ideas?? Cheers Paul
  5. Hi Fran Thanks for your reply. The _T2CON,TMR2ON bit is actually set in the code if you look carefully, there are so many it's hard to spot! There's nothing else I can think of, i've tested everything.. maybe it's staring me in the face but can't spot it?! Cheers Paul
  6. Sorry guys forgot to say this is my code that i'm having a nightmare with! Every register I can see that is required is set up as required.. I can only think it's a syntax error that compiles but does not do what is should. Any ideas? I'm at me wits end!! Cheers Paul
  7. [/code]/* Honours Project 3 - A Bicycle Data Logger */ /* Paul Greenhalgh 2005 */ /* HARDWARE CONFIGURATION */ // REGISTER FILES char _INDF@0x00; char _TMR0@0x01; char _PCL@0x02; char _STATUS@0x03; char _FSR@0x04; char _PORTA@0x05; char _PORTB@0x06; char _PORTC@0x07; char _PORTD@0x08; char _PORTE@0x09; char _PCLATH@0x0A; char _INTCON@0x0B; char _PIR1@0x0C; char _PIR2@0x0D; char _TMR1L@0x0E; char _TMR1H@0x0F; char _T1CON@0x10; char _TMR2@0x11; char _T2CON@0x12; char _SSPBUF@0x13; char _SSPCON@0x14; char _CCPR1L@0x15; char _CCPR1H@0x16; char _CCP1CON@0x17; char _RCSTA@0x18; char _TXREG@0x19; char _RCREG@0x1A; char _CCPR2L@0x1B; char _CCPR2H@0x1C; char _CCP2CON@0x1D; char _ADRESH@0x1E; char _ADCON0@0x1F; char _OPTION_REG@0x81; char _TRISA@0x85; char _TRISB@0x86; char _TRISC@0x87; char _TRISD@0x88; char _TRISE@0x89; char _PIE1@0x8C; char _PIE2@0x8D; char _PCON@0x8E; char _SSPCON2@0x91; char _PR2@0x92; char _SSPADD@0x93; char _SSPSTAT@0x94; char _TXSTA@0x98; char _SPBRG@0x99; //char _ANSEL@0x9B; char _ADRESL@0x9E; char _ADCON1@0x9F; char _EEDATA@0x10C; char _EEADR@0x10D; char _EEDATH@0x10E; char _EEADRH@0x10F; char _EECON1@0x18C; char _EECON2@0x18D; // STATUS Bits Masks #define _IRP 0x80 #define _RP1 0x40 #define _RP0 0x20 #define _NOT_TO 0x10 #define _NOT_PD 0x08 #define _Z 0x04 #define _DC 0x02 #define _C 0x01 // INTCON Bits Masks #define _GIE 0x80 #define _PEIE 0x40 #define _TMR0IE 0x20 #define _INT0IE 0x10 #define _RBIE 0x08 #define _TMR0IF 0x04 #define _INTF 0x02 #define _RBIF 0x01 // PIR1 Bits Masks #define _PSPIF 0x80 #define _ADIF 0x40 #define _RCIF 0x20 #define _TXIF 0x10 #define _SSPIF 0x08 #define _CCP1IF 0x04 #define _TMR2IF 0x02 #define _TMR1IF 0x01 // PIR2 Bits Masks #define _EEIF 0x10 #define _BCLIF 0x08 #define _CCP2IF 0x01 // T1CON Bits Masks #define _T1CKPS1 0x20 #define _T1CKPS0 0x10 #define _T1OSCEN 0x08 #define _NOT_T1SYNC 0x04 #define _T1INSYNC 0x04 // Backward compatibility only #define _T1SYNC 0x04 #define _TMR1CS 0x02 #define _TMR1ON 0x01 // T2CON Bits Masks #define _TOUTPS3 0x40 #define _TOUTPS2 0x20 #define _TOUTPS1 0x10 #define _TOUTPS0 0x08 #define _TMR2ON 0x04 #define _T2CKPS1 0x02 #define _T2CKPS0 0x01 // SSPCON Bits Masks #define _WCOL 0x80 #define _SSPOV 0x40 #define _SSPEN 0x20 #define _CKP 0x10 #define _SSPM3 0x08 #define _SSPM2 0x04 #define _SSPM1 0x02 #define _SSPM0 0x01 // CCP1CON Bits Masks #define _CCP1X 0x20 #define _CCP1Y 0x10 #define _CCP1M3 0x08 #define _CCP1M2 0x04 #define _CCP1M1 0x02 #define _CCP1M0 0x01 // RCSTA Bits Masks #define _SPEN 0x80 #define _RX9 0x40 #define _RC9 0x40 // Backward compatibility only #define _NOT_RC8 0x40 // Backward compatibility only #define _RC8_9 0x40 // Backward compatibility only #define _SREN 0x20 #define _CREN 0x10 #define _ADDEN 0x08 #define _FERR 0x04 #define _OERR 0x02 #define _RX9D 0x01 #define _RCD8 0x01 // Backward compatibility only // CCP2CON Bits Masks #define _CCP2X 0x20 #define _CCP2Y 0x10 #define _CCP2M3 0x08 #define _CCP2M2 0x04 #define _CCP2M1 0x02 #define _CCP2M0 0x01 // ADCON0 Bits Masks #define _ADCS1 0x80 #define _ADCS0 0x40 #define _CHS2 0x20 #define _CHS1 0x10 #define _CHS0 0x08 #define _GO 0x04 #define _NOT_DONE 0x04 #define _GO_DONE 0x04 #define _ADON 0x01 // OPTION_REG Bits Masks #define _NOT_RBPU 0x80 #define _INTEDG 0x40 #define _T0CS 0x20 #define _T0SE 0x10 #define _PSA 0x08 #define _PS2 0x04 #define _PS1 0x02 #define _PS0 0x01 // TRISE Bits Masks #define _IBF 0x80 #define _OBF 0x40 #define _IBOV 0x20 #define _PSPMODE 0x10 #define _TRISE2 0x04 #define _TRISE1 0x02 #define _TRISE0 0x01 // PIE1 Bits Masks #define _PSPIE 0x80 #define _ADIE 0x40 #define _RCIE 0x20 #define _TXIE 0x10 #define _SSPIE 0x08 #define _CCP1IE 0x04 #define _TMR2IE 0x02 #define _TMR1IE 0x01 // PIE2 Bits Masks #define _EEIE 0x10 #define _BCLIE 0x08 #define _CCP2IE 0x01 // PCON Bits Masks #define _NOT_POR 0x02 #define _NOT_BO 0x01 #define _NOT_BOR 0x01 // SSPCON2 Bits Masks #define _GCEN 0x80 #define _ACKSTAT 0x40 #define _ACKDT 0x20 #define _ACKEN 0x10 #define _RCEN 0x08 #define _PEN 0x04 #define _RSEN 0x02 #define _SEN 0x01 // SSPSTAT Bits Masks #define _SMP 0x80 #define _CKE 0x40 #define _D 0x20 #define _I2C_DATA 0x20 #define _NOT_A 0x20 #define _NOT_ADDRESS 0x20 #define _D_A 0x20 #define _DATA_ADDRESS 0x20 #define _P 0x10 #define _I2C_STOP 0x10 #define _S 0x08 #define _I2C_START 0x08 #define _R 0x04 #define _I2C_READ 0x04 #define _NOT_W 0x04 #define _NOT_WRITE 0x04 #define _R_W 0x04 #define _READ_WRITE 0x04 #define _UA 0x02 #define _BF 0x01 // TXSTA Bits Masks #define _CSRC 0x80 #define _TX9 0x40 #define _NOT_TX8 0x40 // Backward compatibility only #define _TX8_9 0x40 // Backward compatibility only #define _TXEN 0x20 #define _SYNC 0x10 #define _BRGH 0x04 #define _TRMT 0x02 #define _TX9D 0x01 #define _TXD8 0x01 // Backward compatibility only // ADCON1 Bits Masks #define _ADFM 0x80 #define _PCFG3 0x08 #define _PCFG2 0x04 #define _PCFG1 0x02 #define _PCFG0 0x01 // ANSEL Bits Masks #define _ANS6 0x40 #define _ANS5 0x20 #define _ANS4 0x10 #define _ANS3 0x08 #define _ANS2 0x04 #define _ANS1 0x02 #define _ANS0 0x01 // EECON1 Bits Masks #define _EEPGD 0x80 #define _WRERR 0x08 #define _WREN 0x04 #define _WR 0x02 #define _RD 0x01 void setup_hardware ( void ) { clear_bit ( _STATUS,_RP1 ); set_bit ( _STATUS,_RP0 ); /* Selects register bank 1 */ clear_bit ( _OPTION_REG,_NOT_RBPU ); /* Enables RB pull-ups */ set_bit ( _OPTION_REG,_T0CS ); /* Counter mode for external input - sensor 1 */ clear_bit ( _OPTION_REG,_T0SE ); /* Increments counter on low-to-high trasition */ clear_bit ( _OPTION_REG,_PSA ) ; /* Assigns prescaler to timer0 module */ //_OPTION_REG = 32; clear_bit ( _INTCON,_TMR0IE ); /* Disables timer 0 interrupt */ set_bit ( _INTCON,_GIE ); /* Enables global interrupts */ set_bit ( _INTCON,_PEIE ); /* Enables peripheral interrupts */ clear_bit ( _INTCON,_INT0IE ); /* Disables RB0 external interrupt */ //_INTCON = 192; clear_bit ( _PIE1,_ADIE ); set_bit ( _PIE1,_TMR2IE ); /* Enables timer 2 interrupt */ //_PIE1 = 2; clear_bit ( _ANSEL,_ANS6 ); clear_bit ( _ANSEL,_ANS5 ); clear_bit ( _ANSEL,_ANS4 ); clear_bit ( _ANSEL,_ANS3 ); clear_bit ( _ANSEL,_ANS2 ); clear_bit ( _ANSEL,_ANS1 ); clear_bit ( _ANSEL,_ANS0 ); /* Declares input pins as digital */ //_ANSEL = 0; _PR2 = 10; /* Setting the number timer 2 has to count to to cause interrupt */ _ADCON1 = 0x06; clear_bit ( _STATUS,_RP1 ); clear_bit ( _STATUS,_RP0 ); /* Selects register bank 0 */ clear_bit ( _T1CON,_T1OSCEN ); /* Uses RB6 as external input pin */ set_bit ( _T1CON,_NOT_T1SYNC); /* Do not synchronize external input to clock */ set_bit ( _T1CON,_TMR1CS ); /* Counter mode for external input - sensor 1 */ set_bit ( _T1CON,_TMR1ON ); /* Turns timer 1 on */ //_T1CON = 3; clear_bit ( _T2CON,_TOUTPS3 ); clear_bit ( _T2CON,_TOUTPS2 ); clear_bit ( _T2CON,_TOUTPS1 ); clear_bit ( _T2CON,_TOUTPS0 ); /* Sets post-scaler to 1:1 */ set_bit ( _T2CON,_TMR2ON ); /* Turns timer 2 on */ set_bit ( _T2CON,_T2CKPS1 ); clear_bit ( _T2CON,_T2CKPS0 ); /* Sets pre-scaler to 16:1 */ //_T2CON = 256; } int speed = 0; /* Variables used in interrupt rountine */ int beats = 0; int speedresult = 0; int beatsresult = 0; short count = 0; /* FUNCTION PROTOTYPES */ char lcd_start ( void ) ; char lcd_clear ( void ) ; char lcd_print_ch ( char ch ) ; char lcd_print ( const char * message ) ; char lcd_cursor ( char x, char y ) ; #define RSMASK 0x10 #define EBIT 0x05 /* Masks for control bits */ // defined values for delays tested up to 20Mhz PICmicro #define PUTCH_DELAY 3000 /* Standard write delay */ #define CLEAR_DELAY 20000 /* Clear and cursor home take longer: special delay for them */ #define POWER_UP_DELAY 10000 /* Delay to let the LCD settle */ #define BIT_DELAY 2 /* Delay to let the ports settle */ void lcd_delay ( int size ) { int i ; for ( i = 0 ; i < size ; i++ ) ; } /* sends a byte out to the LCD */ /* the byte is given by in, the */ /* mask is used to allow the */ /* state of RS to be set as well */ void lcd_raw_send ( unsigned char in, unsigned char mask ) { unsigned char pb ; /* use a PICmicro assembler */ /* to swap the nibbles in the */ /* input */ /* puts high nibble at the */ /* bottom of the byte */ asm swapf param00_lcd_raw_send,F /* OR in the mask */ pb = (in & 0x0f ) | mask ; /* OR in the other bits */ /* PORTB */ pb = pb | (PORTB & 0xc0) ; /* send the data */ /* don't disturb the other */ /* bits in PORTB */ PORTB = pb ; /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; /* now clock the bit out */ /* by raising and lowering E */ set_bit ( PORTB, EBIT ) ; /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; clear_bit ( PORTB, EBIT ) ; /* put the low nibble back */ /* into in */ asm swapf param00_lcd_raw_send,F /* OR in the mask */ pb = (in & 0x0f ) | mask ; /* OR in the other bits */ /* PORTB */ pb = pb | (PORTB & 0xc0) ; /* send the data */ /* don't disturb the other */ /* bits in PORTB */ PORTB = pb ; /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; /* now clock the bit out */ /* by raising and lowering E */ set_bit ( PORTB, EBIT ) ; /* let the bits settle */ lcd_delay ( BIT_DELAY ) ; clear_bit ( PORTB, EBIT ) ; /* do the delay here */ lcd_delay (PUTCH_DELAY) ; } /* puts a character at the */ /* cursor position */ char lcd_print_ch ( char in ) { /* use raw send with RS set */ lcd_raw_send ( in, RSMASK ) ; return 1 ; } /* sends a command to the LCD */ void lcd_command ( unsigned char in ) { lcd_raw_send ( in, 0 ) ; } /* clear the display */ /* and home the cursor */ char lcd_clear ( void ) { lcd_command ( 0x01 ) ; /* do extra delay here */ lcd_delay (CLEAR_DELAY) ; lcd_command ( 0x02 ) ; /* do extra delay here */ lcd_delay (CLEAR_DELAY) ; return 1 ; } /* position the cursor */ /* 0,0 is the top left corner */ char lcd_cursor ( unsigned char x, unsigned char y ) { if ( y==0 ) { /* position for line 0 */ y=0x80 ; } else { /* position for line 1 */ y=0xc0 ; } lcd_command ( y+x ) ; return 1 ; } const unsigned char lcd_init [5] = { /* LCD initialize */ 0x33, /* Set for 4 bit operation */ 0x32, /* Set for 2 line LCD */ 0x2c, /* Select move after write */ 0x06, /* disp. on cursor off blink off*/ 0x0c } ; void bpm_display_value ( int value ) { unsigned char hunds, tens, units ; /* first get the digits */ units = value % 10 ; value = value / 10 ; tens = value % 10 ; value = value / 10 ; hunds = value % 10 ; /* now display them */ lcd_print_ch ( '0' + hunds ) ; lcd_print_ch ( '0' + tens ) ; lcd_print_ch ( '0' + units ) ; } void mph_display_value ( int value ) { unsigned char hunds, tens, units ; /* first get the digits */ units = value % 10 ; value = value / 10 ; tens = value % 10 ; value = value / 10 ; hunds = value % 10 ; /* now display them */ lcd_print_ch ( '0' + hunds ) ; lcd_print_ch ( '0' + tens ) ; lcd_print_ch ( '.' ) ; lcd_print_ch ( '0' + units ) ; } char lcd_start (void) { unsigned char i, t ; clear_bit ( _STATUS,_RP1 ); set_bit ( _STATUS,_RP0 ); /* switch to register bank 1 */ _TRISA = 255; /* sets all port a pins as inputs */ _TRISB = 192; /* sets port b pins 0 to 5 as outputs (LCD), and 6 to 7 as inputs (TMR1) */ clear_bit ( _STATUS,_RP1 ); /* switch to register bank 0 */ clear_bit ( _STATUS,_RP0 ); /* give the LCD time to settle */ /* from power up */ lcd_delay ( POWER_UP_DELAY ) ; for ( i=0 ; i < 5 ; i++ ) { lcd_command ( lcd_init ) ; } lcd_clear () ; return 1 ; } /* lcd_print accepts a pointer */ /* parameter which points at the*/ /* string to be printed */ char lcd_print ( const unsigned char * mess ) { unsigned char i = 0 ; /* treat the pointer as an */ /* array and send bytes until*/ /* we find an element with 0 */ /* in it */ while ( mess != 0 ) { lcd_print_ch ( mess ) ; i++ ; } return 1 ; } const unsigned char MPH [4] = { 'M','P','H',0x00 } ; const unsigned char BPM [4] = { 'B','P','M',0x00 } ; unsigned char fsr; unsigned char indf; void tmrHandler ( void ) { //clear_bit (_STATUS,_RP0); fsr = _FSR; indf = _INDF; speed = _TMR0; beats = _TMR1L; //speed = 40; // beats = 5; _TMR0 = 0; _TMR1L = 0; _FSR = fsr; _INDF = indf; count = 0; } void interrupt (void) { if (_PIR1 & 2) { clear_bit(_PIR1,1); count = count + 1; } if (count>1000) { tmrHandler(); } } void main ( void ) { setup_hardware (); clear_bit(_PIR1,1); lcd_start (); _TMR0 = 0; _TMR1L = 0; while(1) { /* 96 comes from wheel circumference x 12 x 60 / 63360 (=0.96)*/ /* Need to then multiply this number by 100 then divide by 10 */ /* To avoid using decimal points. A '.' character is placed */ /* on the display in the mph_display_value function to give */ /*the impression of a decimal point */ beatsresult = beats * 12; speedresult = speed * 96 / 10; unsigned char x, y; unsigned char i = 0; lcd_cursor ( 4, 0 ); lcd_print ( MPH ); lcd_cursor ( 4, 1 ); lcd_print ( BPM ); lcd_cursor ( 0, 0 ); lcd_print_ch ( 'x' ); lcd_cursor ( 1, 0 ); lcd_print_ch ( 'x' ); lcd_cursor ( 7, 0 ); lcd_print_ch ( ':' ); lcd_cursor ( 14, 0 ); lcd_print_ch ( 'x' ); lcd_cursor ( 15, 0 ); lcd_print_ch ( 'x' ); lcd_cursor ( 0, 1 ); lcd_print_ch ( 'x' ); lcd_cursor ( 1, 1 ); lcd_print_ch ( 'x' ); lcd_cursor ( 7, 1 ); lcd_print_ch ( ':' ); lcd_cursor ( 14, 1 ); lcd_print_ch ( 'x' ); lcd_cursor ( 15, 1 ); lcd_print_ch ( 'x' ); lcd_cursor ( 8, 0 ); mph_display_value ( speedresult ); lcd_cursor ( 8, 1 ); bpm_display_value ( beatsresult ); } }
  8. Hi guys.. I am using the 16F88 PIC as part of my honours project and have come across a major snag!! My problem is that I can't get my program to enter the interrupt. I am using the standard 'void interrupt (void)' function that is recognisable in C2C. I am using the first two timers as counters that increment upon a pulse on their pins (RA4, and RB6). I am using the 3rd timer, timer 2 as a timer that sets the interrupt flag once it has counted to the value set in the PR2 register (255 in my case). I am using the matrix multimedia board which has a 3.2768MHz crystal. It takes four clock pulses to complete one instruction cycle: 3276800/4 =819200 I am using a 16:1 pre-scaler: 819200/16 =51200 and interrupting once the count in timer 2 reaches 255: 51200/256 =200 I am also using software inside the interrupt which says: count = count +1; if (count>1000) do interrupt This should give me an interrupt that executes its code every 5 seconds? The interrupt should take the values stored in the timer0 and timer1 registers, and store them in variables (called speed and beats). The program should then perform calculations on these values inside function main before outputting the values to the LCD, I get nothing. I have tried just putting dummy values into variables inside the interrupt, then performing calculations on them in function main before displaying them onto the LCD and nothing happens. It works fine however when I put these dummy values into variables outside the interrupt, so I know the maths and the display routine to the LCD is fine, it just doesn't seem to be entering the interrupt. I have set all hardware I can see that is relevant, global interrupts is set, TMR2 is on and interrupt enabled etc, it just will not enter the interrupt! I have looked at examples on the picant site and some use the interrupt as the standard void interrupt (void) function, where as others use it as normal declared function such as 'void interrupt ();' Is there anything obvious you can think of that I am missing? I only have two weeks left of projcet and fear a big fat ZERO if I can't get this working! Any ideas? Cheers Paul
  9. Hi Dave I am using the C2C-plus compiler.. I have having a nightmare!! As mentioned, the code compiles and assembles, I have today tried to send the program to the 87 chip, which it does, but does not display any characters on the display (apart from a bit of rubbish).. I have used the LCD driver software found on matrix multimedia lcd tutorial, which works for the pic16f84). Although it is a different chip as the 84, the LCD display used is the same and the pinout on the 87 is identical to the 84.. Thought it may be a timing program, but changed oscillator to higher frequencies and still stuggling. I have sent my code to you to see of you can see anything obvious.. Only 1 week left before deadline!! Thanks for helping mate.. Paul
  10. Hi Dave Thanks very much for that... As it happens, i've actually got the code compilled and assembled today! I have however found the cause of this 87 reg error.. In the code when complilling using any other chip exept the pic16f84, you need to point the code in some way to the register locations of the chip you're using (obviously), this can be done by including the 87 header file either through #include <system.h> or #include <p16f87.h>, or with the pull down menu under 'settings', 'options', 'include', either way the code points to the 16f87 registers and their locations on the chip. The problem has been the code inside the 16f87 include file itself. IF you look in the header file for the 87, the register locations for each register, and then each bit in the register are given as a hex number such as '0x0000007' etc. This number doesn't make sense as there is no address on the chip with such a label? The include file I have found which works I found by chance in one of your examples: http://www.picant.com/c2c/examples/p16f877x.html This shows the register definitions with correct memory locations such as "0x8C". This may not be the case with other toolsuites, and the issued include files work fine with compilers such as boost C etc?, but they don't seem to work with C2C. My problem is however, the only include file i can find that works is for the 877, and not the 87... Do you where i can find an include file for the 87 which will work in the same manner as the 877? Thanks very much Paul
  11. Hello again Please help guys?! The program still does not accept any file registers relevant to the pic16f87. I have included all header files that might be neccesary, and tried without any. I have done everything I can think of and my code will still not compile and I am getting all these errors where the compiler just does not seem accept 87 registers?!? Please help? Cheers Paul
  12. Hi. Got the new lisence codes today and installed them. My original 'free download' version had expired and so would not support the PIC16F87 chip. I now try to compile my code and the 'unexpected identifier' error no longer occurs at every 16F87 register, but instead I get 'variable expected' at all 87 regs.... Also, I am using the LCD display in my project (same as the one found on the matrixmultimedia development boards).. 2 line, 16 character display. I have included the standard code for the display that is used in C for PIC micro's for the 16F84, as the pin out on the two devices is identical. I am getting many errors relating to the code for setting up the display. Can I not use this code?.. is there another standard for driving an LCD with the 87? Thanks again guys... Paul
  13. Thanks guys for quick response! Tried to upgrade to 5.9.5 of Sourceboost but my license key will not work for it... Going to buy the new lisence key through the university so will probably take a week before I get it. Will let you know how I get on with regards to your advice when I get the new software! Thanks again Paul
  14. Hi! Newbie on here and desperate for your help.. hope you can.. here goes.. I'm using the PIC16F87 chip for my final year project. I'm compiling using SourceBoost IDE 5.3, assembling using MPLAB IDE 7.00, and programming using PPP V3. All options are set correctly. Assembler and programmer paths are pointing correctly to relevant software, target is set to 16F87, and include file under compile options states p16F87.inc. When I try to compile, I get many errors in my setup_hardware function, mostly stating 'unidentified identifier' at every 16F87 register. The compiler 'gets past' all standard registers i.e. 16F84A registers, but does not recognise 87 regs. This would suggest that the 87 register map is not being found by sourceboost i.e. p16F87.INC under compile options. When I browse the include folder, there are no INC files there. When I change the type of file to 'all files' however, files come up for every chip, but are '.h' files and not '.inc'. I have tried everything, using .h files instead, setting path to .inc file that is found in MPLAB directory for 16F87, put file in different locations and pointed there, but all with no joy I tried forcing the program to include the .inc file by putting '#include 'p16F87.inc'' in my source code which slightly worked, but now says 'variable expected' under every 16F87 register command instead of 'unidentified indentifier'. I have very little time left of my project and I fear I will fail if I can't get this Source Boost to work correctly..... please help!! Cheers Paul
×
×
  • Create New...