Jump to content

robcarter

EstablishedMember
  • Content Count

    16
  • Joined

  • Last visited

Community Reputation

0 Neutral

About robcarter

  • Rank
    Newbrie
  • Birthday 07/10/1963

Contact Methods

  • Website URL
    http://www.karterelectronic.com
  • ICQ
    0

Profile Information

  • Gender
    Male
  1. I have the same problem, so I removed sb from mplabx then tried to reinstall, mplab now says C:\Program Files\Sourceboost does not contain a toolchain. I restarted mplabx and i was able to add the toolchain, but when I try to build the project mplab tells me the toolchain doesn't exist.
  2. i theory they don't need to be together, but I wanted to implement the shifting in assembler because the 36 shifts (I don't need all 40 bits) are output serially on an interupt and didn't want the extra overhead of bank switching code being inserted. I think the best way is probably to assign fixed addresses at 0x7? so they an be accessed from any bank.
  3. Thanks, if I use a structure can i access it from assembly for example using: movf _structure_name.element_name,w
  4. Hi In an application i have to implement a 40 bit shift register, does anyone know if i define 5 char variables will they always be placed in consecutive memory locations? e.g using volatile unsigned char data1,data2,data3,data4,data5; or using volatile unsigned long date1; volatile unsigned char data2; I am using volatile because they are accessed from an interrupt. or would an array be better? thanks
  5. Thanks, that's more or less what i ended up doing: I added the following to the microchip bootloader (set to load at 0x0) Then I added this to my code: and set the compiled code to start at 0x200 using -rb 0x200. I put the jump to the end of the int entry to avoid any problems with pclath. I haven't tested this fully yet but it appears to work ok.
  6. I have compiled the microchip bootloader AN1310 and set it to locate at address 0, with the application program moved to 0x200 using the linker -rb option. everytrhing works fine until the interrupts are enabled. The problem I have is that the microchip interrupt routine saves pclath before resetting it to 0 and then jumping to 0x204, this in itself is not a problem until an interrupt occurs when the pc is in the high area of memory at this point the return from interrupt address will be wrong as the source boost compiler will have stored the wrong pclath value in its int routine. I can't put a straight goto 0x200 at 0x4 as again pclath could have bits set so the routine wouldn't jump to the correct interrupt. Is there a way of stopping the compiler generating the interrupt context saving code so i can write my own, or are the symbols used for context saving the same each time so I can access them wth some asm code, swap the correct pclath value over and then exit the interrupt with the correct pclath value. btw i'm using pic 16F887
  7. Hi Not sure if this has been asked before but is there any way to insert the compile date and / or time into the source code. for example could you have a predefined string such as SYS_DATE or SYS_TIME which could be inserted into a .c file. It would be a nice feature.
  8. Hi thanks, I hadn't thought about adding in the extra check, I presumed that the expression cc = c[ i ] would return false when the \0 at the end of the string was encountered, but as you say it appears that the compiler doesn't always check for zero, which was what seemed to be happening with V7.2 Regards Rob
  9. An upgrade to 7.22 seems to of sorted the problem, thanks
  10. Hi I am trying to print a rom string to the serial port, the strings are defined thus: rom char *test_txt = "\n\rMatrix Controller Test mode\n\r"; rom char *txt1 = "Connect an 80R 10W resistor across pins 11 and 19\n\r"; rom char *txt2 = "Press Enter when ready\n\r"; i use the following call: puts (test_txt); where puts() is: void puts(rom char* c) { char cc; char i; for( i = 0; cc = c[ i ]; i++ ) putc( cc ); } void putc(char c) { txsta.TXEN = 1; txreg = c; while (txsta.TRMT == 0) clear_wdt(); } But all of the strings are printed one after the other and then looping to the start again until the 255 char limit is reached, it appears that the routine isn't detecting the end of string \0 - i also tried putting a \0 at the end os each string, I have checked the prog mem and each rom strings ends in a retlw 0 Can anyone tell me what I'm doing wrong, i'm using a pic16F887 processor, the above code works fine on a pic 18F25 series chip btw im using v7.20, mplab 8.92, win 7 regards rob carter
  11. Hi I have a pic project (16F876A) where the part can wake up from sleep, caused by wdt. Does anyone know the best way to code this in c, as sourceboost inserts some code before main starts, such as table lookups etc Ideally the status register test needs to be the first thing at reset. thanks rob
  12. Hi I have a pic project (16F876A) where the part can wake up from sleep, caused by wdt. Does anyone know the best way to code this in c, as sourceboost inserts some code before main starts, such as table lookups etc Ideally the status register test needs to be the first thing at reset. thanks rob
  13. hi thanks, I hadn't spotted those macro's one other question, if you can help, is there a way to see what has been removed by the optimizer at compile /link time? rob
  14. Hi I have the following function compiled for a pic18F6520: UINT16_T AdcMicrophoneConvert(VOID_T) { UINT16_T ret; // we can assume that the AD is already set to microphone channel.. // and has completed a conversion ret = adresh << 8; ret += adresl; ad_go_done = 1; // start the next conversion. return ret; } it compiles: AdcMicroph_0001D { AdcMicrophoneConvert ; function begin MOVLB 0x03 CLRF CompTempVar490, 1 MOVF gbl_adresh, W MOVWF CompTempVar491, 1 MOVF CompTempVar490, W, 1 MOVWF AdcMicroph_0001D_1_ret, 1 MOVF CompTempVar491, W, 1 MOVWF AdcMicroph_0001D_1_ret+D'1', 1 MOVF gbl_adresl, W ADDWF AdcMicroph_0001D_1_ret, F, 1 BTFSC STATUS,C INCF AdcMicroph_0001D_1_ret+D'1', F, 1 BSF gbl_ad_go_done,1 MOVF AdcMicroph_0001D_1_ret, W, 1 MOVWF CompTempVarRet489, 1 MOVF AdcMicroph_0001D_1_ret+D'1', W, 1 MOVWF CompTempVarRet489+D'1', 1 RETURN } AdcMicrophoneConvert function end shouldn't the optimzer just reduce this to five lines of code, i.e. read two registers and store then set the start convert bit. I tried changing the ret += adresl to ret = adresl but thids actually increases the code space. is there a reason why this is happening? regards rob carter
  15. Hi don't know if this is a sourceboost problem or mplab, maybe someone can advise? I have declared a structure thus: typedef struct{ unsigned int usage12; .... unsigned int opvolts12; unsigned char model_no [12]; unsigned char del_no[8]; unsigned char serial_no[6]; unsigned int acctime_12V; unsigned int acctime_24V; unsigned int chg_time; unsigned int checksum; }CONFIG_T; and in main.c: CONFIG_T config; the code compiles ok and runs, but if i add the config variable to the watch is shows the structure but not the arrays within the structure, they are shown as a char, however the address within the structure is correct (see picture) Can anyone advise if I am doing something wrong or is it mplab maybe thanks in advance rob carter
×
×
  • Create New...