Well, I trimmed the code somewhat to remove a lot of my application-specific parts. Here's most of it, at least enough to see what's going on: .................... clock -= 8192; * 005B: MOVLW 00 005C: SUBWF 34,F 005D: MOVLW 20 005E: BTFSS 03.0 005F: MOVLW 21 0060: SUBWF 35,F 0061: MOVLW 00 0062: BTFSS 03.0 0063: MOVLW 01 0064: SUBWF 36,F 0065: MOVLW 00 0066: BTFSS 03.0 0067: MOVLW 01 0068: SUBWF 37,F .................... restart_wdt(); 0069: CLRWDT .................... if(clock < 8192) { 006A: MOVF 37,F 006B: BTFSS 03.2 006C: GOTO 087 006D: MOVF 36,F 006E: BTFSS 03.2 006F: GOTO 087 0070: MOVF 35,W 0071: SUBLW 1F 0072: BTFSS 03.0 0073: GOTO 087 .................... elapsed.seconds++; 0074: INCF 30,F .................... clock += 1000000; 0075: MOVLW 40 0076: ADDWF 34,F 0077: MOVLW 42 0078: BTFSC 03.0 0079: MOVLW 43 007A: ADDWF 35,F 007B: MOVLW 0F 007C: BTFSC 03.0 007D: MOVLW 10 007E: ADDWF 36,F 007F: MOVLW 00 0080: BTFSC 03.0 0081: MOVLW 01 0082: ADDWF 37,F .................... if(dtimer) dtimer--; 0083: MOVF 39,F 0084: BTFSC 03.2 0085: GOTO 087 0086: DECF 39,F .................... } .................... .................... if(elapsed.seconds == 60) { 0087: MOVF 30,W 0088: SUBLW 3C 0089: BTFSS 03.2 008A: GOTO 091 .................... elapsed.minutes++; 008B: INCF 2F,F .................... elapsed.seconds = 0; 008C: CLRF 30 .................... if(tripdelay) tripdelay--; 008D: MOVF 3A,F 008E: BTFSC 03.2 008F: GOTO 091 0090: DECF 3A,F .................... } .................... if(elapsed.minutes == 60) { 0091: MOVF 2F,W 0092: SUBLW 3C 0093: BTFSS 03.2 0094: GOTO 097 .................... elapsed.hours++; 0095: INCF 2E,F .................... elapsed.minutes = 0; 0096: CLRF 2F .................... } .................... What I really like about C is the fact that I can build some relatively complicated functions and have the compiler figure out the best way to do the low level work while I concentrate on the overall program/product. I'm sure I pay a small penalty in code space, but so far I have not had a single project outgrow the chip I started out with -- in fact, most of the time I find out I can use a smaller chip than I originally thought. Like this - I wanted to split the hours into two digits for display, and look up those two digits in a table containing the 7-segment patterns for the digits 0-9 and 'd': .................... digit1 = sseg[set.hours % 10]; 009F: MOVF 31,W 00A0: MOVWF 42 00A1: MOVLW 0A 00A2: MOVWF 43 00A3: CALL 046 00A4: MOVF 20,W 00A5: CALL 037 00A6: MOVWF 21 00A7: MOVWF 40 .................... digit2 = sseg[set.hours/10]; 00A8: MOVF 31,W 00A9: MOVWF 42 00AA: MOVLW 0A 00AB: MOVWF 43 00AC: CALL 046 00AD: MOVF 21,W 00AE: CALL 037 00AF: MOVWF 21 00B0: MOVWF 41 Would have taken me a week to figure that out, and it's what I call "delicate" - if I change something somewhere else in the program, this is easily broken by geting pushed past a bank boundary or some such nonsense. With the compiler, I **never** have to care about where something is located, the compiler does the bank switching and RAM allocation with complete transparency. I love it. I used to prefer three hours of soldering to avoid a few dozen lines of assembly code... now I can code for an hour or two and eliminate most of the parts in a design, most of the time. Maybe I'm just not properly "wired" to love assembly... with the 8048 and 8051 it was never a big problem, but with the PIC a simple test and branch is just such a pain in the ass. Dale -- "Curiosity is the very basis of education and if you tell me that curiosity killed the cat, I say only the cat died nobly." - Arnold Edinborough On Fri, 15 Mar 2002, Claudio Tagliola wrote: > Hi Dale, > > I'm new to the CCS compiler, can you show the resulting code of this > program? I'm curious on how the compiler does it's job. I've ordered > CCS, but haven't received it yet, so can't do it myself :) -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics