Jump to content

Reynard

EstablishedMember
  • Content Count

    688
  • Joined

  • Last visited

Everything posted by Reynard

  1. I have made a couple of tweaks to your interrupt routine. void interrupt(void) { //unsigned char data_in; pir1.RCIF = 0; //clear uart receive flag data_in = rcreg; //save the data from uart buffer if (STX_received) //if start bit has been received { if (data_in == '\r') //if data is carriage return (ASCII) { STX_received = 0; //reset for next start bit message_received = 1; //message is ready to process in main() } else { // if(array_ptr == 34) //data is about to overflow buffer if (array_ptr == rx_buffer + sizeof(rx_buffer)) //data is about to overflow buff
  2. Hi Sudhi, Your values are working OK for me. I am transmitting to HyperTerm at 9600 using 16MHz PLL. Cheers Reynard
  3. Version 7.0 is still in the making. Hope to see it by the end of the year. Cheers Reynard
  4. As the manual says -idx is in version 7.0. Cheers Reynard
  5. Hi Sudhi, proxyResponseBuffer is not a pointer variable it is a reference to the array. Cheers Reynard
  6. Hi Sudhi, proxyResponseBuffer is the name of the array (start address) but is not a pointer to the array. Have you looked at using memcpy() to copy data around ? Cheers Reynard
  7. Hi Sudhi, Are you trying to put a square peg into a round hole, or and int into a char. dataIndex++ will increnent to the next integer (2 bytes) and not the next char (1 byte). Do you need something like this in your loop: responseBuffer[messageOffset++] = normalized_value[dataIndex]; responseBuffer[messageOffset++] = (normalized_value[dataIndex++] >> 8); Cheers Reynard
  8. Hi Scott, Not yet supported in BoostC or C++. Fingers crossed it may appear in version 7.0 Cheers Reynard
  9. When setting up the config bits, specify every bit either on or off and don't rely on any erased defaults after the compiler has finished playing with them. The compiler may set any unspicified bits to a '1' which may be the opposite to what you expected it to be. Cheers Reynard
  10. I was just clarifying thing for those who may have migrated from Hi-Tech who use uppercase for the PIC registers. I am sure most of us use the normal convention to distinguish between constants, variable and functions. Cheers Reynard
  11. Hi Russ, I think BoostC takes the line that constants are in uppercase and variables in lowercase. This is not the case for all PIC compilers though. Cheers Reynard
  12. Better to include the system.h header which includes the boostc.h and others. Cheers Reynard
  13. As I said in a previous post reply Cheers Reynard
  14. Hi Babos, Semaphore are very useful for passing a message to another task that something has happened and go do something. A message system passing a char or int would be useful so that one could pass a code to another task and trasfer a little bit more info than just a semaphore. Maybe something for a future rease of Novo. Here is a simple bit of code which demonstrates (maybe) a use for semaphores. I have a small project that can accept/validate either a bank note or coin then dispenses a blank token from a hopper. void TaskNoteAcceptor() { static unsigned char naState =
  15. This is one way of reducing the number of yield points. Just make sure that only one task is calling the pause() function at any time. Can you write your tasks so that they have a common exit (yield) point reducing the number of yield points. Cheers Reynard
  16. Long lines work OK for me too. #pragma DATA _EEPROM,\ var0,var1,var2,var3,var4,var5,var6,var7,var8,var9,\ var10,var11,var12,var13,var14,var15,var16,var17,var18,var19,\ var20,var21,var22,var23,var24,var25,var26,var27,var28,var29,\ var30,var31,var32,var33,var34,var35,var36,var37,var38,var39,\ var40,var41,var42,var43,var44,var45,var46,var47,var48,var49,\ var50,var51,var52,var53,var54,var55,var56,var57,var58,var59,\ var60,var61,var62,var63,var64,var65,var66,var67,var68,var69,\ var0,var1,var2,var3,var4,var5,var6,var7,var8,var9,\ var10,var11,var12,var13,var14,var15,var16,var17,var18,var19,\ va
  17. Babos, If you are using delay_s(3), then everything (except interrupts) stops for 3 seconds until the delay loop completes. This is not good for an RTOS. Do you have a program space problem with your PIC ? Cheers Reynard
  18. Hi Babos, If your are using Novo RTOS why are you not using Sys_Sleep(x) ? Cheers Reynard
  19. Hi Ian, I have always found that the preprocessor for pragma never likes to do arithmetic for adding an offset to a symbol. Cheers Reynard
  20. I always say, "If the function you want is not available, Write your own". Here is something that I used for a simple 18F2520 project to read and write an unsigned integer value. Please use it, modify it do whatever suits your project. It will give your the basic idea. #include <system.h> #include "eeprom.h" unsigned int EE_GetInt(unsigned char address) { union { unsigned int valInt; unsigned char valByte[2]; } uInt; eecon1.EEPGD = false; // access data memory. eeadr = address; // select ls byte address. eecon1.RD = true; // read the data byte. uInt.valByte[0]
  21. Hi Steve, BoostC does not support the float data type. Although float is accepted it is actually another name for an unsigned long. As Ian says you have to use the floating point library and call functions to perform the floating point arithmetic for you. Fingers crossed this will be resolved in version 7.0. Not sure why the linker is giving you unresolved external function if your program is as small as you are showing. Cheers Reynard
  22. Ho Ted, I don't think BoostC is strictly ANSI. I think 8 bit compilers will alway have variations to keep code compact and libraries small. BoostC only appears to support unsigned char or unsigned int with the modulus or rem functions. Idealy, char and unsigned char should be converted to int, then if either operand is unsigned the other is converted to unsigned and that is the type of the result. An odd thing happens if you do this: unsigned char varA, varB, res; void main() { varB = 8; varA = 2; res = ~varA % varB; varA = ~2; res = varA % varB; while (1) {} } produc
  23. Hi David, Page 257 of the 18F2525 manual shows you the format of the DEVID bytes. My programmer reads these bytes and tells me the device type and revision etc. Cheers Reynard
  24. Hi, Can you check the silicon version of your device. The Errata sheet for A3 silicon page 13 indicates a problem with timer 1 TMR1H not updating when reading TMR1L. Cheers Reynard
  25. Hi Guy, The library for PIC18 probably never existed. The manual only mentions PIC16. Given the library only contains a single function it doesn't do much for you anyway. Using the library will not configure the ADC for the correct timings etc., it will not be of any use if you want to use the ADC with interrupts instead of your program twidling its thumbs waiting for conversion complete to occur. Make a small test program for a PIC16, look at the generated assembler code and you have your adc_read() function. Cheers Reynard
×
×
  • Create New...