Can any one here program code for PIC?

  • Thread starter Thread starter pickerguy
  • Start date Start date
  • Tags Tags
    Code Program
AI Thread Summary
The discussion centers on programming a PIC microcontroller for a push button hobby servo control, with users expressing confusion over existing code examples. A suggestion is made to use simple C programming instead of assembly language, as it can reduce complexity and errors. Resources like the book "Programming Robot Controllers" by Predko are recommended for learning C programming, though caution is advised due to potential typos. Users are warned that seeking help on forums may lead to negative responses if C programming is mentioned over assembly language. Overall, using straightforward C code can simplify the programming process for PIC microcontrollers.
pickerguy
Messages
12
Reaction score
0
having issues with programming, can some one help me write a code for a push button hobby servo control?
 
Technology news on Phys.org
I just don't get it. I've looked at other codes and tried to compare the data sheet with the written code and i don't get it
 
what is confusing you? is the bitwise usage in the program where bits are analyzed to determine if the buttons been pressed?
 
If you are not required to use assembly language for your project then there are free C compilers available for download that will generate binary for the PIC processors.

If you write very simple straight forward code in C, not arrays of structs of pointers to etc, etc, etc, but just simple statements that copy bytes from ports to variables, do simple 8 bit add, subtract, compare, etc, copy bytes from variables to ports, do simple loops for timing and things like that then the compilers do a fair job creating code. And you might make fewer silly errors by not understanding one assembly instruction or another.

There is a decent book called Programming Robot Controllers by Predko that can introduce you to C programming with the PIC. He sometimes has typos in some of his books and that can make it hard for new users, so watch out. And there are lots of versions of the compilers and the PIC development tools and the PIC toasting tools which can be frustrating to figure out how to get them all to talk to each other.

But if you just need to do a little simple programming then this might be an option. Often a single line of C code can replace 2-6 lines of assembly code and possibly be more understandable to you. Toy programs can be a half dozen line C program instead of half a page of assembly. Even more complicated projects can be a page of C code instead of half a dozen pages of assembly. With practice you can hold a page of good C code in your head and study it to make sure it is all correct. That is much more difficult to do with half a dozen pages of assembly, often with a comment on almost every line just to keep track of what it is doing.

It has been years since I did something like this, so make sure this information is still correct.

You should also be warned that if you wander into many of the web forums that talk about the PIC and you ask any question about using a C compiler or C programming instead of doing everything in bare assembly code that you will get no help and often just insults because you aren't using their language their way. Buyer beware.
 
Last edited:
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top