Jump to content

DTPIC

EstablishedMember
  • Content Count

    32
  • Joined

  • Last visited

Everything posted by DTPIC

  1. Emte, thanks for the response. The code is now working - I just put this up because I thought it might help others with the same problem, and to inform the developers. According to the documentation, BoostC allows rom char * arrays of a maximum of 256 bytes - I would hope that any compiler that allows an array of that size would allow me to access the last byte of the array! (this seems to be true, as borne out by more recent code...). I am constructing a piece of test equipment, where each test takes 8 parameters, and there may be up to 40-50 tests - this could require arrays greater than 256 bytes. The array \ table goes into program memory space because of the "rom" keyword, and is packed 2 bytes to each program word - the compiler accesses the arrays using the TABLAT, etc assembly instructions (its an 18F target...) - it is a very efficient way of storing this amount of non-varying data. Besides, the user EEPROM space is in use for 'other things'...!
  2. I am using BoostC 6.60.... There seems to be a limit on the number of parameters I can OR together in one entry of a rom table initialisation, which is also possibly dependent on the paramter names and values... Let's define some constant parameters: #define PARAM_1 1 #define PARAM_2 2 ...... #define PARAM_7 7 The compiler seems ok with #define RESULT PARAM_1 | PARAM_2 | PARAM_3 | ....PARAM_7 or even char result: result = PARAM_1 | PARAM_2 | PARAM_3 | ....PARAM_7; I can initialise some rom char* array elements with rom char* test_array = { PARAM_1, PARAM_2, 1, 2, 3 etc But I cant init a single element with rom char* test_array = { PARAM_1 PARAM_2 | PARAM_3 | PARAM_4 , 1, 2, 3, etc Worse still, it seems to be dependent on the name or value of the parameters used: #define TONE_CHECK_IDLE 0x00 #define RX_IDD_MEAS_OFF 0x00 #define RX_IDLE_SEL 0x00 #define XXX1_2_LOAD_OFF 0x00 #define XXX3_4_LOAD_OFF 0x00 rom char* test_array = { TONE_CHECK_IDLE | RX_IDD_MEAS_OFF | RX_IDLE_SEL | XXX_4_LOAD_OFF, 1, 2, works, while rom char* test_array = { TONE_CHECK_IDLE | RX_IDD_MEAS_OFF | RX_IDLE_SEL | XXX3_4_LOAD_OFF | XX1_2_LOAD_OFF, 1, 2, doesnt work! There seems to be a limit on the number of parameters I can OR together in one entry of a rom table initialisation, which is dependent on the paramter names and values... I really wanted to adopt the PARAM1 | PARAM2| PARAM3 style of notation as it is self-documenting.... Any ideas or workarounds?
  3. Hi, just thought I'd let you know about this 'feature'... If I write: rom char* myarray1[256] = { 0,1,2,3,4,5,6,7 }; and then for (i=0;i<4;i++) {lprintf("%d ", myarray);} I get 1 3 5 7 However, if I use rom char myarray1 = { 0,1,2,3,4,5,6,7 }; I get 0 1 2 3 Apparently the compiler treats the array differently if I try to bound it with . I know that 'according to the manual', a rom char* array strictly shouldn't have a size in its definition, but the compiler accepts it, and produces an unusual result - if the compiler were to throw out a rom char* array definition with a size, it might save a few cross words...! It would also be useful if there was a way to produce a rom char array larger than 256 bytes without having to define an access function to select between several 256 byte sub-arrays...
  4. ...yes, it has a 'resource leak' kind of feel - the more you switch between the two (and thereby re-assign resources), the more likely it is to cause problems. It also helps to minimise one app before maximising the other... I guess I need to start by changing my copy of Acro reader - just thought I'd bring it up in case others were seeing the same problem. Thanks for your input!
  5. Hi, something I have noticed on IDE vers 5 and 6 is that if I open Acrobat reader at the same time, I get strange interactions between the two; sometimes the file tabs and border around the IDE editor window disappear, leaving Acrobat Reader showing through; sometimes the IDE and Acro will not minimise \ maximise properly; sometimes the IDE and \ or Acro will lock up, requiring restart of the applications, or the whole machine; and sometimes when the IDE has crashed, it re-runs with the message " a requested resource was not available",and the IDE window doesn't appear (but the IDE process shows up in process manager). The version of Acro Reader I am using is V5 on Win98 (quite old stuff, I guess...) - I suppose I should upgrade and see if it goes away.... This is at worst "a bit annoying" for me, but I thought I'd bring it up as I am also having the problem with the new V6 IDE - has anybody else had similar problems?
  6. Hi, I have previously created a 16F asm{} block in C2C to 'bit bang' RS232 to a pin which I have been using for some time now (I am already using the UART for something else!) - but I find that I cannot port the asm to 18F in BoostC witout errors... Here is the (working) C2C code: ******************************************* void send_dbg_char(char c) { // executes in 9 cycles per bit - // at 4MHz, runs at 111.1kb/s (112.5kb/s - 1.2%) // unsigned char i = 8; unsigned char t; asm{ startbit: bcf DBGPORT, TX ; set line to space nop nop nop nop nop ; for other rates, insert nops here ifdef RS232CLK20 ;3(n-1)+ 5 cycles - decfsz adds one cycle when result of dec = 0 movlw 0x0B movwf _t_send_dbg_char sdc_startbit_delay: decfsz _t_send_dbg_char,f goto sdc_startbit_delay nop endif databit: btfsc param00_send_dbg_char, 0 ; test data bit 0 goto bit_is_1 rrf param00_send_dbg_char, f ; rotate data - only done if data bit is 0 bit_is_0: bcf DBGPORT, TX ; set line to space goto nextbit bit_is_1: bsf DBGPORT, TX ; set line to mark rrf param00_send_dbg_char, f ; rotate data - only done if data bit is 1 nop ; balances GOTO timing nextbit: ; for other rates, insert nops here ifdef RS232CLK20 ;3n+3 cycles movlw 0x0B movwf _t_send_dbg_char sdc_databit_delay: decfsz _t_send_dbg_char,f goto sdc_databit_delay nop endif decfsz _i_send_dbg_char,f ; check if end of loop goto databit goto stopbit stopbit: nop nop bsf DBGPORT, TX ; set line to mark nop nop nop nop nop nop nop nop ; for other rates, insert nops here ifdef RS232CLK20 ;3n+3 cycles movlw 0x0B movwf _t_send_dbg_char sdc_stopbit_delay: decfsz _t_send_dbg_char,f goto sdc_stopbit_delay nop endif mark_stop_end: } } ******************************************* .... and here is the BoostC port: ******************************************* #include <pic18F452.h> // for port, reg name defs #include "hardware.h" // contains defs for DBGPORT, TXPIN void send_dbg_char(char c) { // executes in 9 cycles per bit - // at 4MHz, runs at 111.1kb/s (112.5kb/s - 1.2%) // unsigned char i = 8; unsigned char t; asm{ startbit: bcf DBGPORT, TXPIN, 0 // set line to space nop nop nop nop nop // for other rates, insert nops here #ifdef RS232CLK20 //3(n-1)+ 5 cycles - decfsz adds one cycle when result of dec = 0 movlw 0x0B movwf _t startbit_delay: decfsz _t, f bra startbit_delay nop #endif databit: btfsc _c, 0 // test data bit 0 bra databit_is_one rrncf _c, 1, 0 // rotate data - only done if bit is zero databit_is_zero: bcf DBGPORT, TXPIN // set line to space bra nextbit databit_is_one: rrncf _c, 1, 0 // rotate data - only done if bit is 1 bsf DBGPORT, TXPIN, 0 // set line to mark nop // balances GOTO(BRA) timing nextbit: // for other rates, insert nops here #ifdef RS232CLK20 //3n+3 cycles movlw 0x0B movwf _t sdc_databit_delay: decfsz _t,f bra sdc_databit_delay nop #endif decfsz _i,f // check if end of loop bra databit bra stopbit stopbit: nop nop bsf DBGPORT, TXPIN, 0 // set line to mark nop nop nop nop nop nop nop nop // for other rates, insert nops here #ifdef RS232CLK20 //3n+3 cycles movlw 0x0B movwf _t sdc_stopbit_delay: decfsz _t,f goto sdc_stopbit_delay nop #endif mark_stop_end: } } ******************************************* BoostC gives the following error: "C:\PROGRAM FILES\SOURCEBOOSTC\boostc.pic18.exe" -t PIC18F452 SCA_DCTJ.c tests.c hardware.c test_table.c "..\..\..\..\..\Sourceboost\My Lib Functions\debug_tx2.c" BoostC Optimizing C Compiler Version 6.55 (for PIC18 architecture) http://www.sourceboost.com Copyright© 2004-2006 Pavel Baranov Copyright© 2004-2006 David Hobday Licensed to <me!> under Single user Pro License for 1 node(s) Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited SCA_DCTJ.c tests.c hardware.c test_table.c ..\..\..\..\..\Sourceboost\My Lib Functions\debug_tx2.c >>>>>>>> *** here it is! *** >>>>>>>>> D:\Sourceboost\My Lib Functions\debug_tx2.c(39): error: error in built-in assembly >>>>>>>> failure Failed to locate output file 'debug_tx2.obj' Done Failed ******************************************* Line 39 is the line with the label "databit_is_zero:".... To achieve the port, I have: changed the function parameter external variable name to _c changed the local variable labels to _label_name changed the goto's to bra's changed the rrf 's to rrncf 's changed the comments from ';' to '//' (the #define var "RS232CLK20" is not defined in the above) Quite a long post, I'm afraid, but any ideas? Thanks!
  7. Hi, <<<<<<<<< Sorry, computer fell over as I posted this - have re-posted >>>>>>>>>
×
×
  • Create New...