Maker Pro
Maker Pro

8051 source code written with c or c++

T

tico_tech

Jan 1, 1970
0
Hi:
I'm looking for source code of small embedded projects written with c++ or c
for the 8051 microcontroller. I bought this book "an embedded software
primer " from David E. Simon and has lots of code snippets but none for a
real project that can be assembled and tested on a microcontroller.
I'm looking for websites with source I could actually look at without having
to buy the book.
I'm trying to write embedded programs using c or c++. I have written
programs with this language but never for an embedded project. For example,
how the code for making an LED blink at port 0 pin 3 would look like in c++?
Thanks.
 
D

Denis Jeanroy

Jan 1, 1970
0
accessing ports and hardware features can't be done with abstract code.
You have do know what port or special register you want to use, and how to
set them up.
the syntax may vary with compilers.
for example, with a Keil C compiler, toggling a port bit could look like

....
sbit led1 = P2^1; // give a name to P2 bit 1
...

....
led1 = ~led1; // toggle the bit
....



Denis
 
Top