Welcome to the VirtuQ Forums.
Results 1 to 13 of 13

Thread: 8051 c program

  1. #1

    8051 c program

    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.

  2. #2
    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.

  3. #3
    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.

  4. #4
    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.

  5. #5
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Anon10128,

    Quote Originally Posted by anon10128 View Post
    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

  6. #6
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Anon10128,

    Quote Originally Posted by anon10128 View Post
    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

  7. #7
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Quote Originally Posted by anon10128 View Post
    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/wg...docs/n1169.pdf

    -- Basant

  8. #8
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Anon10128,

    Quote Originally Posted by anon10128 View Post
    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

  9. #9
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Anon10128,

    Quote Originally Posted by anon10128 View Post
    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

  10. #10
    Hi sir,
    Can we pass any value to interrupt service routine when a interrupt occurs?
    Thank you.

  11. #11
    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.

  12. #12
    VirtuQ™ Moderator
    Join Date
    Jul 2011
    Location
    Bangalore, India
    Posts
    1,044
    Blog Entries
    2
    Quote Originally Posted by anon10128 View Post
    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

  13. #13
    VirtuQ™ Moderator
    Join Date
    Jul 2011
    Location
    Bangalore, India
    Posts
    1,044
    Blog Entries
    2
    Quote Originally Posted by anon10128 View Post
    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


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •