Jump to content

Mike Schafer

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Mike Schafer

  • Rank
  1. No big deal, but I thought you'd like to see this. Also having problems in 6.40 with the programmer not firing up even though checked in build options. Mike Environment: Windows XP BoostC Compiler and IDE V6.40 Target 18F4620 The |= construction in the else condition fails. Note that it works in the if condition. Also, the code compiles if the |= is replaced by the non-shorthand construction. Code: #define HOME 0 #define AWAY 0x0F void main(void) { char val; char test; if(test) val |= (HOME << 4); else val |= (AWAY << 4); } Error messages: "C:\Program Files\SourceBoost\boostc.pic18.exe" -t PIC18F4620 bug.c BoostC Optimizing C Compiler Version 6.40 (for PIC18 architecture) http://www.sourceboost.com Copyright© 2004-2006 Pavel Baranov Copyright© 2004-2006 David Hobday bug.c failure C:\Pic software\Maxzig_v3\bug.c(11:21): internal error: failed to generate assignment expression C:\Pic software\Maxzig_v3\bug.c(11:21): error: failed to generate expression C:\Pic software\Maxzig_v3\bug.c(11:11): error: error in the body of 'if' expression Failed to locate output file 'bug.obj' Done Failed
  2. IDE and Compiler version 6.32 Target 16F877 In the code below, with the value of j= 16 in the for loop , the shift a few lines later should be a right shift of zero, leaving the variable vals = 0xFFFF. (unshifted) Actual result for vals is 0x0000. Code: void main(void) { unsigned short val = 0xffff; unsigned short vals; signed char j; LCD_init(); //initialize LCD display while(1) //loop forever { for(j = 0; j <= 16; ++j) { LCD_clear(); LCD_setpos(0,0); vals = val >> (16 - j); LCD_dec(j); LCD_char(':'); LCD_bin(vals); delay_s(2); // Delay again 2 seconds } } // end of while } // end of main Regards, Mike
  3. Dave, Thanks. I missed the lsb = 0 when looking at the data sheet. Also, I have upgraded to 2.2.2 but haven't had time to exercize the arrays in structures part. Regards, Mike
  4. 18F4620 device Version 2.2 beta of compiler and linker A couple of minor things: tosl isn't declared in the 18F4620 header file. PCLATH and PCLATU don't seem to change in the debugger Finally, I'm having trouble reading the list file and need to understand how the addresses are defined (some strange problem with arrays or structures I have yet to be able to pin down) The following section are from the list file: ORG 0x00003382 3382 _startup 3382 6A3E CLRF gbl_num_nbrs 3384 0ED5 MOVLW 0xD5 3386 6E49 MOVWF gbl_9_LSR 3388 0EC4 MOVLW 0xC4 338A 6E4A MOVWF gbl_9_LSR+D'1' 338C 0EBB MOVLW 0xBB 338E 6E4B MOVWF gbl_9_LSR+D'2' 3390 0EDC MOVLW 0xDC 3392 6E4C MOVWF gbl_9_LSR+D'3' 3394 EF4EF011 GOTO main and main is at: ORG 0x0000229C 229C main ; { main ; function begin 229C 0E0B MOVLW 0x0B 229E 6E4F MOVWF main_1_CHANNEL 22A0 6A50 CLRF main_1_j I'd like to know how to translate the address in the GOTO assembly statement which I read as 0x0114E into the main address of 0x229C Thanks Regards, Mike
  5. Sleep function inserts a no-op in the assembly code rather than 0003 op code #include <system.h> void main(void) { while(1) { sleep(); } } Gives: 0004 main ; { main ; function begin 0004 label268435976 0004 0000 SLEEP 0006 EF02F000 GOTO label268435976 ; } main function end Sleep should be 0003. Same happens if you use asm sleep Inserting data to make the sleep op code is a work around: asm data 0,3 IDE 5.9.5 BoostC 2.2 beta 18F4620 Window OS Regards, Mike
  6. That was fast! Thanks. Regards, Mike
  7. boostC compiler and linker 2.0.1 beta (for PIC 18) Using sample randtest.c code with the rand.pic.18 library. rand function returns the same value each time. The pic.16 version works fine, it appears. Sample code provided with the distribution produce 0xA5A5 every time rand is called in the sample program (seed unchanged and is initialized to 0x1234) Changing the seed produces a different result from the call to rand, but it is still the same each time rand is called. Regards, Mike
  8. IDE version 5.9.1 Compiler and Linker versions 2.0.1 Beta Boost C compiler Target is PIC16F877 The following code compiles but linker fails (no specific failure mentioned) #include <system.h> void main(void) { unsigned short speed=10, dist=20; unsigned short temp; temp = speed*dist/2; } Changing the calculation: temp = speed*dist/2; to: temp = dist*speed; temp = temp/2; // works in linker works Mike
  9. PLease send the project exhibiting the fault support@picant.com. Anything you do to reduce the complexity of the project would help. Regards Dave <{POST_SNAPBACK}> Dave, Problem went away with the new release. Thanks. Regards, Mike
  10. Dave, I will wait to the new version. I am having a very strange problem with the linker, and I haven't been able to isolate it to where I can post it here. The code complies, but the linker fails with an unable to resolve lable message. If I remove a header file with some function prototypes in it (none of which are callled), it llinks successfully. If I leave the header in, and change the type of variables in the main program from short to unsigned short, it links. If I remove a line that says val = a << b; (all declared as short), it links. I haven't been able to reduce it to a minimal set of lines that links under one set of conditions, and not under others. If you would like, I can e-mail you the files so you can take a look at it. Regards, Mike
  11. Its time that you upgraded to the latest beta release. Its available for free. Regards Dave <{POST_SNAPBACK}> Dave I'm running IDE version 5.8 and BoostC Optimizing C Complier Version 1.9.3 Beta (for PIC18 architecture) so I thought I had the latest version. Mike
  12. Yes this is a bug. Now fixed. Fix will be available in the next release. Did you forget to mention that there also was #include <system.h> in this code? This code compiles fine but if you use system.h compilation fails because C is defined in system header as a constant and constants can't be used as l-values. Regards, Pavel <{POST_SNAPBACK}> Pavel, My bad. Should have looked more closely at the include file. That is exactly it. I'm starting to get a message saying the alpha release expirese in 5 days. We hava a C2C academic license that I use in a course that I am teaching. This year we switched to BoostC. Is our ability to use it going to expire before I can upgrade or purchase an academic license to BoostC? Mike
  13. I have students using BoostC and they manage to make some interesting errors. This one seems strange to me. (We are using l1.9.3 beta target 16F877) Student wrote: void main(void) { char k; k = 0; ~k; } instead of void main(void) { char k; k = 0; k = ~k; } Both compile fine, but only the second one links. Looking at the assembly, the former with the error just stops generating code at the ~k; line. I'm not sure if this is a bug or not. Another issue is with the used of capital C as a variable. The following doesn't compile (says missing semicolon at the void main(void) line.) Changing the variable name solves the problem. What is special about C as a variable name, and are there others like it? void main(void) { char C; C = 0; } Best Regards, Mike
  14. Thank you. Solved the problem. Mike
  15. PIC18F4620 is the target. 1.7 Alpha release. The following code compiles but gives a linker error. #include <system.h> void main(void) { short temp2; short temp3; short temp4; temp2 = 4; temp3 = 5; temp4 = temp2 * temp3; } Linker says: Var not found id:0xFF000004 Failed Exit code was -1. [No error] What am I missing? Thanks.
  • Create New...