need help.. microprocessor to C++

Discussion in 'Embedded Systems and Microcontrollers' started by s32n87, Apr 1, 2009.

  1. s32n87

    Thread Starter Member

    Apr 1, 2009
    12
    0
    hi guys.. i'm new to micro p and C++ and i'm given a proj to use real time clock on C++ form but using micro p codes.. can some 1 help me?
    thanks in advance...:)
     
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Which uC (microcontroller)?

    The datasheet for the device usually has assembly opcodes, memory layout, etc listed, or a reference to a different app note that does have programming information.

    The C++ compiler needs to be specific to your uC, such as AVR, PIC, Intel, etc. Even then, not all uC's made by those companies are supported by a compiler, especially PICs.

    Finally, most code is written in C, as there isn't usually much memory to work wih, and the functions are pretty straight forward, not needing classes/methods/inheritance and all the other goodies that C++ provides. At the same time, C++ compilers are available, as well as Pascal. C, Basic, and Assembly are the major languages used.
     
  3. s32n87

    Thread Starter Member

    Apr 1, 2009
    12
    0
    thanks for your reply. i just need to show the time and date on the C++ amd using the silicon lab to write the code for my RTC. how should i write the code? because i really have no idea on how to start.. thanks alot.
     
  4. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    I haven't done much with 8051's in quite a while. Mostly dealing with PICs the past 10 years.

    The difference between them rather large, so not everything transfers.

    However, there are some 8051 knowlegeable members here, might want to put that in the title.

    What do you have so far for code? How well can you work with it? Have you made the "Hello World" of uC's (a blinking LED) yet?
     
  5. s32n87

    Thread Starter Member

    Apr 1, 2009
    12
    0
    hmm... i'm still researching cause i really don't know how to start. not even my header file :(
     
  6. Arm_n_Legs

    Active Member

    Mar 7, 2007
    183
    10
    Get a silab chip (example C8051F226) with a SPI (Serial Peripheral Interface) and get a RTC chip with SPI too (example Maxim DS1305). Use SPI programming to program and get time from the RTC chip.
     
  7. s32n87

    Thread Starter Member

    Apr 1, 2009
    12
    0
    thx for the reply. but i'm given a C8051F320-DK how can i write the code? or at least how should i start with the code? thanks alot
     
  8. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    If you are already provided with a dev board, there is no way of knowing what is connected to any of the ports.

    Are you required to work in C++? That actually makes the project harder, rather than easier (the original intent of C++). Standard C is the high level language of choice for microcontrollers, although compilers exist for other languages, C is by far the most commonly seen.
     
  9. Arm_n_Legs

    Active Member

    Mar 7, 2007
    183
    10
    Let me get it right - you are trying to interface the C8051F310 with a RTC chip?

    I suggest you get to familiarise yourself with the following:

    (1) The SPI protocol

    (2) How to do data transfer of the SPI on your F310.

    (3) Understand how to program your RTC chip (say DS1305). Inside the RTC chip is basically a series of registers. Use the SPI to write/read into the registers for time setting/reading.
     
  10. s32n87

    Thread Starter Member

    Apr 1, 2009
    12
    0
    yes i'm required to show the RTC results in the C++ form. i'm really struggling in this.. hahaha. hmm.. the RTC is in the micro p bored, C8051F320. thanks for helping me so much this far.. i'm getting to understand this more and more thanks alot.
     
  11. s32n87

    Thread Starter Member

    Apr 1, 2009
    12
    0
    I am doing the project to make a microcontroller communicate with PC.
    I am facing the problem writing the C++ code for command button to ask uC to display the data in my label.
    How to write the code for C++ to get the data from the microcontroller?

    i'm using a C8051F320-dk which already have a USB connector and a RTC.

    my data will be the date, and time provided from the RTC. please help.

    thanks in advance
     
  12. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Which microcontroller?

    Which C compiler are you using?
     
  13. s32n87

    Thread Starter Member

    Apr 1, 2009
    12
    0
    hmm.. C8051F320-DK.
    visual studio..

    thanks alot
     
Loading...