Jump to content


  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Mac

  • Rank

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Location
    Michigan, USA

Recent Profile Visitors

555 profile views
  1. Is there a way to duplicate an assembly language macro that I use to store constant strings inline with my code? The putstr() function pulls the return address (the string address in this case) from top-of-stack, sends the string while updating TOS, and returns to the instruction immediately following the inline string. Here's the assembly language version I'm trying to duplicate; putstrg macro string ; in-line rom string call putstr ; inline string print function dt string,0 ; inline string endm ; Here's the inline print string function... /******************************************************************** * * ********************************************************************/ void putstr() // in-line strings (14 words) { strloop: // bank 31 (inserted by compiler) |31 asm movf _tosl,W // copy return address to FSR1 |31 asm movwf _fsr1l // " |31 asm movf _tosh,W // " |31 asm movwf _fsr1h // " |31 asm bsf _fsr1h,7 // set b7 for access to flash |31 asm incf _tosl,F // bump return/string address |31 asm btfsc _status,Z // " |31 asm incf _tosh,F // " |31 asm movf _indf1,W // end-of-string (0x00)? |31 asm btfsc _status,Z // no, skip (send char), else |31 asm return // exit (end-of-string) |31 asm call putwreg() // data passed in wreg |31 asm bra strloop // |31 } Thank you all for your time and kind consideration. Cheerful regards, Mike, K8LH
  2. Unlimited number of constant offsets with + and - operations can be used in assembly operands. What kind of expressions are you looking for? Regards, Pavel Hi Pavel, Hoping for reasonable operand expression evaluation that you would expect from any decent assembler implementation; Cheerful regards, Mike #define tStep 2 // 1-usec (2 cycle) tStep time .... asm { movlw 2*tStep-2 // 2T minus 2 cycles .... movlw 50/4 // 50 cycles/4 cycle loop time }
  3. We still need to compile all the changes. From the top of my head here are some: Support for multiple projects in a workspace Much better debugger (it can evaluate much more complex expression) Support for multiple plugin instances (minimal changes to plugin API) Optional parallel compilation Build server Optional support for big arrays and data objects(bigger that 256 bytes) Support for bit and bool return types Support for PIC16F1x architecture and instruction set Code generation and compile time are mostly unchanged. We work on a new compiler core that will change those. Regards, Pavel Have assembler capabilities been improved (operand expression evaluation) or are they still crippled?
  4. Could you use something like this? char fraction() { fract &= 15; fract *= 10; return(fract>>4|"0"); } whole = reading >> 7; fract = (reading >> 3) & 0xF; if (!positive) { serial_printf('-'); } else { serial_printf('+'); } serial_print_dec(whole); serial_printf('.'); puts(fraction()); // "0625", "1250", etc... puts(fraction()); puts(fraction()); puts(fraction());
  5. Using MPLAB v8.5 IDE and BoostC v6.97 and when I add an instruction using the modulo '%' operator I get the following error; Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)' Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)' Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)' Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)' Error: Unresolved external function:'__rem_8_8(unsigned char,unsigned char)' Error: Unresolved external symbol, function:__rem_8_8 What other file should I "include" besides "system.h" at the top of my source file, please? TIA, Mike
  6. Hi David, Your method worked and so I went back and tried again using MPLAB "project wizard" and that worked as well. Thank you for your time and kind consideration. Kind regards, Mike McLaren, K8LH
  7. Hi edeca, Your article is very nice. Only complaint is your program listing with gray text on black background is very difficult to see. I posted a PIC SPBRG Calculator program many years ago on Forum.Microchip that you might find handy for evaluating which BRGH and BRG16 settings produce the best bit rate error; Revised SPBRG Calculator. Kind regards, Mike, K8LH
  8. Using MPLAB 8.50 IDE with BoostC 6.97 (free/lite) and getting the following errors trying to compile a simple program for 16F1936; // // compiler evaluation for "enhanced" mid-range 16F1936 // #include <system.h> #pragma DATA _CONFIG1, _FOSC_INTOSC&_WDTE_OFF&_IESO_OFF&_FCMEN_OFF #pragma DATA _CONFIG2, _PLLEN_OFF&_LVP_OFF #pragma CLOCK_FREQ 16000000 void main() { osccon = 0b01111010; // 16-MHz INTOSC while(1) { // } } MPLAB generates the following dialog; "Failed to load C:\Development\PIC Projects - Boost C\16F1936 test.COF." And here's what I get in the MPLAB "output" window "build" tab; Clean: Deleting intermediary and output files. Clean: Deleted file "C:\Development\PIC Projects - Boost C\16F1936 test.HEX". Clean: Deleted file "C:\Development\PIC Projects - Boost C\16F1936 test.mcs". Clean: Done. Executing: "C:\Program Files\SourceBoost\boostlink_pic.exe" -O1 -v -p "16F1936 test" -t 16F1936 BoostLink Optimizing Linker Version 6.97 http://www.sourceboost.com Copyright(C) 2004-2010 Pavel Baranov Copyright(C) 2004-2010 David Hobday Optimisation level:1 Internal Error: Data Type not found id:0xF0000001: failure BUILD SUCCEEDED: Fri Apr 23 08:27:29 2010 Another 12F683 project compiles fine. What am I doin' wrong? TIA, Regards, Mike
  9. Gentlemen, is there a way to duplicate the function of this cycle accurate fixed delay assembler macro in BoostC, please? ; ; in-line fixed delay macro, 0..1027 cycles, 14 bit core ; clock equ 8; 8-MHz usecs equ clock/2; cycles/usec multiplier tStep equ 1*usecs; 1T "step" time inDlyCy macro delay; generates 0 to 7 instructions local loop if delay > 3 movlw delay/4-1; loop addlw -1; borrow? (4 cycle loop) bc loop; no, branch, else, fall thru' endif if delay%4 >= 2 goto $+1; delay%4 == 2 or delay%4 == 3 endif if delay%4 & 1 nop; delay%4 == 1 or delay%4 == 3 endif endm Here's how I would like to use it in BoostC (below)... asm { bsf STATUS,RP0; bank 1 |B1 movf bdat+0,W; TRISIO = bdat[0]; |B1 movwf TRISIO; |B1 inDlyCy(1*tStep-2); delay 1T minus 2 cycles |B1 movf bdat+1,W; TRISIO = bdat[1]; |B1 movwf TRISIO; |B1 inDlyCy(2*tStep-2); delay 2T minus 2 cycles |B1 bcf STATUS,RP0; bank 0 |B0 } I would just code in the assmebler delays by hand but the the assember is crippled, that is, the compiler doesn't evaluate assembler expressions such as the expression in this assembler operand; movlw (32*tStep-2)/4-1. Thank you in advance for your time and kind consideration. Regards, Mike
  10. I tried to use LOW(0x1000) and HIGH(0x1000) or 4096%256 and 4096/256 assmebler operands after locating my rom character table at 0x1000 in Flash using #pragma DATA directives and still "go joy". It seems that instead of building a good compiler around a full featured assembler that the assembler was more of an after thought. The assembler lacks any operand expression evaluation, won't use the LOW() and HIGH() operators for example, doesn't allow access to address of labels, and the list goes on... By comparison the assembler in Swordfish BASIC is a good example of what the assembler in a HLL should be able to do. Too bad it's BASIC (LOL)...
  11. Just wondering if I've run into another assembler shortcoming? Is there any way to use the address of a const rom char "table" in my assembly code? typedef unsigned char u08; // 8-bit #define r08 const rom unsigned char // // rom character array // r08 font[] = { 0b01110000, // "0" 0b10001000, // 0b10011000, // 0b10101000, // 0b11001000, // 0b10001000, // 0b01110000, // 0b00100000, // "1" 0b01100000, // 0b00100000, // 0b00100000, // 0b00100000, // 0b00100000, // 0b01110000 }; // //--< functions >---------------------------------------------------- void getromchar(u08 charval) // 31 words, 43 cycles { asm // { movlw 7 // tblptr = @romchar + charval * 7 mulwf _charval // movlw 46 // low(_font) <--------------------- ??? addwf _prodl,W // movwf _tblptrl // movlw 0 // high(_font) <--------------------- ??? addwfc _prodh,W // movwf _tblptrh // clrf _tblptru // tblrd*+ // movff _tablat,_display+7 // display[7] = romchar[charval*7+0] tblrd*+ // movff _tablat,_display+15 // display[15] = romchar[charval*7+1] tblrd*+ // movff _tablat,_display+23 // display[23] = romchar[charval*7+2] tblrd*+ // movff _tablat,_display+31 // display[31] = romchar[charval*7+3] tblrd*+ // movff _tablat,_display+39 // display[39] = romchar[charval*7+4] tblrd*+ // movff _tablat,_display+47 // display[47] = romchar[charval*7+5] tblrd*+ // movff _tablat,_display+55 // display[55] = romchar[charval*7+6] } }
  12. Piece of cake: volatile unsigned short ccpr1 @ 0xFBE; ccpr1 = 2400; Regards, Pavel Ah, thank you...
  13. I'm just looking for the same capability that I get with MCC18. Being able to access register pairs as CCPR1, CCPR2, INDF0, and FSR0 seems very clean and intuitive (to me). Kind regards, Mike
  14. Thank you Pavel. Have a great day.
  15. I see a definition for 'ccpr1' in the '2620 header file but I can't seem to use it as a 16-bit 'INT'. What am I doin' wrong Gentlemen? unsigned int match = 2400; ..... ccpr1 = match; // <-- error match <<= 1; //