Jump to content

Reynard

EstablishedMember
  • Posts

    688
  • Joined

  • Last visited

Everything posted by Reynard

  1. Hi Tom, The pic you are using only has a 16 deep stack. The number of nested functions called in your main program and interrupt routines (combined) has exceed the stack depth. The call stack is shown in the code window of the IDE, assuming you are using the SB IDE. You should look at reducing the number of nested calls inside your interrupt function. Cheers Reynard
  2. Yes the config word is only 14 bits, but the original poster asked about not setting the most significant bit. Cheers Reynard
  3. You can simply add a 0x7fff to the config string like this; #pragma DATA _CONFIG2, _LVP_OFF & _BORV_19 & _STVREN_ON & _PLLEN_OFF & _WRT_OFF & 0x7fff Cheers Reynard
  4. Hi Brian, I also get the "debug can't open project.cof file" due to there being nothing in the code window (and tabs) except "No listing file exists for current project". If I then proceed to open the same workspace using "Workspace - Open Workspace" menu, the workspace reloads and fills in the code window and all tabs (Assembly-Call Tree-Function Info) then debug works OK. Spaces in file paths or names work with this method. I will stick with 7.03 and open my workspaces using the menu system. Cheers Reynard
  5. Found the Goodies files: They are put into your My Documents folder. Cheers Reynard
  6. Hi Brian, I agree with you on this one. The problem seems to be that there are no files displayed in the code window. This problem occurs when you first open the IDE and the last workspace is opened but no code window data. If you try to open a workspace using the MRU list you also get no code window files. If you use the Open Workspace and browse to the required workspace and open all is well. My Goodies files did not seem to get updated either. Cheers Reynard
  7. How have you declared S, L and X ? Are they constants, enums or variables ? Does L really exist ? Try to avoid single letter names as they can get confused with register and bit names already defined in the PIC header file. Cheers Reynard
  8. Hi, What voltage are you using for Vref+ ? Does it work if you use Vdd instead ? Vref+ has to be greater than Vdd-2.5V Does it work in real life and not in simulation mode ? Cheers Reynard
  9. Hi, The makers say the compiler is "close to ANSI C". This is a very low cost product. Dave and Pavel probable to not have the resources to write a full blown manuals for all their products. Scan through the standard C header files to get the syntax or just assume standard C. Remember that a PIC has its limitations and is not a Pentium or whatever Intel are selling these days. BoostC does have features missing that other PIC compilers do have but you have to compare the product price as well. I always say, "If the feature you want isn't there, write your own". Cheers Reynard
  10. Hi, SourceBoost doesn't teach you the C language. There are thousands of books out there that can do that for you and web sites. SourceBoost manuals tell you how to use the compilers etc. Cheers Reynard
  11. Hi Tony, Have you tried setting the osccon reg to 0b01111110 ot 0b01111111 to select the internal oscillator and not the primary oscillator which is an external xtal. Cheers Reynard
  12. Hi Colin, Section 3.2 of the data sheet say 80 bytes of GP RAM in each bank and 16 bytes of common RAM. It would appear you are limited to 96 bytes provided you do not use common RAM elsewhere. With a bit of programming though you can use multiple banks to create a large buffer. i.e allocate several 80 byte blocks. Cheers Reynard
  13. Here is a simple funtion: unsigned char sqrtz(unsigned short val) { unsigned short res, one; res = 0; one = (65535 >> 2) + 1; while (one > val) one >>= 2; while (one != 0) { if (val >= res + one) { val = val - (res + one); res = res + 2 * one; } res /= 2; one /= 4; } return(res); } Cheers Reynard
  14. The bug probably lies with version 7.00 which has now been corrected. The Build Options are for the project and not each source file. Your workspace window is blank, hence not Build Options and greyed buttons. Put all your associated source files into a project and build them all using the same options settings for the project. Cheers Reynard
  15. Don't forget to add the #include <float.h> header to your source. This seems to work: int adcValue = 100; long result; result = float32_to_int32(float32_mul(float32_from_int32((int32)adcValue), 0.433)); but like Alex says, it is a bit overkill if you do not have further use for FP numbers. Cheers Reynard
  16. Hi Alex, You need to cast the variable to a long otherwise multiplying by 433 may exceed an integer size. int_result = (long)variable * 433/1000; Cheers Reynard
  17. Use the Help menu from the IDE and there is the FP library manual. Cheers Reynard
  18. Floating point variables are not native data types in SB. Use the floating point library to do what you need. Cheers Reynard
  19. The 12F1822 and 12LF1822 exist in my copy of SB. Cheers Reynard
  20. Hi John, If your PIC programmer is any good it will allow you to change/edit the EEPROM data before you program the device. That way you can insert a unique serial number into each device and use that as your initial seed value etc. Cheers Reynard
  21. Hi John, If you have EEPROM you could save the initial random number and use that as the seed for the next power-up. Cheers Reynard
  22. I am unable to cast any data type greater than a char to a bool. bool myFlag = false; unsigned int myInt; void main() { myInt = 0xffff; myFlag = (myInt & 0x0100); } Produces:- bool myFlag = false; 001C 9003 BCF gbl_myFlag,0 unsigned int myInt; void main() { myInt = 0xffff; 0008 6801 SETF gbl_myInt 000A 6802 SETF gbl_myInt+D'1' myFlag = (myInt & 0x0100); 000C 0E00 MOVLW 0x00 000E 1401 ANDWF gbl_myInt, W 0010 6E04 MOVWF CompTempVar586 0012 9003 BCF gbl_myFlag,0 0014 5004 MOVF CompTempVar586, W 0016 A4D8 BTFSS STATUS,Z 0018 8003 BSF gbl_myFlag,0 } It doesn't know "myInt" is an int. SB 7.01, PIC18F4580, XP Pro SP3 Cheers Reynard
  23. Hi Pavel, Since we are on the subject if Access Violation, here is another piece of code which generates one. "0x0047032D, read from 0x0000050" #include <system.h> typedef unsigned char BYTE; typedef unsigned int WORD; typedef union { WORD Val; BYTE v[2]; } WORD_VAL; void main() { WORD ChunkLen; myDWord.Val = 0; if(((WORD_VAL*)&ChunkLen)->bits.b0) { ChunkLen++; } } SB 7.01, PIC18F4580, XP Pro SP3. It is not SB code, but, like Andrew I am doing a MChip C18 port. Cheers Reynard ps. ignore the myDWord.Val = 0; bit of code.
  24. Hi Andrew, No warnings for me using PIC18F4580. void main() { char p; p = XXP.k->kw[0]; //Warning here 05CE 5020 MOVF gbl_XXP+D'1', W 05D0 6EEA MOVWF FSR0H 05D2 501F MOVF gbl_XXP, W 05D4 6EE9 MOVWF FSR0L 05D6 50EF MOVF INDF0, W 05D8 6E25 MOVWF main_1_p Cheers Reynard I spoke too soon. Turn on All Warnings and you get the warning. Doh!
  25. Hi Paul, Provided the memory addresses are consecutive and the 16 bit register is little endian, you can try redifining the timer. volatile unsigned int tmr1_16 @ TMR1L; tmr1_16 = 0x1234; I use this method for 16 bit baud generator registers etc. Cheers Reynard
×
×
  • Create New...