need help.. microprocessor to C++

Thread Starter

s32n87

Joined Apr 1, 2009
12
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...:)
 

thatoneguy

Joined Feb 19, 2009
6,359
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.
 

Thread Starter

s32n87

Joined Apr 1, 2009
12
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.
 

thatoneguy

Joined Feb 19, 2009
6,359
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?
 

Arm_n_Legs

Joined Mar 7, 2007
186
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.
 

Thread Starter

s32n87

Joined Apr 1, 2009
12
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
 

thatoneguy

Joined Feb 19, 2009
6,359
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.
 

Arm_n_Legs

Joined Mar 7, 2007
186
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.
 

Thread Starter

s32n87

Joined Apr 1, 2009
12
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.
 

Thread Starter

s32n87

Joined Apr 1, 2009
12
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
 
Top