Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Reynard

  1. Hi Bernard, Thanks for spotting that one for the readers. CFGS is not set to zero at reset. In my code I set eecon1 = 0 within main() which puts me to a known starting point. Cheers reynard
  2. Hi Joli, Take a look at the MAKESHORT, HIBYTE and LOBYTE macros in the boostc.h file. OR, just use a union. Cheers Reynard
  3. Hi Meththa, To continue with what Dave has said. The loop takes 36 clock cycles at 48MHz. Now there are 4 clock cycles per machine instruction cycle meaning the processor core is actually being clocked at only 12MHz. Most instructions take 1 machine cycles but some take 2 machine cycles. Your loop takes 9 cycles as there are several branch instructions to execute. If you want to generate a fixed clock frequency with very little code and run autonomous to your application, consider using one of the PICs timers. Which timer depends on the frequency you want to set the clock at.
  4. Hi Meththa, Using the default optimization, your loop time is 36 cycles. So at 48MHz your square wave output shuld be 666.666kHz which is what you are seeing. Cheers Reynard
  5. Hi Shree, Your osscon.xxx code is outside any function {} Put it inside main() Cheers Reynard
  6. Pavel, So why does my example not compile with BoostC but it does with another PIC compiler. Cheers Reynard
  7. Hi Bongo, I don't think SourceBoost C works very well with multi-dimentional arrays, or it just doesn't work for me. This code gives me an error about missig right parenthesis: #include "system.h" char myArray[6][15]; void myFunc(char arry[][15]); void main(void) { myFunc(myArray); } void myFunc(char arry[][15]) { } Note in your program that it is the number of elements that comes first then the size of the element. i.e. char myArray[6][15] is 6 strings of 15 chars. Cheers Reynard
  8. Hi Jean-Marie, You have told us practically nothing about how your serial comms is configured or operate. Are you polling or interrupt driven ? What are your program values at 20MHz ? Do you have something like this: BRG16 = 1. BRGH = 0, SPBRG = 129 which should give 9615 baud 0.16% error. BRGH = 1, SPBRG = 520 which should give 9596 baud -0.03% error. Cheers Reynard
  9. Hi Kevin, I don't want to know why you want all those unreferenced function in your code, but if you have code space to waste then just build a table of function pointers to all your functions but never use it, but make a reference to the table of course. Have you considered just building a library so you only get the functions you need and the warning messages will not occur. Linker optimization = 0 does not disable removing unreferenced function but pattern matching and bank switching. Cheers Reynard
  10. Hi Jean-Marie, You are not giving us many clues here. Looking at the waveforms the remote device is set to: 8 bits no parity, Xon/Xoff handshaking. You are sending 7 charaters ("status" + another). I don't know whether this is some kind of checksum (sum, LPC or CRC). How does your program handle the none printable characters (DC1 and DC3). What does lprintf do with them. Do you filter them out. Cheers Reynard
  11. Hi Tom, The goto instruction takes 2 machine cycles. Cheers Reynard
  12. Hi, You have not set the prescaler on timer1 to 8 in order to get the 500ms timeout. You will not store the received string in the array because you have called timer_ms(20) and writing to the LCD. During this time characters are pouring in and overflowing the receive buffer. Cheers Reynard
  13. Hi David, The gets() functionis probably not the best thing to use. It id a blocking function that will only return when a CR has been recieved. Try using getc() function or just read the receive data register yourself. Cheers Reynard
  14. If you turn on "All Warnings" the compiler will give you a warning anyway. warning: expression is always true Cheers Reynard
  15. Hi Jean-Marie, Look inside the .h file at the puts() funtion and you can see that it appends the CR (0x0d) and LF (0x0a) to the end of your string. Just edit out the char you don't want. void puts(char *source) { while (*source != 0) // wait until tx register is empty putc(*source++); putc(0x0d); putc(0x0a); } Cheers Reynard
  16. Hi Shree, You cannot just let main() fall through the bottom. At the end of the main() function it has nowhere to return to as it was probably jump-to from the start-up code. You program will just go off into the woods, may just hang up, may find its way back to the restart vector, the watchdog may kick it back to the restart if enabled. If you only want the code to run once put a loop forever at the end to keep it within main(). You could also put the PIC to sleep. The F.01: will just be printed as text and is not a formatting code. It may have just been used to say which
  17. A semaphore is a flag that you use when using a shared resourse such as a printer, database record or variables. A semaphore indicates to some other task that the resource is currently in use by the current task and is therefore not available at this time to be used or modified by another. When a task is finished with the resourse it will reset the semephore allowing another task to use it. The other task will set the semaphore to indicate it is using the resouce. The main() loop and interrupt() function are two different tasks which can use the same global variables. Cheers
  18. Hi Jean-Marie , The assembler code doesn't look too good for the NbrePas = (Volume * 1000)/(SeringueActive.VolumePar_Pas/1000); statement. The intermediate value from the multiplication is getting lost. Cheers Reynard
  19. In the interrupt function you may be clearing the wrong intcon bit.
  20. You can set semaphores indicate a variable is currently being used to prevent the variable being changed when it is being used by some other part of the program. You could set up critical regions which will disable interrupts in the main program so that the interrupt routine cannot change the variable whitst being used. Cheers Reynard
  21. Hi Rye, But did you read the 'C' manual though ? Have you tried using a do {...} while(1); do { gpio.5 = 1; delay_ms(50); gpio.5 = 0; delay_ms(50); } while (1); Cheers Reynard
  22. Did you use these definitions for the config words from the .h files ? #define _CONFIG1 0x8007 #define _CONFIG2 0x8008 Cheers Reynard
  23. It may be due that the local variables have no assignment within the function and therefore unused so have been optimized out. Cheers Reynard
  24. Hi Bryan, You can have any of the PICs listed in the SourceBoost /inc directory. There are only 4 PIC wizards defined at the moment but who needs them. Maybe there will be more when V7 is released. MPLAB works OK with SourceBoost 'C' files. When you created your MPLAB project did you select the correct toolsuite ? Cheers Reynard
  25. Hi Rye, You may have to point MPLAB at different executable names like: boostc_pic16.exe and boostlink_pic.exe You may have to rebuild the project file as well. The names were changed a while ago, something to do with being falsely accused of containg a virus. Cheers Reynard
  • Create New...