Jump to content

andydavy

EstablishedMember
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

0 Neutral

About andydavy

  • Rank
    Newbrie
  1. Your "main" program must always loop, otherwise the PIC program counter will run past the bounds of the main program and execute code that is in the next program location. The reason for the stack overflow is probably due to hitting an instruction that pushes something and the stack and since it is only 8 entries deep it wouldn't take long to fill it up, since your program is running away out of control.
  2. The following will not compile:- 21 #pragma DATA 0x2007, _INTRC_OSC_NOCLK and will produce the following error:- Compiling... "C:\Program Files\SourceBoost\boostc.pic16.exe" -t PIC16F676 s2kdashir.c BoostC Optimizing C Compiler Version 1.6 Alpha (for PIC16 architecture) http://www.picant.com/c2c/c.html Copyright(C) 2004 Pavel Baranov Copyright(C) 2004 David Hobday s2kdashir.c(21): warning: unknown or invalid pragma (ignored) success Done Ok...so far great problem detected. Now try the following:- #pragma DATA 0x2007, _CP_OFF & _INTRC_OSC_NOCLK The error you get this time is lsightly different:- BoostC Optimizing C Compiler Version 1.6 Alpha (for PIC16 architecture) http://www.picant.com/c2c/c.html Copyright(C) 2004 Pavel Baranov Copyright(C) 2004 David Hobday s2kdashir.c(21): error: failure failure Exit code was 1. Removing target: s2kdashir.obj Failed to locate output file 's2kdashir.obj' Done Failed Not such a great message . Ignoring the difference in the compiler error message, the real problem is due to the supplied include files. The incorrect include file looked like this:- #define _EC_OSC 0x3FFB #define _INTRC_OSC_NOCLK0x3FFC #define _INTRC_OSC_CLKOU0x3FFD #define _EXTRC_OSC_NOCLK0x3FFE #define _EXTRC_OSC_CLKOU0x3FFF The problem is there is a missing space between the define name and the hex value, which only seems to occur to define names that are long. To solve the problem put a space between the name and the value. For Example #define _INTRC_OSC_NOCLK 0x3FFC Hope this helps someone. Also, you will notice that in the first example it doesn't fail to compile and the pragma is ignored. If you run a build the warning disappears of the top of the report box and therefore you dont see it, unless you are in the habit of scrolling back and checking every message. I think that this warning should be an error as well and stop the build.
  3. Okay thanks that explains it!!! Because I was using C2Cplus and moved to BoostC then the __config line is no longer valid as it was for MPASM. Therefore I have to replace it with a PRAGMA statement..is that detailed anywhere For those like me who are not sure how to write the pragma line for the config here it is below:- #pragma DATA 0x2007, _CP_OFF & _WDT_OFF & _BODEN & _PWRTE_ON & _INTRC_OSC_NOCLK & _MCLRE_OFF & _CPD_OFF Alternative method is:- #pragma DATA 0x2007, 0x3FFF & 0x3FFF & 0x3FFF & 0x3FDF & 0x3FEF & 0x3FF7 & 0x3FFC PS: Also look for my bug report on PRAGMAs and incorrect .inc (include) files if you are getting errors with using defines in the PRAGMA line.
  4. Hi, Having problems with the following assembler code and I can't see what the problem is with the "call" line 108, can anyone help 105 asm //Load Factory Calibration Value Into OSCCAL 106 { 107 bsf _status,RP0 108 call 3ffh 109 movwf _osccal 110 bcf _status,RP0 111 }
  5. I have the following asm code and can't work out what the problem is asm //Load Factory Calibration Value Into OSCCAL { __config _CP_OFF & _WDT_OFF & _BODEN & _PWRTE_ON & _INTRC_OSC_NOCLK & _MCLRE_OFF & _CPD_OFF bsf _status, RP0 //;Bank 1 call 0x3FF //;Get the cal value movwf _osccal //;Calibrate bcf _status, RP0 //;Bank 0 } The errors that I get are BoostC Optimizing C Compiler Version 1.5 Alpha (for PIC16 architecture) http://www.picant.com/c2c/c.html Copyright(C) 2004 Pavel Baranov Copyright(C) 2004 David Hobday s2kdashir.c(21): error: error in built-in assembly s2kdashir.c(25): error: error in built-in assembly failure Exit code was 1. Removing target: s2kdashir.obj Failed to locate output file 's2kdashir.obj' Done Failed line 21 is the line starting __config....... and line 25 is the line bcf _status, RP0 . Any ideas on the problem, if it is a bug is there a work around especially for the __config line. Many Thanks Andy
  6. Dave, Thanks for clearing that up I though I was going mad, but when can we expect it to be added. Also, is there a function list for the debugger that indicates what is supported and what is not. This would save me alot of time trying to work out why something doesn't work. Also, on the point of functionality does the ADC work on AN0 (RA0) for the 16F676. I notice a mention in the manual that the ADC had to be on port A and similar to 16F877 and compatible types, so is the 16F676 compatible? Andy
  7. IDE version: SourceBoost IDE version 5.6.1 Compiler: BoostC Compiler version: 5.6.1e Target device: PIC16F676 OS: WinXP While debugging the interrupt on change bit does not get set, although I see the port a. ra0 status bit change. I have verified that I have configured the device correctly as it all works within MPLAB IDE simulator without any problems. Can you verify that this occurs. If you require any source code then let me know. Andy
  8. I would be happy to use BoostC, but I was compiling for the 12F675 which I don't beleive is supported by BoostC. The 12F675 is the same as 12F629 but with 4 channel analogue input. Is there a way to get BoostC to compile for the 12F675?? Also, which is the better compiler C2Cplus or BoostC? Thanks Andy
  9. IDE version: SourceBoost IDE version 5.6.1 Compiler: C2C-plus Compiler version: 5.6.1e Target device: PIC12F675 OS: WinXP ********* 1st problem ************** char state; . . ledregisterbuffer >>= state; Error output:- default.c(237): Error: The second operand in shift expression must be a number Comment:- Why is it not possible to use a variable? It should work!!! To get around this I used a switch statement as follows (not ideal):- switch (state) { case 0: ledregisterbuffer >>=0; break; case 1: ledregisterbuffer >>=1; . . .etc. Although this compiles the assembler code produced for the ledregisterbuffer >>=0; line actually just clears ledregisterbuffer. (ie a right shift clears variable) Assembler Below:- ;;;;;;;; switch (state) movf _state, W movwf _intr_tmp_0000 ;;;;;;;; { ;;;;;;;; case 0: movf _intr_tmp_0000 , W sublw D'0' btfss STATUS, Z goto label_0027 ;;;;;;;; ledregisterbuffer >>=0; label_0028 andlw D'255' movwf _ledregisterbuffer ;;;;;;;; break; goto label_0026 ;;;;;;;; case 1: label_0027 movf _intr_tmp_0000 , W sublw D'1' btfss STATUS, Z goto label_0029 break;
×
×
  • Create New...