RCU Forums - View Single Post - CDI gr8flyer55
View Single Post
Old 09-24-2012, 08:20 AM
  #397  
jakestew
Senior Member
 
Join Date: Aug 2011
Location: Moscow, ID
Posts: 144
Likes: 0
Received 0 Likes on 0 Posts
Default RE: CDI gr8flyer55

It's way too easy to get sucked into debates! Before I started here I hadn't used PICs before or seen assembly in a very long time. PIC programmers seem to be one of the few assembly holdouts left.
I've always had a strange combination of respect, pity, and disdain for assembly programmers. On the one hand it's a tribute to their skills that they have the brains to think like a computer, on the other hand things are so much easier in C so they either spend a lot more time or are simply a lot better than me. By the same token, it often seems so arrogant for them to think that they can directly manipulate the hardware in a better way than the C compiler writers.

But there's really not much of a debate over the two. Assembly is not a real programming language, it's simply directly manipulating the hardware. I know that I don't want to have to learn each instruction of every processor, and that even if I did, 9 times out of 10 I'm not going to come up with a better way to make the hardware implement an "if" statment, "for" loop, or do basic math.
I commented every line of code in Nyemi's program, looking up lot's of the instructions, and I still don't think I really fully understood exactly what it was doing at all times.

My program seemed to work out great though. Nyemi and I both seem to have the same 51 uS algorithm correction value, so apparently our code is exactly equally efficient. I run at twice the speed (8 MHz), but I'm also loading 16-bit table values, using 16-bit timer values, and doing dividing and rounding on the revolution timer values.

In any case, the main reason for us to use C in an open source community project is because C is much more readable, portable, and it's 90% of programmers' first language. I'd love to have more devs onboard, and I'm willing to put this project on Github or Google Code so we could all work on it simultaneously. If anyone sees anything in the code they don't understand 100%, please ask me about it. Fresh eyes and beginners not understanding something and asking about it is the best way I know of to find better ways to do something. My math skills are pretty weak, as far as programmers go, so I'd love to have some math experts helping out.

I also haven't written much for Windows/GUI programs in the past. So it would be great if someone could help me write an interface program. I'm not looking forward to doing that all that much. If anyone knows a good way to easily turn a spreadsheet into a standalone program that the source code can still be worked on that would be pretty nice. Let me know!


In other news... I'm working on loading the user settings into the tables so they will also switch with the table switch. That should be handy for tweaking startup settings. I'm also working on having the spreadsheet directly generate the hex file so that people don't have to install and use the compiler for each change.


-Jake