Go Back   EcoModder Forum > EcoModding > Fossil Fuel Free > Open ReVolt: open source DC motor controller
Register Now
 Register Now
 


Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 06-05-2009, 03:33 AM   #1551 (permalink)
EcoModding Apprentice
 
Join Date: May 2009
Location: Australia
Posts: 109
Thanks: 0
Thanked 1 Time in 1 Post
Simple question.
I am not familiar with the Atmel chip, is there an assembly language programming tool available? If it ever gets to the point of extreme code optimisation you will get better results with assembler than with a higher level language compiler.

Actually it is worth looking at the code generated for function calls, compilers often stick quite a lot of unnecessary overhead in them.

  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 06-05-2009, 09:23 AM   #1552 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location:
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 267 Times in 210 Posts
Get it working, measure, see if optimizations are required.

Optimizations (I.E. rewriting stuff in assembler) frequently obfuscate the code, so should be done only as necessary.

It would be nice (though it is terribly unimportant at this stage) if the output from the cpu could drive something like this, then users could see something interesting:
http://www.sparkfun.com/commerce/pro...roducts_id=461

OF course I would want to mix in a vehicle speed signal so that watts/mile could be displayed, then buttons and yadda yadda But not important for version 1, think "scope control" for now.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!

Last edited by dcb; 06-05-2009 at 09:28 AM..
  Reply With Quote
Old 06-05-2009, 09:41 AM   #1553 (permalink)
Master EcoModder
 
Join Date: Jun 2008
Location: London, Ontario
Posts: 1,096

2k2Prot5 - '02 Mazda Protege5
90 day: 33.82 mpg (US)
Thanks: 0
Thanked 12 Times in 9 Posts
I would definately not scrap the idea of uart on a prototype. I transform ideas into prototypes into production boards for a living - the UART is a BIG help in the prototype phase and totally useless in production. It would be a really big help to see the streams of incoming data, intermediate calculations and output data. You COULD use it to change up the PI values and other scalars and safety limits, but just for data logging it is powerful.

It is not really that complicated to do an ugly, raw, one-way data stream out. I could email paul some automatically generated code for a freescale to run the uart by interrupts, but i don't have anything for the atmel. Usually it comes in the form of a couple simple ISRs and a simple software FIFO. I'll spend a few minutes googling to see if i can find something.
  Reply With Quote
Old 06-05-2009, 09:45 AM   #1554 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location:
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 267 Times in 210 Posts
And I hate putting in code that isn't for production. That is asking for trouble. Put an isp connector on there and read and write from the eprom directly if it is a configuration thing.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote
Old 06-05-2009, 10:50 AM   #1555 (permalink)
Master EcoModder
 
Join Date: Jun 2008
Location: London, Ontario
Posts: 1,096

2k2Prot5 - '02 Mazda Protege5
90 day: 33.82 mpg (US)
Thanks: 0
Thanked 12 Times in 9 Posts
quick googling turned up nothing... are the atmel users just not interested in interrupt driven communication? Every uart code snippet I saw had a while(blah blah){sit here with your thumb up your...}

I don't have time for the rest of the day to put together some interrupt driven code... i am SUPPOSED to be doing work right now... Maybe on Monday if you don't have it sorted, i will send you some freescale code. You'd just have to change some registers and stuff around, it would be quite compatible.
  Reply With Quote
Old 06-05-2009, 10:53 AM   #1556 (permalink)
EcoModding Apprentice
 
Join Date: May 2009
Location: Australia
Posts: 109
Thanks: 0
Thanked 1 Time in 1 Post
"obfuscate" what a great word, I'm going to find a place to use that!

Well written assembler, that is lots of comments, is just as clear as any other code. The problem is these days programmers are not taught the rudimentary principles of good programming. Resources are too cheap, computers are lightning fast, no need for efficiency, not enough need for proper program design. Then they step up to an embedded system and confusion reigns supreme. I'm old, pig headed and all that, but I will tell you what learning to program in machine language and then assembler taught some very valuable lessons and a few tricks along the way.
  Reply With Quote
Old 06-05-2009, 10:53 AM   #1557 (permalink)
Master EcoModder
 
Join Date: Jun 2008
Location: London, Ontario
Posts: 1,096

2k2Prot5 - '02 Mazda Protege5
90 day: 33.82 mpg (US)
Thanks: 0
Thanked 12 Times in 9 Posts
dcb, that's a good point, too. Could you datalog from an ISP?

However... having been through this process in a production environment that does custom engineering... hardware and firmware that is not "for production" is a major help in getting the job done. We add all kinds of headers, test points and circuitry to boards, as well as self-troubleshooting and configuration code just so that we can get from idea to sale faster.
  Reply With Quote
Old 06-05-2009, 10:55 AM   #1558 (permalink)
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,368
Thanked 1,119 Times in 734 Posts
Hey Matt, I'm pretty sure I can get it working with interrupts. I don't think that's a problem. I'm just trying to throw something dirty together for the sole purpose of testing the functionality of the hardware in a lab, in order to fine tune pull up resistor values, etc... By the way, R16 needs to be bigger than 1k. hehe.
__________________
kits and boards
  Reply With Quote
Old 06-05-2009, 10:55 AM   #1559 (permalink)
Master EcoModder
 
Join Date: Jun 2008
Location: London, Ontario
Posts: 1,096

2k2Prot5 - '02 Mazda Protege5
90 day: 33.82 mpg (US)
Thanks: 0
Thanked 12 Times in 9 Posts
squiggles... I totally see where you're coming from, but you'd have a tough time arguing that to a table full of embedded programmers. Modern compilers can do wonderful things with efficiency that you'd spend months fine-tuning by hand. This mpu will run this program with ease, written in C. No worries.
  Reply With Quote
Old 06-05-2009, 11:18 AM   #1560 (permalink)
EcoModding Apprentice
 
Join Date: May 2009
Location: Australia
Posts: 109
Thanks: 0
Thanked 1 Time in 1 Post
Quote:
Originally Posted by MazdaMatt View Post
squiggles... I totally see where you're coming from, but you'd have a tough time arguing that to a table full of embedded programmers. Modern compilers can do wonderful things with efficiency that you'd spend months fine-tuning by hand. This mpu will run this program with ease, written in C. No worries.
You are 100% right, I work as a project manager now days, trying to keep the table full of programmers on track!!

Also your point about test points and headers in pre-production is spot on, put them on every available signal, make life easier.

Unused I/O pins should have them as well, just in case you think of some handy use for them.

  Reply With Quote
Reply  Post New Thread


Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paul and Sabrina's Cheap 3 Phase Inverter (AC Controller) with Field Oriented Control MPaulHolmes Fossil Fuel Free 3472 01-12-2021 05:47 PM
Paul & Sabrina's Cheap EV Conversion MPaulHolmes Fossil Fuel Free 542 11-12-2016 10:09 PM
Three Dirt Cheap DIY Electric Cars - Part 5 SVOboy EcoModder Blog Discussion 0 12-12-2008 05:10 PM



Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com