Can any one here program code for PIC?

  • Thread starter pickerguy
  • Start date
  • #1
12
0

Main Question or Discussion Point

having issues with programming, can some one help me write a code for a push button hobby servo control?
 

Answers and Replies

  • #3
12
0
I just dont get it. ive looked at other codes and tried to compare the data sheet with the written code and i dont get it
 
  • #5
11,687
5,256
what is confusing you? is the bitwise usage in the program where bits are analyzed to determine if the buttons been pressed?
 
  • #6
1,069
29
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:

Related Threads on Can any one here program code for PIC?

Replies
7
Views
854
Replies
1
Views
2K
  • Last Post
Replies
21
Views
4K
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
2
Views
549
Replies
2
Views
5K
Replies
1
Views
2K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
5
Views
2K
  • Last Post
Replies
5
Views
2K
Top