-------------------------------------------------- From: "David Duffy (AVD)" Sent: Tuesday, August 10, 2010 11:32 PM To: "Microcontroller discussion list - Public." Subject: Re: [PIC] 18F45K20 newbie help > Oli Glaser wrote: >>> I changed to LATx instructions for output, fixed the silly error with >>> the TRIS setting and it now works! >>> >> >> Good stuff.. >> Just a thought if you are getting into the PIC18s - have you tried C18? = I >> like it very much and use it for most things, and if I really need to >> optimise something I write a function in assembler and link it in. I=20 >> don't >> know how your C is but maybe consider giving it a go at some point... >> > > I should really get into C programming. I actually program in Delphi > (think "visual pascal") daily, but C seems to do my head in every time I > look at it. I understand that, but once you get past a certain point it makes life a lo= t=20 easier and speeds things up. I find for most projects C will do fine, with= =20 the larger flash in PIC18s program size is much less of a problem and for=20 optimisation assembly code can be linked (one reason to get the hang of=20 linker scripts/ relocatable mode, stack, argument passing etc) I learnt a=20 lot about the architecture when doing this kind of thing. It's very rare that I would consider writing the entire program in assemble= r=20 nowadays, the only reason would be to meet timing constraints(protocols=20 etc), or reduce program size etc. I'm sure others have different=20 views/experiences, but in general I think most agree it's good to learn bot= h=20 ways. Also, then you can benefit from all the example code (in C and=20 assembly) out there too. I get the "head being done in" bit, getting to grips with a new=20 architecture/language can be a bit of a pain at first though even with the= =20 datasheets - I'm wrestling with a soft core processor (using assembler) on= =20 an FPGA (using Verilog which I'm relatively new to) at the moment, missing= =20 the PIC16/18 quite a bit :-) At least Microchip produce very good datasheets compared with some=20 companies. >> Try to ignore the standard newbie bashing... :-) > > I've been on the PicList long enough (Olin here, Olin gone, repeat N > times) to have a thick skin! Yes, sorry - I meant newbie as in new to a certain chip/architecture, not i= n=20 general - anyone who survives longer than a week on here must indeed have a= =20 thick skin.. :-) >> One thing I agree with Olin on though is to move on from absolute mode t= o=20 >> relocatable as soon as possible, as it will just hold you back. >> > > I'm sure you're right there. I can see the advantages and just need to > make the time for it. > David... Good idea, for anything beyond simple/small projects it's a must really.. Time is always the problem... too much to know and too little time -=20 relocatable time is in short supply :-) =20 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .