Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Programming with C++ - controlling the PORTs / TRIS

Status
Not open for further replies.

elecTronX

Junior Member level 3
Joined
Oct 21, 2003
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
271
Programming with C++

Hello ALL,

I am fairly new to PIC programming and currently taking a C++ course. I would love to use C++ to program PICs rather than basic. However, I do not know how to control the PORTs like PicBasic. Or how to control the TRIS. How would one go about learning this basic task? Is there a web site or any books up for referral that anyone can refer for easy reading and fast learning? I am interested to dive right in and get the pure understanding of how to fuse C++ with PIC programming of MCU so please feel welcome to leave any advice you deem pertinent to the topic.

Thank you all in advance for your warm welcome and informative feedback to my inquiry.
 

Just use C for PIC's. Use HiTech or CCS compiler and mplab. C++ is realy designed for very large software programs where memory is not a big problem.
 

Re: Programming with C++

Yes, you should use C and not C++.
A quick but pretty good reference for C can be found here:
**broken link removed**

Examples can be found here:
https://www.microchipc.com/sourcecode/

Antharax
 

Re: Programming with C++

If you find C++ more familiar to you then you might find useful to learn object oriented programming techniques in C.

I have attached the book Object Oriented Programming With C that contains that info.


Regard, mikasi
 

Re: Programming with C++

Antharax said:
A quick but pretty good reference for C can be found here:
**broken link removed**
The link is dead.


Here's the links for CCS C compiler: https://ccsinfo.com/picc.shtml and Hi-Tech C compiler: https://htsoft.com/

CCS is the easiest to use, especially for a beginner, it have built-in CodeWizard which helps you get started in no time with your projects.
 

Re: Programming with C++

Think twice before you try Object Oriented Programming on a uC!
With object oriented programming (and basically with every malloc you do in normal C) you should take special care about the memory management!!!
It might seem easy to use at first but looking for errors concerning memory allocation (memory leaks, ...), which will occur at runtime, might be extremely difficult on an embedded system!

Just be very carefull with creating objects!
I don't think it's something you should start with when you're an unexperience programmer.

Antharax
 

Re: Programming with C++

I have taking in all the wonderful advice that you guys have been forward with, THANK YOU ALL VERY MUCH!! I hope other members will also benefit from this posting in the future.

I have been looking at books stores for a starter book specifically on PICs and C++ or C for beginners - any suggestions? Do you guys remember what you read when you started. I will use all this information simultaneously as I grow: the sites you provided, and the book that was posted too! Let me know and once again I am grateful for the wealth of knowledge and extremely appreciative. Thanks
!!!
 

The best way to learn is to do it. Get a project, get an icd for the pic and write the program.
Solving the problems you face will teach you more than any book on pic's.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top