On Tue, 13 Mar 2001, Thomas N wrote: > Hi everyone, > > The PICmicro uses only 35 instructions and I notice there is no "c like" > instruction, how come people use statement like IF...ELSE, WHILE, MACRO, > etc. Where are these instructions? I can't find these instruction in the > datasheet. How much memory does each statement occupy? The other answers are pretty much al I could tell you. There are branching and bit/sign tests in the PIC instruction set, which are used to implement the C instructions -- or BASIC, FORTH or whatever higher level language you're using. > I heard that if I use C language, the memory on the PICmicro won't be > enough. It always is for me. I find I could probably go through the code my C compiler generates and make it a little smaller, a little more efficent, whatever. I have never needed to, since I've never run out of RAM or program space, or needed tat last few microseconds of execution time. It also allows me to write what I need to write much faster than I could if I were using assembly. Of course, that's just me. Assembly fanatics would think coding in C is a horrible idea, I feel the same way about BASIC... Here's an example: ; .................... do { ; .................... lcd_line_2[14] ='F'; MOVLW 46 MOVWF 38 ; .................... if(!C_F) lcd_line_2[14] = 'C'; BTFSC 3B,0 GOTO 0B0 MOVLW 43 MOVWF 38 ; .................... C_F = !C_F; MOVLW 01 XORWF 3B,F ; .................... putlcd(lcd_line_2); MOVLW 2A MOVWF 3D GOTO 096 ; .................... sleep(); SLEEP ; .................... sleep(); SLEEP ; .................... } while(1); GOTO 0AA Some lines of C code generate one instruction, some generate 10, 20, whatever it takes. Dale --- The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka!" (I found it!) but "That's funny ..." -- Isaac Asimov -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu