Jump to content

Reynard

EstablishedMember
  • Content Count

    688
  • Joined

  • Last visited

Everything posted by Reynard

  1. Hi Tom, I think you have some interger promotion going on here. Try this casting: osccon = 0x00 | (unsigned char)(eFreq << IRCF0) | (1 << SCS); // Use software I'd like to see how you get 500MHz out of your PIC (SW_OSCCON_CLOCK_500MHZ) Cheers Reynard
  2. Hi Al, Something tells me this is not 'C'. You have a compound statement and not an expression. A ternary has the form: y = x>9 ? 100 : 200; Cheers Reynard
  3. I think only uninitialised static variables will be zeroed. Cheers Reynard
  4. If you declare a variable at 'static' it will be initialised to zero unless you tell the compiler otherwise (BoostC manual page 22). If you wish to zero a bunch of variables to zero use the v1=0, v2=0 etc method. The other method does not zero all your variables, only the last one. Cheers Reynard
  5. Hi Jean-Marie, I hope you have a copy of the chip manual as it explains how to it very well. You have to write a raster pattern into CGRAM. CGRAM is 64 bytes which will let you store 8 characters (5x7). When you wish to display the CGRAM characters you give them the values of between 0 and 7 in your text string. You may want to avoid using character '0' as it may be seen as a NULL terminator in your program. The SourceBoost LCD library probably does not support writing to CGRAM so you will have to modify the library or better still write your own. Cheers Reynard
  6. Hi Jean-Marie, You cannot select the different fonts as they are 2 different chip parts. The A00 (HD44780UA00) is the Japanese standard font and the A02 (HD44780UA02) if the European standard font. You will have to purchase a display with the correct chip installed. Cheers Reynard
  7. Hi Al, Open up the .casm file for the source and assembler code in one file. Note that the instructions may not all be sequence so watch out. Cheers Reynard
  8. Hi Guys, Have you looked at the SSP errata sheet for the PIC16F819. It may have a connection with your problems. Cheers Reynard
  9. The clock frequency in the #pragma informs the compiler of the instruction clock frequency (Fosc). In you case it would be 125000. The watchdog can be software controlled using wdtcon.SWDTEN. It is all explained on page 96 of the PIC manual. You can use the macro test_bit(). Cheers Reynard
  10. Hi Dan, It doesn't look like many people use this library. The library functions are for a master device so you will have to write your own slave emulation to do all the pulse width detection etc. It maybe more trouble than it's worth. Cheers Reynard
  11. Hi Al, You have said in the config word that you are using an external crystal (_HS_OSC ) but you are selecting the internal oscillator in the osccon register. Your config should be for the internal oscillator (_INTOSCIO or _INTOSC). HTS is on the bottom of page 23. Cheers Reynard
  12. Hi Al, Do you have the watchdog timer disabled or are you hitting it often enough. Timer 0 prescaler may be set to maximum value of 256 which could take some time for the timer to interrupt. If the watchdog is enabled, it may be resetting you all the time before the timer gets a chance to interrupt. Cheers Reynard ps: Tell us what PIC you are using to give us a chance to help you.
  13. Raghunathan, Have you checked out the latest V6.97 Beta release yet ? Cheers Reynard
  14. Hi Jean-Marie, Do you think it is because the values that you are using are not valid printable chars therefore MPLAB is replacing them on the display as a period. Can you change MPLAB to display variable content in hex to see what values you have in the array. Cheers Reynard
  15. Hi Kevin, Did you purchase a BoostC or BoostC++ license ? I see from another of your postings that you are using Flowcode 4. Cheers Reynard
  16. You could give us a few ideas to what the errors are that you are seeing. Have you included #include <system.h> to the top of your source files ? Do you have the correct PIC type selected ? Cheers Reynard
  17. Hi Henry, In 'C' I would consider array and vector to be the same thing. In 'C++' you can have a vector class which can have a fixed size specified with the constructor and also be changable using a finctions of the vector class (set-size, add and delete). As the posting was in the BoostC section of the forum I assumed the poster to be using 'C'. Cheers Reynard
  18. Passing arrays (vectors) do have their exceptions. As you cannot pass an array by value a reference (pointer) to the first element is therefore passed. You don't have to tell the compiler it is a reference as you have no other choice. An argument of type T[] will be converted to a T* when passed as an argument. It's all in the manual somewhere folks. Cheers Reynard
  19. Hi Mark, Remember you are not passing the array but a pointer to it. So if your function modifies the array it is the original array that is being modified. Your function could have also have been declared using a pointer argument. signed long adc_decip (unsigned char *n) { signed long m; m = 0; m += *n++; m += *n++ * 10; m += *n++ * 100; m += *n++ * 1000; m += *n++ * 10000; if(adc_sign_digit==0) { m = m*(-1); } return m; } BoostC does not let you specify the size of the array though in the function argument e.g. signed long adc_deci (unsigned char n[5]). Cheers
  20. Hi Shree, As you are using a 16F877A device, why not try using timer 2 and the preload register. That way you should be an interrupt every 250us and just let the timer free run and do its own thing. If you use the x4 post scaler the interrupts can arrive at 1ms intervals. Worth a try dude. Cheers Reynard
  21. Well spotted Ian. The compiler certainly didn't complain about it and assumed the statment to be true. Rats! Looked like a good feature though. Cheers Reynard Berfore anyone asks, the compiler is correct at keeping quiet. If PEAR is undefined it will evaluate to zero.
  22. Hi Tom, I think the case statement requires a constant expression rather than a constant variable with const attached to a type specifier. #define does work so you may have a typo. You may want to look at enum for you case constants. Cheers Reynard
  23. Shree, Are you taking into account that seconds go from 0 to 59 and 60 seconds doesn't exist ? Cheers Reynard
  24. OK! Who's upsetting Reynard ? Shree, Remember that a program should be self documenting to limit the amout of comments that youu have to add to make it readable. Example: enum SW_STATE {OFF = 0, ON}; // switch states. volatile bit PushButtonSwitch@PORTE.1; // assign switch to port pin. volatile unsigned char LED_Port_1@PORTC; // assign units LED display to port. volatile unsigned char LED_Port_10@PORTD; // assign tens LED display to port. volatile unsigned char LED_Port_100@PORTB; // assign hundreds LED display to port. // Segment to port bit assignment. #define Sa 0x01 #defi
×
×
  • Create New...