![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #16 |
|
There is no right answer here. A lot depends on the individual. Personally, knowing and using both asm and C is the best end result. You can understand the structures of a microcontroller with out learning ASM. Except for precise short delays, you can pretty much do everything in C. I've programmed all the features of the midrange in C. The advantage of C is that much of program house-keeping is done for you. banks, pages, pclath, bit-test-skip-double-inversion jumps, flash rom tables, ... can be error prone for even experienced programmer in asm. Still, the ability to read and understand asm is important as many examples are written in asm. | |
| |
| | #17 | |
| Quote:
| ||
| |
| | #18 | |
| Quote:
Note that I am not saying asm is an incorrect approach. It's perfectly fine, too. | ||
| |
| | #19 | |
| Quote:
Fine, you could study the hardware and understand it from a C point of view, but I would suggest that is more difficult than learning a small amount of assembler in the first place?. You see some absolutely horrible code written in C and BASIC, simply because the writers don't have a clue about the hardware. | ||
| |
| | #20 |
|
Hi all Are we making a case out of nothing- these are inter complimentary.any one writing a prog has his own comfort or discomfort and many times feels homely with what one knows. Volumes can be written with 'C' by them comfortably as it saves mental fatigue. Let us imagine software written for Various Telecom digital switches with parallel processing depended on 'C' language. while writing for a microcontroller, if one feels comfortable with what one Knows, let him . Hope we should put stop to this and start delivering effective software. towards this end the site managers can organise a sort of heathy compitition across a critical pproject. we need not bother aBOUT TIME TAKEN AT THIS STAGE, BUT ONLY TRY JUDGING THE SIMPLICITY AND TIME TO PERFORM THE WANTED FUNCTIONS. EACH PARTICIPENT SHALL HANDOVER THE SOURCE CODE TO THE PANEL AND THE SITE COUL GET THEM EVALUATED BY DISPASSIONATE PANEL. Let us take it spotive. Incidentally it can also involve hardware and PCB design interested groupswho will first do it and others to write software top work for the end goal. i have suggested these with no bias as i am neither a software (C<BASIC< PASCAL<ASSEMBLY< FLOWCODE< JAL and what not)or hardware professional and regard all teams as eminent in their fields-
__________________ Regards, Sarma. Last edited by mvs sarma; 10th December 2006 at 06:02 PM. | |
| |
| | #21 |
|
If you feel comfortable writing in 'C' and things work for you then fine. If you're happier writing in assembler then that's fine too, there is no actual right or wrong way to do things. What has to be borne in mind though is that they are complimentary approaches and that each has it's pros and cons. 'C', Basic or any high level language allows for a 'black-box' approach to driving machines which means you can be more productive and also allows you to work cross-platform. Assembler, although tied to a particular machine or device which means having to learn the instructions peculiar to that machine, allows you to have a clearer understanding of the underlying hardware and gives you the opportunity to write the most efficient code. It's when problems arise that the assembler coder has the upper hand and has a better chance of locating the source of any problem. The 'C' coder has less of a chance because he/she is necessarily 'shielded' from the nuts and bolts. Even of you insisted that you only wanted to write in 'C', it would be of great benefit to at least have some understanding of assembler not only because it can help to locate sources of problems but allow you to write more efficient 'C'. It goes without saying that a full understanding of both is the best scenario! | |
| |
| | #22 | |
| Quote:
Had you said, you can (learn to) write more efficient code in asm, I would wholeheartedly agree. especially when a program overflows a bank and/or a page. I don't think pointing to bad code is a reasonable justification. I've seen plenty of horrible assembler, too. bad programmers write bad code, not compilers. One could also point out that assembler coding is much more error prone. I taught both C and assembler at the college level and found that more people had problems writing decent assembler than any other language, by far. And, I will continue to point out that people should really know both languages as a good engineer uses all the tool available. | ||
| |
| | #23 |
|
I agree with phil. When I first started with microcontrollers it was a bit of a chore and confusing to program in assembly. Then I found JAL, which is a high-level language, but lets me insert assembly wherever I want. Now I have a much better understanding for the underlying hardware. I would have been discouraged had I not accomplished things first with a high-level language (which I still use). And, afterall, isn't this the whole point of the Basic Stamp, PICAXE, etc.? It's probably counterproductive to try to learn the hardware AND assembly at the same time. It can be too much at once. Mike | |
| |
| | #24 | |
| Quote:
i said i am intersted to learn 'C'. if you see the next sentence there in my post, you understand my mind. i do agree i am a ZERO in any language and trying to learn to have a hobby at 61+. i didn't want to discourage the person reg C but he/she should have an understanding of Assy as it is a practice to use Assy patches at places so far. Off late , due to reduction of prices and large chunks of memory embedded into controllers, one feels comfortable with HLL. ...
__________________ Regards, Sarma. | ||
| |
| | #25 | ||
| Quote:
It's probably as easy (if not easier?) to learn the hardware by a brief study of assembler, which only has 35 instructions (most of which you don't need to know about to understand the hardware). The datasheets don't explain the hardware using C, and there's a generally lack of sample C code and books - a good C tutorial, giving condensed datasheets using C examples would do just as well - but does such a thing exist?. Quote:
| |||
| |
| | #26 |
|
Well, clearly, we disagree that asm is the only way to do it. There is never just a single path to knowledge.
| |
| |
| | #27 | |
| Quote:
As the datasheets are in assembler, as are almost all the application notes, it makes sense to have enough assembler knowledge to convert the required hardware understanding to C. If the information was available in C, then you wouldn't need to. Incidently I did a 'similar' thing many years ago - converting C programs to Pascal - I learnt enough C to understand how to convert the programs, something I couldn't do with zero knowledge of C. | ||
| |
| | #28 | |
|
I'm not sure your statement above jibes with this earlier one: Quote:
| ||
| |
| | #29 | |
| Quote:
Since we don't personally know the capability or learning habits of every single person who asks for advice on getting started programming microcontrollers, I still stick with Nigel in saying that is probably a better bet to recommend ASM before C, simply because it's more of a sure bet. If I had a friend who I'd known for years, and I was familiar with his programming ability and knowledge of computer architecture and stuff like that, then I would be much more inclined to advise them to go straight to C... But the people who ask for this sort of advice on a daily basis can really run the gamut from high school kids with no electronics or programming experience, to college kids with a good background in programming and computer architecture, or beyond... and you have to admit, they usually don't give any good indication of their abilities.
__________________ EEgeek.net Last edited by evandude; 11th December 2006 at 05:58 PM. | ||
| |
| | #30 |
|
Bah! I code my AVR's in Bascom Basic. I purchase the appropriate chips for my tasks by reviewing datasheets to understand the abilities they provide. I have as much need to understand every last detail of the chips operation as I do in understanding the complexities of pentium cpus when I code for pc. As long as the result is functioning code that does what is intended, so be it. My priorities are easy to understand code that can be readily modified if need be (especially some time after initial programming, when the code is no longer fresh in the mind), and time investment on project construction and overall 'debugging' limits the time available for coding. Perhaps your guys projects are much more complex than mine, but I've not run into anything so far that required effeciency beyond what Basic has to offer; either in speed or size. This includes projects with lcd, i2c, spi, adc, multi channel pwm, etc. that can typically be accomplished in a very short period of time, thanks to the power of the programming functions available. I recently finished a vector generator project for oscope display that required a lot of geometry and fractional math... I could not imagine coding this in assembly; I had the foundation of my project running within an hour. I'm not sure any benefits I would have gained in understanding the chip's hardware functioning in calculating such mathematical fuinctions would have outweighed the time and energy invested in learning and debugging them at assembly level. Also, microcontrollers, like many other digital devices, are becoming larger and faster all the time. I expect that in the near future, coding microcontrollers in assembly will be as prevelant as assembly in pc programming is now - virtually gone. Of course, this is simply my opinion ;-) Last edited by agent420; 12th December 2006 at 01:25 PM. | |
| |
|
| Tags |
| language, programming |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Which Programming language?? | pike | Micro Controllers | 5 | 8th December 2006 12:40 PM |
| PIC Programming in C Language | onlineajit2000 | Micro Controllers | 21 | 8th July 2006 11:36 AM |
| Learning Assembly Programming Language | Johnson777717 | Micro Controllers | 4 | 22nd March 2004 03:00 PM |
| which programming language ? | hm_fa_da | Micro Controllers | 4 | 24th July 2003 10:55 PM |
| PIC Programming Language | mailmicky24 | Micro Controllers | 1 | 12th March 2003 03:10 AM |