Jump to content

seedy1812

EstablishedMember
  • Content Count

    15
  • Joined

  • Last visited

Community Reputation

0 Neutral

About seedy1812

  • Rank
    Newbrie
  1. 1. The middle part of the for statement you have is count=100 , this would cause an infinite loop , not 100% sure what the value in the loop would be. If you had mean to type count==100 then both sides are promoted to the same size. Its not really an error , just the compiler trying to generate the code you asked for. 2. The statement is correct , ans as with the previous point the complier can generate the code you asked for. One way around this is to have the TRUE first TRUE == x , this will trap any mistyping as you cannot assign a value to TRUE. As you are probably aware the value in the brackets for the if is an expression , the code you entered is valid. if you had typed x = FALSE then it would have failed.
  2. #ifdef xxxx checks to see if xxx has been defined else you can do #if defined(xxx)|defined(yyy) The latter one also allows you to do complex if's depedning upon whats defined or not Andrew
  3. I believe that PIR1 is not volatile, so the value in the while() comes out a constant , which will be optimised out.
  4. There is also the wait 100 ms function . What i did was to have a X 100ms and a Y ms wait , two calls which can give you 25755 ms wait , ok i know this is over kill and it will never lt that long , but small is nice
  5. Yes I think you are right - Regarded as a definate treat by children if they survived chimney sweeping. Regards Dave <{POST_SNAPBACK}> I prefer to think we are more Edwardian, running around naked and carefree. It's -36C here and you want ME to get out of bed to push a button? <{POST_SNAPBACK}> At least it proves you are alive
  6. In C I dont think its standard so that would not compile .
  7. OK , just checked a #ifndef TRISB #define TRISB 0x06 #endif in visual studio and it says This if from visual studio help I know its the same with GCC - so i would say its the standard So after a define YOU CANNOT HAVE #endif as it its not treated by the compiler as a preprocessing command.
  8. I think the problem is with #ifndef TRISB #define TRISB 0x06 #endif I have not tried it with Visual Studio , but it looks like the #endif is getting corrupted. Personally the above style of programming is not nice and should really look like #ifndef TRISB #define TRISB 0x06 #endif
  9. The function can only use Ram file registers , the W register is not one of these. If you look at 39582b.pdf page 9 ( figure 1-2 pic16f874a/877a block diagram ) and the others for the architecture show the RAM File Registers and W reg are totally separate. Looking at the syntax of the instruction RLF f,d The d is the destination "register" which is W or F , but the source f register is a value of 0 to 127. The compiler might be programmed not to accept a direct number for the f register which makes sense as this is paged memory and we need to ensure the correct page of memory is used. In your code you use the value 0 , which is the indirect addr and is not a physical register and not the W register as you thought.
  10. I am no expert when it comes to this chips assembly language , but looking at the docs, It looks like you need a source register ( variable like the _rnb? ) as you have in the first line of your listing.
  11. If you do a google search for .httpaccess +Megab0rt you will find at least 258 matches on all sorts of forums. .. I have a funny feelings its just a spam post Andrew
  12. Opps bad me. #define ANIM_PTR(xx,time) __##xx##_HI,__##xx##_LO,time Works a treat. Andrew
  13. #define __Stream1_HI 0xc2 #define __Stream1_LO 0x00 #define ANIM_PTR(xx) ##xx_HI,##xx_LO unsigned char dataa[] = {ANIM_PTR(__Stream1)}; this should produce unsigned char data[] = {__Stream1_HI,__Stream1_LO}; Instead I get error: unknown identifier xx_HI error: failed to initialize variable 'dataa' Andrew
  14. OS: WinXP, SP2 SourceBoostIDE: 6.50 Pre release Compiler: BoostC 6.50 Pre release Target: PIC16F877A I have a data table defined by #pragma DATA 0xc100 , 0x01,0x02,0x03,0x04,0x05,0x06 #pragma DATA 0xc110 , 0x11,0x12,0x13,0x14,0x15,0x16 #pragma DATA 0xc120 , 0x21,0x22,0x23,0x24,0x25,0x26 now I want to create a series of pointers to these arrays so i tried #pragma DATA 0xc300, (0xc100)>>8,(0xc100)&0xff, (0xc110)>>8,(0xc110)&0xff, (0xc120)>>8,(0xc120)&0xff This produces <filename>(33): error: failue but if i use #pragma DATA 0xc300, 0xc1,0x00, 0xc1,0x10, 0xc1,0x20 It works a treat
  15. Slightly off topic , but in the same ball park .. If i create an array , say rom char *data[] = {5,4,3,2,1,0}; why does it create some reading code and then for every element in the table RETLW xx as above RETLW 5 RETLW 4 RETLW 3 RETLW 2 RETLW 1 RETLW 0 Surely this increase my 6 byte structure into 12 bytes + overhead. Is there anyway to get around this as the program I am writing is mainly data driven. Cheers Andrew
×
×
  • Create New...