How to finf the databus width with C?

Status
Not open for further replies.

raja.bhavanam

Junior Member level 3
Joined
Nov 22, 2005
Messages
28
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,502
c

how to find the databus width using c code ?
 

Re: c

The databus width has nothing to do with c.
That's important because your code, written in c, should be as far as possibly independent from your hardware.

Gomez
 

Re: c

Gomez said:
...The databus width has nothing to do with c...

Correct.

But I am quite interested in the OP’s reason for calculating this in C code. Can you elaborate more on your question raja?
 

Re: c

It is not about finding data bus width in C. It is about using the appropriate data type according to the hardware being controlled.
For example I am writing code for a Frame buffer in LCD controller in 8 bit mode. I can use any type of array but it will be easier in coding if i used a 8bit width data type for the array.
Regards,
Amraldo.
 

c

yes ,8051 architecture is 8bit datawidth,which means you define the datatype that is 8bit will be dealt easily for the mcu, if you use 16 bit data ,it will slow the instruction processing.
 

c

I think such info must be implementation specific - particular multiplatform compilers can prowide this information by proprietary functions or defines . Look for specific compiler manual.
 

c

It is essencial to have some knowledge about CPU and compiler you are using.
 

Re: c

i think what he means is ... given a task to write a piece of code which will exploit the data bus size to perform certain tasks in an efficient manner .... how can the size of data bus be "measured" ? .. am i right raja?
 

Re: c

hmm .. i dont exactly know C programing .. i think the size of char type is the size of data bus .. or is it unsigned int. also i remember from my 68hc11 course .. the size of accumulators A n B were the same as data bus.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…