
Reynard
EstablishedMember-
Content Count
688 -
Joined
-
Last visited
Everything posted by Reynard
-
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
-
Hi Joli, Take a look at the MAKESHORT, HIBYTE and LOBYTE macros in the boostc.h file. OR, just use a union. Cheers Reynard
-
Generating A Clock Signal
Reynard replied to meththas's topic in BoostC and Chameleon compilers programming
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. -
Generating A Clock Signal
Reynard replied to meththas's topic in BoostC and Chameleon compilers programming
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 -
Oscillator Selection Error?
Reynard replied to Shree's topic in BoostC and Chameleon compilers programming
Hi Shree, Your osscon.xxx code is outside any function {} Put it inside main() Cheers Reynard -
Using Multidimensional Arrays In Functions
Reynard replied to bongo's topic in BoostC and Chameleon compilers programming
Pavel, So why does my example not compile with BoostC but it does with another PIC compiler. Cheers Reynard -
Using Multidimensional Arrays In Functions
Reynard replied to bongo's topic in BoostC and Chameleon compilers programming
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 -
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
-
Optimization Level Being Ignored
Reynard replied to kdoney's topic in BoostC and Chameleon compilers programming
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 -
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
-
Instruction Clock Time
Reynard replied to TomF's topic in BoostC and Chameleon compilers programming
Hi Tom, The goto instruction takes 2 machine cycles. Cheers Reynard -
Clearing The Rcif Bit
Reynard replied to deveda01's topic in BoostC and Chameleon compilers programming
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 -
Clearing The Rcif Bit
Reynard replied to deveda01's topic in BoostC and Chameleon compilers programming
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 -
Common Error Which Should Be Flagged
Reynard replied to Alistair George's topic in BoostC and Chameleon compilers programming
If you turn on "All Warnings" the compiler will give you a warning anyway. warning: expression is always true Cheers Reynard -
Problem With Rs232_driver
Reynard replied to schneiderj's topic in BoostC and Chameleon compilers programming
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 -
Program Keeps On Runing!
Reynard replied to Shree's topic in BoostC and Chameleon compilers programming
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 -
Variable Protection In Interrupt
Reynard replied to dpat123's topic in BoostC and Chameleon compilers programming
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 -
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
-
In the interrupt function you may be clearing the wrong intcon bit.
-
Variable Protection In Interrupt
Reynard replied to dpat123's topic in BoostC and Chameleon compilers programming
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 -
12f683 Interrupt Problem....
Reynard replied to ryeg's topic in BoostC and Chameleon compilers programming
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 -
Pic16f19xx Targets -
Reynard replied to Ettore's topic in BoostC and Chameleon compilers programming
Did you use these definitions for the config words from the .h files ? #define _CONFIG1 0x8007 #define _CONFIG2 0x8008 Cheers Reynard -
Watch Window, Variables Showing "error" Value
Reynard replied to csym's topic in BoostC and Chameleon compilers programming
It may be due that the local variables have no assignment within the function and therefore unused so have been optimized out. Cheers Reynard -
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
-
Getting Mp Lab 8.36.00 Working
Reynard replied to ryeg's topic in BoostC and Chameleon compilers programming
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