Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 31st January 2008, 05:41 PM   (permalink)
Question Programming

Is it possible to make a program and choose uC afterwards?
__________________
Simplicity rules

Good enought - its perfect ??

2 Gig of free online backup space

Are you a Chemist?
Kryten is offline   Reply With Quote
Old 31st January 2008, 07:00 PM   (permalink)
Default

Yes, as long as you choose the uC that you wrote the code for!
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 31st January 2008, 08:16 PM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
Yes, as long as you choose the uC that you wrote the code for!
I can't think of any reason you couldn't write a makefile for sdcc which would allow this. It would be a major pain in the neck if the uCs are very different, though.

I would think of it as more of a neat trick than something you'd want to actually do. And it certainly would be easier for a beginner to just rewrite the code for each target uC. It might be realistic for a large codebase which needs to have the ability to use newer versions of an architecture while maintaining compatibility with existing/older ones. Then again, it might not*.


Torben

[Edit: *: Then again #2: but that's not really the same thing as having one codebase target i.e. AVR, PIC, and Z80 anyway.]

Last edited by Torben; 31st January 2008 at 08:21 PM.
Torben is online now   Reply With Quote
Old 8th February 2008, 08:04 AM   (permalink)
Default

well if i choos a PIC family (i.e PIC16FXXXX) does they have the same set of instructions? When using C code?
__________________
Simplicity rules

Good enought - its perfect ??

2 Gig of free online backup space

Are you a Chemist?
Kryten is offline   Reply With Quote
Old 8th February 2008, 08:43 AM   (permalink)
Smile Well...

Quote:
Originally Posted by Kryten
Is it possible to make a program and choose uC afterwards?
Yes definitely...

See two cases are there...

if you write in c language then you can change your microcontroller whenever you want... from pic to avr to zilog to anyone...

when you want to choose a microcontroler among any of the pic then you can write the program in both assembly and C and then can choose the microcontroller...

All you need is to change the include (header) file on changing the controller...

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline   Reply With Quote
Old 8th February 2008, 09:05 AM   (permalink)
Default

Ok well i see i need to specify my questions better
This is what i asked on the top !!


Edit:
What program do you sugest for making the firmware??
__________________
Simplicity rules

Good enought - its perfect ??

2 Gig of free online backup space

Are you a Chemist?

Last edited by Kryten; 8th February 2008 at 11:46 AM.
Kryten is offline   Reply With Quote
Old 8th February 2008, 09:28 AM   (permalink)
Default

Quote:
Originally Posted by Kryten
Ok well i see i need to specify my questions better
This is what i asked on the top !!
Actually, that's not the question you asked. You asked about microcontrollers in general, not PICs specifically. And the answer is only partly correct: if you write code depending upon features present in the higher-end PICs but not in the lower-end ones, that code will not work properly in lower-end PICs, regardless of the include file.

You can write code targetted at a range of uCs, as long as the code works within spec on all of them. Writing code which could run equally well on an 8051, a PIC, or an ATMEGA would be worth it only if the program didn't rely on any of the advanced features of any of the uCs. Choose the environment and code to it.

Within a family (like PICs) you could do some makefile magic to make it work, but I don't think it would be worth it.


Torben
Torben is online now   Reply With Quote
Old 8th February 2008, 09:48 AM   (permalink)
Default

You need to bear in mind that while C is far more portable than assembler, it's not really that portable, particularly for micro-controllers, where their specific requirements modify the language accordingly.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 8th February 2008, 09:51 AM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
You need to bear in mind that while C is far more portable than assembler, it's not really that portable, particularly for micro-controllers, where their specific requirements modify the language accordingly.
A far more concise and elegant way to say what I was trying to say.


Torben
Torben is online now   Reply With Quote
Old 8th February 2008, 09:52 AM   (permalink)
Smile Well...

Well Sir,

I feel it is a good habit of using the assembly language... C is a good language but at least you have to master one industry microcontroller first... hence start with assembly...

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline   Reply With Quote
Old 12th February 2008, 07:41 AM   (permalink)
Default

Yes sir Simran. In school we have used ASMide with the MC68HC11 (thats with Assembly code)
So am familiar with assembly coding..
Have just started C programming now the easy stuff such as definng the different Analog inputs and setting the AD converter on them
__________________
Simplicity rules

Good enought - its perfect ??

2 Gig of free online backup space

Are you a Chemist?
Kryten is offline   Reply With Quote
Old 12th February 2008, 07:44 AM   (permalink)
Default

Quote:
Originally Posted by Torben
Actually, that's not the question you asked. You asked about microcontrollers in general, not PICs specifically. And the answer is only partly correct: if you write code depending upon features present in the higher-end PICs but not in the lower-end ones, that code will not work properly in lower-end PICs, regardless of the include file.

You can write code targetted at a range of uCs, as long as the code works within spec on all of them. Writing code which could run equally well on an 8051, a PIC, or an ATMEGA would be worth it only if the program didn't rely on any of the advanced features of any of the uCs. Choose the environment and code to it.

Within a family (like PICs) you could do some makefile magic to make it work, but I don't think it would be worth it.


Torben
Ok Torben. (sounds like your a Norwegian bloke)
Im aiming at using the PIC16 family as i need a ADC that has hig resolution cos im measuring 100A @ 2.5V (hmm must aplify it a bit )
__________________
Simplicity rules

Good enought - its perfect ??

2 Gig of free online backup space

Are you a Chemist?
Kryten is offline   Reply With Quote
Old 12th February 2008, 09:25 AM   (permalink)
Default

Quote:
Originally Posted by Kryten
Ok Torben. (sounds like your a Norwegian bloke)
My mother is Danish, my Dad is Texan, and I'm from northwest Canada. I've been to Norway and loved it, though. And I'm wearing a cable-knit sweater right now.

Quote:
Im aiming at using the PIC16 family as i need a ADC that has hig resolution cos im measuring 100A @ 2.5V (hmm must aplify it a bit )
Sounds neat. What are you measuring?


Torben
Torben is online now   Reply With Quote
Old 12th February 2008, 09:34 AM   (permalink)
Default

Quote:
Originally Posted by Torben
Sounds neat. What are you measuring?
Torben
Im measuring the amout of energy going to and from a batterybank (made by a windmill) in order to figure out if there is need for aditional chargeing capasity. I also need to logg and mediate the measurments to a SD card
__________________
Simplicity rules

Good enought - its perfect ??

2 Gig of free online backup space

Are you a Chemist?
Kryten is offline   Reply With Quote
Old 12th February 2008, 09:45 AM   (permalink)
Default

Quote:
Originally Posted by Kryten
Im measuring the amout of energy going to and from a batterybank (made by a windmill) in order to figure out if there is need for aditional chargeing capasity. I also need to logg and mediate the measurments to a SD card
Nice! Be sure to post your final results.

What is the budget for this project? There are things out there called SBCs (single-board computer) and SOMs (system on module) which include a processor and several peripherals such as serial, USB, and I/O ports; SD card drives; higher-resolution ADCs etc--but the ones I know about start at around $100 US. Depends on your budget and how much of it you want to do yourself, really.


Torben
Torben is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Question about Inchworm+ Quan Micro Controllers 54 28th October 2007 12:20 AM
UNIT Committment solution using Dynamic programming arijit18 Electronic Projects 1 18th October 2007 08:27 PM
my first 16F88 has me stumped Hank Fletcher Micro Controllers 15 3rd August 2007 03:21 PM
Programming languages sram General Electronics Chat 9 2nd March 2007 04:14 PM
Good Computer Programming Book ThermalRunaway Chit-Chat 21 16th September 2005 10:05 PM



All times are GMT. The time now is 06:28 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.