Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by joli

  1. Hi, As everyone knows, a new project created by Project Wizard, is limited to a few PICS. The PIC's showed in the combo List are defined inside of c:\....\SourceBoost\boost.wizard.templates. Inside of this folder we have: commum, PIC16F84, PIC16F628, PIC16F877 and PIC18F242 folders, which corresponds to the chips available. How to expand this list? Example: create a Project with PIC16F886. 1. choose the closest that is PIC16F877. 2. Copy this folder and rename it to PIC16F886. 3. Inside of PIC16F886 edit data.boost.wizard and main.c.template files. 4. Delete all sections related with PORTD that not exists on this PIC. Now we be able to create a project with PIC16F886. I'm sure we can play with those files to do another things. P.S.. After compile i verified that fuse configuration word needs a few adjusts. Here is a question that who knows could give an answer. Regards. Joli
  2. You need to use the MPLAB integration button that appears during the SourceBoost installation, copying the files alone is not enough. Regards Dave Hi Dave, What you suggest doesn't work. After reinstall BoostC, i realized that no file (mtc/ini) was copied to C:\Program Files\Microchip\MPLAB IDE\Core\MTC Suites. I'm surprised it does not work because i saw users in this forum who have it work and more because this should be a basic procedure. By the way, i hope not to lose BoostC registration license after reinstallation, i forget to see it. Windows XP PRO SP3 BoostC V6.96 - Full Licence Mplab V8.50 What i'm doing wrong? Can i download and install BoostC V6.97 over the old version without losing license registration? Exists any manual procedure to do it even at Registry level? Regards Joli
  3. After read all forum posts i can see about this subject, is no way to get this working. In the Boostc Manual exists a reference about it that says, to integrate BoostC within Mplab, just copy all those mtc and ini files to the c:\Program Files\Microchip\MPLAB IDE\Core\MTC Suites, which path is my case by default and is done. I tried it several times and i haven't Boostc in the MPLAB -> Set Language Tool Locations Menu/Window. The same thing on MPLAB -> Select Language Toolsuite. Can anybody explain me what kind of sorcery is that? Regards, Joli
  4. Ops, something happens when modifying this post, that deleted part of the text, sorry. Here are the conclusions i have reached so far about the question placed in first place on this topic, eventually useful for other users: 1. I forgot to mention that in my last example, all strings are placed in RAM that's not what i wanted ! 2. Also in my last example the "LcdPrintString", should be "LcdPrintMsg", sorry my mistake. 2. Picking Dave suggestion and reading "BoostC" manual, whose practice is always interesting, i tested this code successfully, now with the strings in rom. #define uchar usigned char; // Null-terminated strings placed in ROM rom uchar *Msg1 = "IP:\0"; rom uchar *Msg2 = "Socket:16384\0"; rom uchar *Msg3 = "TCP: OFF\0"; // and so on.. // Function to send a string to LCD 16x2, included on my lcd.c driver void LcdPrintMsg( uchar msgnumber, uchar line_colunm ) { uchar c, i; // some lcd handle code removed, while useless to the discussed subject for( i=1; i<4; i++) // "4" is equal to the number of strings we have minus 1. { switch( msgnumber ) { case 1: c = Msg1[i]; // "c" with char of desired string, indexed by "i" break; case 2: c = Msg2[i]; break; case 3: c = Msg3[i]; break; default: return; } if( !c ) break; // Out when 0 (zero) contents LcdPrintChar( c ) // Print current char } } void main( void ) { LcdPrintMsg( 1, 0x11 ); // First arg with message number, second with line/colunm } Dave, i remain convinced that the compiler should support pointers to ROM data in a near future. I confess that i don't read yet the topic about this matter. Regards Joli
  5. First of all, i would like to thank you IanM, that clarified me how to implement it, in another post in this forum. Back to the subject. I have an RTC working with TIMER1 that uses year, month, day, hour, minute and second variables. This is a function to have a clock with date and time. But some times i need to send by serial port or to an external ram all those variables contents, previously converted to ASCII HEX and is stupid to repeat code for each var, like this: Hex2Bin( year ); // Convert bin to two ASCII hex: ( for ex: 30 decimal results in '1' and 'E' ) SendSerial( msbhex ); // Most significant hex value in ASCII SendSerial( lsbhex ); // Least significant hex value in ASCII // and so on, until "seconds" Instead, is more efficient in terms of code space to have: for( x=0; x<7; x++ ) { Bin2Hex( datetime[x]); SendSerial( msbhex ); SendSerial( msbhex ); } So, to do that, i used this data structure: typedef union { uchar tdatetime[6]; struct { uchar tyear; uchar tmonth; uchar tday; uchar thour; uchar tmin; uchar tsec; }sdatetime; }UDATETIME; UDATETIME udatetime; #define datetime udatetime.tdatetime #define year udatetime.sdatetime.tyear #define month udatetime.sdatetime.tmonth #define day udatetime.sdatetime.tday #define hour udatetime.sdatetime.thour #define min udatetime.sdatetime.tmin #define sec udatetime.sdatetime.tsec With this type of structure i have the flexibility and allows me to write my code inside of the RTC in the traditional way, as shown bellow: sec++; if( sec > 59 ) { sec = 0; min++; // and so on And also i can have access to those vars by using an index. Of course, we can also use pointers, but i prefer the arrays because the use of pointers produces much additional code. This is specially true, when we have a large applications, which is often my case. This is also true when we want to write just "year = 10" instead of "datetime[x] = 10". The first way is shorter in code. for the beginners, there follows a brief explanation. When we write "year = 10" in fact is the same to write "datetime[0] = 10" and so on until the last one. This means that the array datetime[0..5] shares the same address as year, month, day, hour, minute and second, in the same sequence. This is what union does, joins two or more data to share the same address space, while the struct distributes the data sequentially. Of course this kind of data structure can be useful for different purposes and sizes. This is intended to be a little contribution in honoring those who helped me in this forum, and also to show somehow this compiler is flexible compared for example with old one i use. Thank you BoostC people, we have here a great compiler, that just need a some little adjustments, in my point of view of course. And also thanks for your work philosophy that somehow seems to meet the needs of users in terms of product evolution, combined with a very competitive price. Regards Joli
  6. How we can calibrate PIC12F675 internal rc oscilator with precise pre-defined value saved by Microchip using BoostC ? Download PIC12F675 datasheet and search for "Calibrating the Internal Oscillator" to see what is and how it works. BoostC example: void Calibrate( void ) @ 0x03ff { asm movwf _osccal } Now in the main function: void main( void ) { CalibrateOsc(); // User code } As written in the datasheet, before and after "asm movwf osccal", the user must set the right RAM bank. Although it is always advisable to do so, i can say that boostc is smart enough and does it for us. regards Joli
  7. Additionally what Reynard said, you have "pragma" commented. Now a little suggestion. You can also do it like this unsigned char temp_io; void main( void ) { while( 1 ) { delay_s( 1 ); temp_io ^= (1<<4) // Led pin: (1<<4) results in 0b00010000 gpio = temp_io; } } Regards, Joli
  8. Thanks Dave, This should be a solution to me. Meanwhile i had already reached this conclusion as my code have: #define uchar usigned char; uchar *pointer; uchar temp; // Null terminated strings const uchar Msg1[] = "IP:\0"; const uchar Msg2[] = "Socket:16384\0"; const uchar Msg3[] = "TCP: OFF\0"; // and so on.. // Function to send a string to LCD 16x2, included on my lcd.c driver void LcdPrintString( uchar msgnumber, uchar line_colunm ) { // some lcd handle code removed, while useless to the discussed subject switch( msgnumber ) { case 1: pointer = & Msg1; break; case 2: pointer = & Msg2; break; case 3: pointer = & Msg3; break; default: return; } do { temp = *pointer; if( temp ) lcd_4bit_write( temp ); pointer++; }while( temp ); // Get out when end of string } // So i can put message on LCD like that: void main( void ) { LcdPrintMsg( 1, 0x11 ); // First arg with message number } Any suggestions are welcome. Regards Joli
  9. #define CNTADDR 0x0120 // First address in the Bank 2 #define CNTSIZE 0x0012 // 18 decimal uchar counters[CNTSIZE] @CNTADDR; uchar countix @CNTADDR + CNTSIZE; In the code above, why preprocessor can't resolve "countix" address and compiler give me a general error on this last line? Why it happens one time compiler know what address should apply to the counters[CNTSIZE] and unknow a simple CNTADDR + CNTSIZE address calculation to apply for the countix variable? Regards.
  10. Hi JM, Right now i have in hands a project that should be finish in 2..3 weeks. After that i will start one that include something like your job but with different pic18, that i think is irrelevant in this case. When the time comes, i'm interested in talking about it with you and post here doubts that eventually appear. Meanwhile, can you please place in this forum the application mentioned microchip url? P.S. Take a look to: http://forum.sourceboost.com/index.php?showtopic=4133 As i can see all it works. Regards, joli
  11. Hi, In a recent past with my old compiler, i could have in rom, one array that points to a rom string array collection, like that: const char str1[] = "String_\0"; const char str2[] = "_String_2\0"; const char str3[] = "__String_3\0"; const int Msgptr[] = { str1, str2, str3 }; // Array that points to messages str1, str2, str3... int far *pointer; // pointer that later will point to the beginning to an chosen message So i could codify like thus: pointer = MsgPtr[ 0 ]; // pointer points to the beginning of str1[] for( pointer = 0;;pointer++) { PrintChar( *pointer ); // PrintChar, is a user function i have to send chars pointer++; // Point to next char if( *pointer == 0 ) break; // Jumps out when zero termination string detected } Thus i could work with string array collection just by enumerate them. There is a way to do this with current version 6? Regards, joli
  12. Currently wizard is limited to only a few targets. This does not depend on the license. We plan to change this in v7. For now the workaround is to use wizard target closest to your device. Regards, Pavel One question, Are you planning at IDE level Version 7, something like let the user write templates and thus turn this process independent of how features are built-in? If that makes any sense, user would be free to add the PIC's he wanted. By the way, i have been troubles with this forum. Two examples are: i can't see posts that exceeds one page, also is impossible to reply. At least to me, i concluded that exists some incompatibility with Internet Explorer 8. Firefox works fine. Thanks, joli
  13. Hi, They are many ways to do it. One i use, for instance to receive is by interrupt. if( pir1.RCIF ) // USART interrupt - requires enable uart interrupt bit { rxbuffer = rcreg; // Recebe sempre dados } Whenever anything arrives RCREG is saved to rxbuffer (unsigned char). Now, to send something, just do: if( txsta.TRMT ) // I use "if" because this is inside of a machine state { txreg = txbuffer; } Of course, before use it you have to configure uart first. Later we can continue with this. Regards, joli
  14. Hi, Why the only available pics are PIC16F628/84A/877 and PIC18F242 when i create a project with Wizard? This is thus or it is a kind of licence limitation? Weeks ago i purchased a Boostc FULL licence from Farnell as mentioned already in this forum. It was interesting that i could choose all in the "include" directory. Thanks, joli
  15. Hi Raghunathan.P Thank you by your reply. Perhaps i haven't explained properly, but i never mentioned "signed data". Original post have to do with the Boostc 24 bit data type lack. Imagine you have 24 engines for which you have to keep the number of laps that each has until now. I have to count to 10 million (10,000,000). To represent this number 3 simple bytes enough 1. My job is to keep 24 variables with 3 byte each (24 x 3 = 72 bytes) that should fit on a single ram page. 2. Each PIC16F886 Page1, 2 or 3 have 80 bytes and pages 0, 2 and 3 are already full. 3. So i only have page 1. 4. I should be able to update those 24 variables adding any value, 1, 2, 10 whatever, but always positive values. Example below shows how data is placed in ram --------- RAM ADDR+0 | LSB |<-| --------- | RAM ADDR+1 | MID |<-| 24 bit Counter number 1 --------- | RAM ADDR+2 | LSB |<-| --------- --------- RAM ADDR+3 | LSB |<-| --------- | RAM ADDR+4 | MID |<-| 24 bit Counter number 2 --------- | RAM ADDR+5 | LSB |<-| --------- - And so on, until an total of 24 Counters with 3 bytes each (24 bits). As Boostc doesn't have 24 bit data types, but only 8, 16 and 32 bit, how to do what i need within 80 byte limitation? Now, picking your example, can you explain to me what it do? Regards, joli
  16. I am sure the driver isn't intended for exclusive use with NOVO, it just happens that the demo code demonstrates the use of the driver with NOVO - killing two birds with one stone! Perhaps another simple demo is called for to demonstrate the driver without using the RTOS? Regards davidb That would be an interesting ideia. Regards, joli
  17. Driver release candidate can be found here http://forum.sourceboost.com/index.php?showtopic=4534 Regards, Pavel As i understand by looking to the driver code, this is to use with RTOS (novo)!? If is the case, i'm sorry but right now is impossible to alocate time to do the necessary and apropriated tests. Anyway, thank you. joli
  18. Back to post #8, After doing some tests and see code results, i concluded that for the compiler point of view, more eficient code is generated if use array index instead of pointers. This situation have to do with FSR, INDF PIC mechanisms manipulation. I recall that the objective is to have a long collection of 24 bits variables, because boostc doesn't support this type, having in account RAM limitations. So the idea is to have this colection organized as follows: parcnt[0] \ parcnt[1] | 1st 24 bit var parcnt[2] / parcnt[3] \ parcnt[4] | 2nd 24 bit var parcnt[5] / ... and so on... the same to acucnt[] I made some adjusts in the struct using typedef in way to get a more readable code, as suggested by a friend in this forum (good trick). typedef union { ulong var32bit; struct { uchar templo; uchar tempmid; uchar temphi; }stmp24; }UTMP; UTMP utmp; #define temp32 utmp.var32bit #define templo utmp.stmp24.templo #define tempmid utmp.stmp24.tempmid #define temphi utmp.stmp24.temphi unsigned char ix; void main( void ) { parcnt1[0] = 0xFF; // this is 24 bit var part of array i want work on parcnt1[1] = 0x20; parcnt1[2] = 0x30; CounterInc( 1 ); // Function call to Increment value } Of course the functios have to reflect this changes: char IncCounter( uchar cntindex ) { ix = (cntindex-1)*3; // Adjust index to appropriate place // Copy array number into temp buffer templo = buff24bit[ix++]; tempmid = buff24bit[ix++]; temphi = buff24bit[ix++]; temp32++; // Increment value inside of 32 bit var aix-=3; // Reajdust array index buff24bit[ix++] = templo; // copy back incremented value buff24bit[ix++] = tempmid; buff24bit[ix++] = temphi; } Instead of proposed in post #8, now only one function do everthing: - Copy 3 byte array indexed by passed parameter, originaly loaded with 0x3020FF. - Increment 24 bit inside of temp32 that is a 32 bit variable, result is 0x302100. - Copy back to the array, the temp32 result. As reg68gi said about get 24 bit value from spi, in the function IncCounter() instead of temp32++, we can have: temp32 << 1; temp32.BIT0 = SPIBIT; Of course, if we talk about few variables, is preferable use 32 bit vars even with the waste of one byte by each. The objective of this is to see if some one have an more simple way to do this job. Regards, joli
  19. Hi Henrik, I already knew this compiler, the question is when i look at him couple years ago, it had some anoying limitations that as i can see minuts ago, longer exist. url you post haven't any forum. Can you tell me more about it? By the way, may be isn't correct talk about this in this forum, at least i don't feel confortable, so if you want tell me where whe can procced in another forum or maybe be e-mail, please do. One word to David and Pavel: Sorry about that and thank you for your understanding. Regards, joli
  20. We are in process of rewriting the uart driver that is included into SourceBoost. Will make it available soon. Anybody wants to beta test it? Regards, Pavel Hi Pavel I am very interested in testing this driver Regards, joli
  21. Hi, One time i have so many 24 bit data saved on the internal ram and conscious they are many ways to do this, let me show one that i wrote. The only thing the code do for demo purposes, is to increment 24 bit value placed inside of one array, that can be any. Of course in the real app, i need do addtional operations with this values. The creation of arrays was a way to have and reserve ram space for 24 bit values (variables). char parcnt1[3]; // Parcial count result (24 bit); char acccnt1[3]; // Accumulated count result (24 bit); char *aptr; // Pointer to array i want // 32 bit ram memory but only 24 bit used // This is a temporary space to work with a simple var union { long temp32; // 4th byte not used struct { char templo; // Low byte | char tempmid; // Middle byte | 24 bit space char temphi; // High byte | }stemp; }utemp; //////////////////////////////////////////////////////////////////////////////// // Purpose: Copy array pointed by aptr to the temp struct //////////////////////////////////////////////////////////////////////////////// void Copy2Temp( void ) { utemp.stemp.templo = *aptr; aptr++; utemp.stemp.tempmid = *aptr; aptr++; utemp.stemp.temphi = *aptr; aptr--; aptr--; // Pointer back to the index 0 } //////////////////////////////////////////////////////////////////////////////// // Purpose: Update array with temp struct contents //////////////////////////////////////////////////////////////////////////////// void CounterUpd( void ) { *aptr = utemp.stemp.templo; aptr++; *aptr = utemp.stemp.tempmid; aptr++; *aptr = utemp.stemp.temphi; } //////////////////////////////////////////////////////////////////////////////// // Purpose: Increment value inside of temp struct //////////////////////////////////////////////////////////////////////////////// char CounterInc( void ) { Copy2Temp(); // First copy my array to temp struct utemp.temp32++; // Increment value CounterUpd(); // Update my array } void main( void ) { parcnt1[0] = 0xFF; // this is array i want work on parcnt1[1] = 0x20; // so i assign 0x3020ff parcnt1[2] = 0x30; aptr = &parcnt1[0]; // aptr point to my array CounterInc(); // Increment value } The objective of this code is to avoid as can as possible repetive code and by other hand to have universal functions to do what i have to do and finally to save ram space. Of course if had 24 bit vars the code seing in the main() would be so: var24bit parcnt1; // where "var24bit" would be 24 bit type as "long" is 32 bit type void main( void ) { parcnt1++; } That's it Please feel free to advise about simplest ways. regards, joli
  22. 24 bit floats ?? Regards Dave Some ADCs store the adc results (24bit) in signed 2s compliment format. The datas are usually sent out via SPI. In such case a it can be a little helpful if we could directly load the value into such data types. Regards Raghunathan.P Hi ra68gi, Agree, one more reason that make sense. Maybe all C# compiler makers, think in terms of ansi c# that have 8, 16 and 32 bit data types. In such cases as is my present case, we have to do it manually or even in assembly. Regards, joli
  23. 24 bit floats ?? Regards Dave Hi Dave, No Dave, i mean 24 bit integer. I know that no other compiler have it and i don't know why, because PIC as other little microcontrollers have so few resources. Let me give an example that i have in hands: Besides other things, not so few as you can think, my app have to mantain in memory the result of 16 counters with maximum capacity of 10000 (ten million), so i just need 24 bits (3 bytes). For each counter i need two results, total and parcial results. As i only can represent it by 32 bit vars, i need "2 x 16 x 4 = 128 bytes". If i could use 24 bit variable, only needed "128 / 4 x 3 = 96 bytes". Also all this data must be saved into a several external spi ram's (round buffer) for wich some pointer have to exist. Also some time critical data have to exist in internal ram. At the same time i have to mount/dismount packages for/from tx/rx with this counters info, besides other things. The result will be some overhead and more unecessary code to save ram memory. So, this is the reason i ask for. Ok, someone will tellme i have to use some 18F or 24F pic. No thanks, i prefer PIC16F886 Please consider my words as result of a bad day of work, and not a cricism of Boostc that by what i see until now, is very good. Regards, joli
  • Create New...