PDA

View Full Version : 8051 c program



anon10128
26-09-2013, 09:23 PM
Hi sir,
How are PUSH and POP programming is done using embedded C prog?
What are the Factors to design OS for 8051? Can we have a OS for 8051?

A temperature sensor is giving the data. U have to sample the data every 10seconds, and calculate the difference between current data and previous data and display it without using microcontroller and programming.

Thank you.

anon10128
26-09-2013, 09:27 PM
His sir,
Can we have 10 data lines for a 8 bit micro controller? If yes, How? And can we have more than 16 address lines for 8051?

Thank you.

anon10128
26-09-2013, 09:34 PM
Hi sir,
what is the difference between Normal C and embedded C? I tried to google it out but didnt get satisfactory answer.

In K-map why do we have 11 after 01 but not 10? I feel its because we cannot simplify the k-map if we have 2 bit change in adjacent column or row. Is this correct?
Thank you.

anon10128
26-09-2013, 10:04 PM
Hi sir,
Can we use pointers in C programming for 8051? And can we pass any value to interrupt function 8051? Or the variables used in main function will be accessible in interrupt function also?

Thank you.

basant
27-09-2013, 06:50 AM
Anon10128,


Hi sir,
How are PUSH and POP programming is done using embedded C prog?
What are the Factors to design OS for 8051? Can we have a OS for 8051?

A temperature sensor is giving the data. U have to sample the data every 10seconds, and calculate the difference between current data and previous data and display it without using microcontroller and programming.

Thank you.

PUSH and POP are used to manipulate stack memory. If you are writing your program in C (embedded C or otherwise), compiler will use stack memory for function arguments, local variables and return values. In C programming, you don't need to use low level stack insturctions. C compiler will do it for you.

OS is typically required to manage multiple processes and interaction with perpheral devices. In theory you can implement an OS for 8051 microcontroller also, but for a 8 bit microcontroller, multiple processes doesn't make sense. Also Memory which you can address is very limited. However, you still need to interact with various devices which typically happens through interrupts. So you can consider all your interrupt service routines as micro OS.

For temprature sensor problem, you would require timer and display. Why don't you think harder and write it down the steps and then we can discuss.

-- Basant

basant
27-09-2013, 06:54 AM
Anon10128,


Hi sir,
Can we use pointers in C programming for 8051? And can we pass any value to interrupt function 8051? Or the variables used in main function will be accessible in interrupt function also?

Thank you.

You can certainly use pointers for C programming for 8051. You can access global variables anywhere in your program, however local variables of a function will not be accessible to other fuctions as stack memory area for different functions will be separated by the compiler. This applies to main function also.

-- Basant

basant
27-09-2013, 07:03 AM
Hi sir,
what is the difference between Normal C and embedded C? I tried to google it out but didnt get satisfactory answer.

.

Embedded C has several language extentions such as new data types, functions etc. for fixed point arithmetic, accessing named address spaces etc. Refer to the following link for details.
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf

-- Basant

basant
27-09-2013, 07:08 AM
Anon10128,


Hi sir,
what is the difference between Normal C and embedded C? I tried to google it out but didnt get satisfactory answer.

In K-map why do we have 11 after 01 but not 10? I feel its because we cannot simplify the k-map if we have 2 bit change in adjacent column or row. Is this correct?
Thank you.

K-map is organized in the form of Gray code i.e. only one bit chages in adjacent entries. This allows to simplify the logic and arrive at canonical form (simplest possible expressions). It is because of gray code representation, in k-map you can't have 2 bit changes. Also refer to the following link for more insight.
http://en.wikipedia.org/wiki/Karnaugh_map

-- Basant

basant
27-09-2013, 07:11 AM
Anon10128,


His sir,
Can we have 10 data lines for a 8 bit micro controller? If yes, How? And can we have more than 16 address lines for 8051?

Thank you.

You can potentially have more than 8 address lines by making use of time multiplexing i.e. first send lower bits of the address and then send higher bits of the address.

-- Basant

anon10128
23-10-2013, 03:00 PM
Hi sir,
Can we pass any value to interrupt service routine when a interrupt occurs?
Thank you.

anon10128
23-10-2013, 03:04 PM
Hi sir,
What about data lines? Can we have 10 data lines for 8051? And can we have more than 16 address lines?
Thank you.

anup
23-10-2013, 06:37 PM
Hi sir,
Can we pass any value to interrupt service routine when a interrupt occurs?
Thank you.

Yes, if you specify the value when registering the Interrupt Service Routine (ISR), no for trying to do this later on. The ISR is called from a global context which does not have a clue about what context you are in.

Thanks,
Anup

anup
23-10-2013, 06:38 PM
Hi sir,
What about data lines? Can we have 10 data lines for 8051? And can we have more than 16 address lines?
Thank you.

These are architecturally fixed and you cannot change these.

Thanks,
Anup