Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Reynard

  1. Error reporting in V7.22 seems to be at an all time low. An undeclared variable only says: failure, error:failed, done. All warnings are turned on but not a clue to where the error may be. A badly declared enum give the same result. Cheers Reynard
  2. The adc.c source supplied was written before the PIC161827 was invented and covered the chips that were around at the time. You will have to make the necessary changes to suit the device you are using. It is diffucult to keep up with all the new parts from Micrcochip and where they put all the pins. Use the supplied libraries as a guide and write the code to suit your application. Do you want to use interrupts with adc or trigger it using the ccp feature. Cheers Reynard
  3. Hi Chuck, You are pushing it somewhat using a PIC16 device and floating point library. Keep your eye on the stack depth, you don't get much. You could try using the software stack feature but performance may suffer. PICs are cheap if you are building a one off unit. I use the PIC18F26K22 for most projects. Lots of ROM, RAM and speed. The floating point library doesn't keep intermediate results so you need to break down your VSWR formula into small bites as you are doing. You may have to experiment with the rounding flags to see which one gives the best results. If you need trig functions then you are up the creek unless you write your own. Good luck Reynard
  4. Hi Pavel, A small gripe I have is that PIC16 devices with an 8 bit FSR are being allocated 2 bytes for a pointer. For small devices with a scarce RAM resource (upto 256 bytes) this is a bit of a waste of RAM usage. Cheers Reynard
  5. I find that spaces are not liked for source and header files etc. Change your spaces to underscore or something. You can use spaces in directoriy, workspace and project names though and Sourceboost will create output files which include spaces in them. Don't try and link in old (V6) object files with new (V7) linker. Recompile. Cheers Reynard
  6. Hi Gianni, Sourceboost compiling OK gives some comfort that your program is good to some extent. I don't use MPLAB or pickit so cannot give any advice here. You do have to include the idc3.h header if you are debugging. I assume MPLAB will set the DEBUG bit accordingly in the config word. Good luck Reynard
  7. I get something different at the top of my .asm file: include "P16F887.inc" ; Heap block 0, size:112 (0x00000110 - 0x0000017F) __HEAP_BLOCK0_BANK EQU 0x00000002 __HEAP_BLOCK0_START_OFFSET EQU 0x00000010 __HEAP_BLOCK0_END_OFFSET EQU 0x0000007F ; Heap block 1, size:96 (0x00000190 - 0x000001EF) __HEAP_BLOCK1_BANK EQU 0x00000003 __HEAP_BLOCK1_START_OFFSET EQU 0x00000010 __HEAP_BLOCK1_END_OFFSET EQU 0x0000006F ; Heap block 2, size:80 (0x000000A0 - 0x000000EF) __HEAP_BLOCK2_BANK EQU 0x00000001 __HEAP_BLOCK2_START_OFFSET EQU 0x00000020 __HEAP_BLOCK2_END_OFFSET EQU 0x0000006F ; Heap block 3, size:60 (0x00000034 - 0x0000006F) __HEAP_BLOCK3_BANK EQU 0x00000000 __HEAP_BLOCK3_START_OFFSET EQU 0x00000034 __HEAP_BLOCK3_END_OFFSET EQU 0x0000006F Can you check the .tdf file in the config directory and look at the RegisterGP definitions. There should be 5 of them, one for each RAM block. Cheers Reynard
  8. Your heap has exceeded the maximum contiguous allocation for any RAM bank. You will have to reduce the RAM chunk allocation size to 95 bytes max. (Why not 96 ?) DO you have any large constant strings that you have not put in ROM. DO you have any large arrays. Cheers Reynard
  9. Hi Ted, Just try using: #pragma DATA 0x500,"Hello" Just like you would to set config or eeprom data. Cheers Reynard
  10. Hi Midin, I see you have the control and data on the same port. This will cause a few problems if not taken care of properly. When you write the 4 bits of data you are writing all 8 bits therefore over-writing any controls bit you have set previously such as the RS bit. Which will be reset to a 0 if set before writting the data. Depending upon the type of PIC you are using, you may also suffer from the "read-before-write" gotcha. Try using a port shadow register. When writing new data AND out the old and OR in the new. Write the shadow register to the port. A few more lines of code but should solve your problems. Cheers Reynard
  11. Hi Remi, Your config 4L has extended instruction set enabled. This is not supported in SourceBoost. Use the type 2 config options they are much easier to read for anyone looking at your code. //#pragma DATA _CONFIG4L, 0b11000101 #pragma config DEBUG = OFF // Background debugger disabled, RB6 and RB7 configuredas general purpose I/O pins #pragma config XINST = OFF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode) #pragma config BBSIZ = 1024 // 1K words (2K bytes) Boot Block #pragma config LVP = ON // Single-Supply ICSP enabled #pragma config STVREN = ON // Stack full/underflow will cause Reset You are running with watchdog enabled, but nothing to reset it. I assume your programmer uses low voltage programming. The spec says set the Tx output pin to an output (trisc.6 = 0). Cheers Reynard
  12. Hi Coder, You have to use asm within a function block curly braces. void main() { asm { LABEL1: goto LABEL1; } } The semi-colon is not necessary unless you plan adding comments. Cheers Reynard
  13. Hi acroty, If the text string is between double quotes then the compiler will insert the terminating null for you. If you are building a text string into an array character by character, it is you that has to insert the null at the end. You character array must be one bigger than your largest text string. Good you are making some progress. Cheers Reynard
  14. Hi acroty, Your config bits need a little bit of work done to them. SourceBoost doesn't respect the erased default values of the config words. You MUST define all the bits whether they are of interest to you or not. You have the extended instruction bit set even though you did not enable it. SourceBoost enabled it for you even though it is not supported because you didn't explictly so not to (_XINST_OFF_4L ) For PIC18, use the type 2 config method it is much clearer to what is going on. Just cut and paste from the .h file into your own config.h file. Here is a little taste of one of mine: #pragma config FOSC = HSMP // HS oscillator (medium power 4-16 MHz) #pragma config PLLCFG = ON // Oscillator multiplied by 4 #pragma config PRICLKEN = ON // Primary clock is always enabled #pragma config FCMEN = OFF // Fail-Safe Clock Monitor disabled #pragma config IESO = OFF // Oscillator Switchover mode disabled #pragma config PWRTEN = ON // Power up timer enabled #pragma config BOREN = OFF // Brown-out Reset disabled in hardware and software #pragma config BORV = 285 // VBOR set to 2.85 V nominal Using the internal oscillator is not always a good idea for serial comms due to its accuracy and drift even if you do calibrate it. Use a crystal such as 11.0592MHz and use x4 PLL to get the most out of your chip. Cheers Reynard
  15. Hi acroty, I am using the PIC18F26K22 with a GSM modem to send and recieve SMS messages. I am manipulating text strings big time without any problems. Your text array is still not NULL terminated as shown in my previous reply. Cheers Reynard
  16. Hi acroty, Remember strings require a terminating null at the end so make room for it. char str[6]; str[0]='H'; str[1]='e'; str[2]='l'; str[3]='l'; str[4]='o'; str[5] = '\0'; UART_putStr(str); Enclose while loop statements inside curly brackets even though you only have a single statement. It looks better and is good practice. You may want to add more to your while loop later. Cheers Reynard
  17. The switch expression is evaluated only once then compared with a list of constants. Cheers Reynard
  18. A note in the manual to say that plain char is considered unsigned would help. Char should always be qualified with signed or unsigned if used for computation. Use plain char for text strings. In olden times char contained a printable character, which is always a positive value. Cheers Reynard
  19. When the code goes over the 64k byte mark the hex file contains Extended Linear Address Records. Does you programmer support these records or are they being ignored. Since you can select the correct device on the programmer one would think so. Worth checking though. Cheers Reynard
  20. Hi Tim, The problem is not with you but Dave and Pavel have missed a bit out of a couple of files. Here are some instructions on correcting the missing DEBUG config bit. 1. Open the PIC18F26J50.h file in a text editor. (RJ TextEd is one I like). 2. Open the PIC18F25J10.h file. Find the DEBUG ON/OFF pragma and copy the lines of text. ////////////////////////////////////////////////////////////////// // Background Debugger Enable bit: // #pragma config DEBUG = ON // Background debugger enabled; RB6 and RB7 are dedicated to In-Circuit Debug // #pragma config DEBUG = OFF // Background debugger disabled; RB6 and RB7 configuredas general purpose I/O pins 3. Past the lines to the bottom of the PIC18F26J50.h and save the file. 4. Open the PIC18F26J50.tdf file (from the \config directory. 5. Open the PIC18F25J10.tdf file. 6. Find the TargetConfig DEBUG section of text and copy. TargetConfig DEBUG { // Background Debugger Enable bit: ConfigRegAddr = 0x00007FF8; ConfigBitMask = 0b10000000; ConfigSettings = 0b00000000, "ON", "Background debugger enabled; RB6 and RB7 are dedicated to In-Circuit Debug", 0b10000000, "OFF", "Background debugger disabled; RB6 and RB7 configuredas general purpose I/O pins"; } 7. Paste into PIC18F26J50 after the TargetConfig XINST section of text. 8. Change the ConfigRegAddr to 0x0000FFF8 and save the file (as it is a different device). ConfigRegAddr = 0x00007FF8; to ConfigRegAddr = 0x0000FFF8; 9. In your source file add the line: #pragma config DEBUG = OFF Recompile and see if that works for you. If you upgrade to a newer version of SB, check if these files have been corrected as they will be overwritten. I think there are several files with the DEBUG config missing. Cheers Reynard
  21. Hi Tim, You probably have DEBUG enabled for in-circuit debugging. I don't see anything in the .h and .tdf files to disable this in the CONFIG1L bit 7. You may have to patch these files from copy line from file which do have it. Cheers Reynard
  22. Thanks Pavel. Who hasn't been there before when you change something to find it bites you further down the road. I appreciate that it is diffucult to test all combinations of statements. That's why you have the forum to iron out the creases and produce a value for money product. Look forward to the next release. Cheers Reynard
  23. Hi Pavel, I need the confidence that I can write any legitimate C statement and the correct result will be supplied. Spending time debugging good code to find it was the compiler that got it wrong is time consuming. Having to re-write my code to find a workaround that works is expensive and causes project delays. For the readers: The reason I put my module data into a structure reduces the amount of bank switching that takes place and therefore gives a performance boost. The structure keeps my related data on the same RAM page. Without the structure the linker is free to scatter my data over any RAM page resulting in many bank switching instructions being used. Cheers Reynard
  24. 7.12 Released version doesn't fix my problem Cheers Reynard
  25. Hi Pavel, I still have the same problem in the released 7.12 ++evt.head; 1E58 0E03 MOVLW 0x03 1E5A 273C ADDWF gbl_30_evt+D'60', F, 1 evt.head += 1; 1E5C 0E03 MOVLW 0x03 1E5E 273C ADDWF gbl_30_evt+D'60', F, 1 1E60 B0D8 BTFSC STATUS,C 1E62 2B3D INCF gbl_30_evt+D'61', F, 1 Doesn't seem to know whether the pointer is 1 or 2 bytes long. Cheers Reynard
  • Create New...