Jump to content

joli

EstablishedMember
  • Content Count

    85
  • Joined

  • Last visited

Everything posted by joli

  1. Nobody's of sourceboost has an answer? This is a situation to be resolved in an next release? eg. v6.98? Or the question rised is meaningless? Regards, Joli
  2. My apologies, i forgot completely that these values were 16 bit. As Dave said, you can have all values in 16 bit format. So, maybe the best idea is to show an example i made to test it working. rom char *fractions = { 0x00, // 0 0x00, 0x00, // 125 0x7d, 0x00, // 25 0x19, 0x01, // 375 0x77, 0x00, // 5 0x05, 0x02, // 625 0x71, 0x00, // 75 0x4b, 0x03, // 875 0x6b }; unsigned char x; for( x=0; x<8; x++) // Only show first 8 to fit on my LCD { Bin2Hex( fractions[x] ); // My data conversion function LcdPrintChr( hexhi); // My LCD function LcdPrintChr( hexlo); } As a result, my Alphanumeric LCD shows: "0000007D00190177" Note1: declared values are in big endian i.e. msb byte first, obvious you can change it. For your needs you can do as you want. Note2: As stated in the BoostC Manual page 42 "rom can be used with char data types only", this means that all 16 bit values must be separated into 2 bytes and declared thus. My example that uses LCD is not important, what matters is how you can declare and read data placed in rom. Tell us about your progress Regards, Joli
  3. Hi edeca, Try this way: rom char *fractions = { 0, 125, 25, 375, 5, 625, 75, 875 }; // DS620 temperature sensor format // SIGN | 2^7..2^0 | 2^-1..2^-4 | 0 0 0 void convert(unsigned short reading) { unsigned char whole; unsigned char fract; bool positive = true; // This table is good for 3 bit resolution /* char* fractions[8] = { "0", "125", "25", "375", "5", "625", "75", "875" }; */ if (reading & 0x8000) { positive = false; reading = ~reading + 1; // 2s complement } whole = reading >> 7; fract = (reading >> 4) & 0x7; if (!positive) { serial_printf('-'); } else { serial_printf('+'); } serial_print_dec(whole); serial_printf('.'); puts(fractions[fract]); } Regards Joli
  4. 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
  5. 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
  6. 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:192.168.2.100\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
  7. 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
  8. 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
  9. joli

    Pic 12f675 Not Working

    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
  10. 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:192.168.2.100\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
  11. 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
  12. joli

    Project Wizard Limitations

    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, 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
  14. joli

    Project Wizard Limitations

    I see, Thanks Pavel
  15. 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
  16. 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
  17. Hi, After a Boostc test period by modifying several apps maded in another compiler (very old) allready working in my costumers, i decided to adopt Boostc and use it for a new real project. One of my needs for this particular project is, to have a 24 bit data type. So, there is a way to define 24 bit data type variables ? Another question is: When i close/save my work to continue in the next day, when reopen it next day or several times in the same day, all work files opened in the edit area (right side) in the previous session, are closed. So, every time i have to open this files manually. They are some missing IDE configuration to do that automatically ? I mean: "When reopen one project all files opened in the previous session are reopened automatically" Thanks joli
  18. joli

    Usart Error ?

    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
  19. joli

    Usart Error ?

    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
  20. 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
  21. 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
  22. joli

    Usart Error ?

    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
  23. 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
  24. 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
  25. 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
×