which more easy??

Status
Not open for further replies.
hi,
I would not pick a language because its easy to learn, choose one thats going to suit your applications.
 
depends on which example code you saw.

It's good to begin with ASM and when you understand the different registers and instruction, you can switch to C.

kind regards
 
The first one is always the most difficult one. Once you learn to program in one language, you can learn other languages fairly quickly. At schools they seem to start with higher level languages first.. I don't know why, maybe because those are most usefull in general.

C++ is just an extension to C. So when you learn the other you are also learning the other one. But C++ might be very confusing and messy for a beginner. It takes some practice and experience to write elegant C++ code.
 
Last edited:
Basic is quite a good place to learn.. there are several good compilers on the market.. you can program very low level in basic these days most include bitwise and low level port / register access. C can be cheaper though,, Hi-tec lite is completely functional and free. There are many more books for C and ASM than there are for basic. Nigel has a brilliant tutorial page for ASM on the PIC ...

There are many peolpe on this forum with C Basic and asm knowledge aswell.

Cheers Ian
 
Like most things in life, if you want to really understand what's going on, you have to start at the bottom and work your way up. Start off with assembler, understand the register structure, bit manipulation, peripherals, addressing modes etc. Then when you work your way up to C or any other higher level language for that matter, you will understand what the code is actually making the device do. Your troubleshooting skills will greatly benefit from knowing what's supposed to be happening and what's actually happening at the device level.

rgds
 
If you avoid the libraries in C then you have to learn the registers and peripherals just the same as in assembler. The only thing you won't know is bank switching but that's no big loss. Same with Basic. The main difference is the amount of typing.

This,
Code:
		bsf	STATUS,RP0
		movlw	b'11110000'
		movwf	TRISA
		movlw	b'11110000'
		movwf	TRISB
		movlw	b'00000111';	disable comparator
		movwf	CMCON
		movlw	B'01110000'	;select 8MHz clock
		movwf	OSCCON
		clrf	ANSEL		;no ADCs
		bcf	STATUS,RP0
		clrf	PORTA
		clrf	PORTB
Becomes,
Code:
    trisa=0b11110000;
    trisb=0b11110000;
    cmcon=0b00000111;
    osccon=0b01110000;
    ansel=0;
    porta=0;
    portb=0;
Either way, you need to know what tris, cmcon, ansel and port do.

Mike.
 
Last edited:
It's basically to do with a thing called syntax! Once you learn a language and start to program (using that syntax) you will soon see that really the only thing that will change from language to language is the syntax.

This doesn't always follow! Assembler on a P4 is quite complex compared to a high level language. but small micro's are quite easy to program in all languages.

Cheers Ian
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…