Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Adrian

  • Rank

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Gender
  • Location
    Bristol UK.
  • Interests
    Maxim 1-Wire.
  1. Thanks AlexR did not notice the semicolon had crept in there spent almost two days not noticing that. Thank you. Adrian.
  2. Greetings Everyone, I am trying to get this small piece of code to compile but keep getting the errors shown below: source.c source.c(25): error: missing right paren source.c(25): error: general error source.c(25): error: failure #include <system.h> /* Target PIC16F877 configuration word. */ #pragma DATA _CONFIG, _PWRTE_ON & _BODEN_OFF & _WDT_OFF & _LVP_OFF & _CP_OFF & _DEBUG_OFF & _HS_OSC & _CP_OFF /* Set clock frequency to 16MHz. */ #pragma CLOCK_FREQ 16000000 //---------------------------------------------------------------------------------- void main(void) { // File scope objects. short unsigned word_1; // short unsigned word_2; // short unsigned word_3; // short unsigned word_4; // /* Initialise array. */ unsigned char map[8] = {0x01, 0x03, 0x15, 0x3C, 0xFF, 0xAA, 0x0F, 0xC8}; /* Program loop. */ while(1); { asm nop // /* Expression 1. */ word_1 = ((short) map[1]) << 8 | map[5]; // asm nop // /* Expression 2 */ word_2 = (short) map[1]; // word_2 = (word_2 << 8) | map[5]; // asm nop // /* Expression 3 */ word_3 = (short) map[1]; // word_3 = word_3 << 8; // word_3 = word_3 | map[5]; // asm nop // /* Expression 4 */ word_4 = (((short) map[1]) << 8) | map[5]; // } } The error occurs at "void main(void)" so I suspect the preprocessor has found something wrong but I cannot see what the problem is. I have tried putting the preprocessor statements in the "main" function, commenting them out and removing them completely but I cannot resolve this problem. I am sure the explanation will be very obvious when it is pointed-out to me. Compiler BoostC v7.05 IDE MPLAB v8 OS XP Thanks in advance for any possible help with this. Regards Adrian.
  3. Thanks for your advice it solved the problem. I changed the values in the array and for loop and it worked as expected. Regards. Adrian.
  4. Thanks for the reply. You were right, when I changed the values in the array and for loop everything worked as expected. Thanks for your time. Adrian.
  5. Greetings everyone, I have a problem with the for loop shown below going into an infinite loop. If I comment out the function the loop runs alright giving 9 iterations otherwise it just loops around for ever. for (s = 0; s < 10; s = s + 1) { spad = OW_read_BYTE(); } Here is the function definition unsigned char OW_read_BYTE(void) { unsigned char t; unsigned char byteval = 0; /* Retrieve 8 bits. */ for (t = 0; t < 8; t++) { byteval >>= 1; if (OW_read_BIT()) byteval |= 0x80; } return (byteval); } The array and its index are declared as unsigned char as shown which should be alright due to the low values. unsigned char spad[9]; unsigned char s; If anyone can point out my error I would be very grateful, thanks in advance. Adrian.
  6. Hi Reynard You were right of course I had an extra space. Removed this and the program compiled. Cheers Adrian.
  7. Hello forum, I am trying to compile the "standard" RS-232 program in MPLAB 8.00 shown below: #include <system.h> //Target PIC16F877 configuration word. #pragma DATA_CONFIG,_PWRTE_OFF &_BODEN_OFF &_WDT_OFF &_LVP_OFF &_CPD_OFF &_DEBUG-OFF &_HS_OSC &_CP_OFF //Set clock frequency to 10MHz. #pragma CLOCK_FREQ 10000000 #define bit_time 104 // Required for compilation. // Hardware USART parameters. #define TX_PORT 0x07 #define TX_TRIS 0x87 #define TX_BIT 6 #define RX_PORT 0x07 #define RX_TRIS 0x87 #define RX_BIT 7 #define e_SPBRG 0x99 #define e_RCREG 0x1A #define e_TXREG 0x19 #define e_TXSTA 0x98 #define e_RCSTA 0x18 #define e_TXIF_PIR 0x0C #define e_RCIF_PIR 0x0C #define e_TXIF_BIT 4 #define e_RCIF_BIT 5 #define MODE (USART_reset_wdt | USART _HW) // Define hardware USART. #include <rs232_driver.h> main (void) { delay_sec(2); // Delay for display to "warm up". while(1); { uart_init (1, 64); // Enable hardware USART, 9600 bauds at 10MHz. puts ("abc"); delay_s(5); } } The compile errors I get are: C:\Program Files\SourceBoost\include\rs232_driver.h(457): error: missing right paren C:\Program Files\SourceBoost\include\rs232_driver.h(457): error: missing semicolon C:\Program Files\SourceBoost\include\rs232_driver.h(455): error: failure This seems to indicate a problem with the library functions. I would be grateful if anyone could shed light on this problem. Regards Adrian.
  • Create New...