Branching out -- I need some help getting started!

So I was thinking about it the other day, and I realized that I really don’t know a whole lot about coding the PIC for other applications. I decided I was going to get a breadboard and a small microcontroller and try messing around on my own.

This, of course, lead to me realizing I had no idea what I was doing, so I sat around and thought…

My high school had a trip to Japan last year, and one of the things we did was build a tiny robot. It essentially amounted to a couple of LEDs, two tiny motors, and some IR sensors. The tiny motors made two little brushes vibrate, which made the robot slowly scoot forward, and then it used the IR sensors to follow a line. If you hit the button on it, it would suddenly become a timer, flashing each light one minute, until all three blinked, and one motor ran, like a tiny alarm clock.

Since they let us keep these “robots”, I realized that I happen to have two (and maybe a few more) PIC16F819 processors sitting around, and a board that I can test it on (the board being the thing I just described). Pictures of the board are here and here. I’m still waiting for my PIC programmer in the mail, but while I was waiting, I looked up a lot of information on the processor.

I was pretty psyched to realize that I understood how the robot worked, and that I also got pretty much how the code would be written, but I still don’t know where to start actually writing it. The mcc18 compiler says that it is compatible in the readme, but I don’t have p16f819.h Will I have to code this in assembly? Or is there some kind of C interpreter?

Thanks!

I think if you re-read that readme you will find that the assembler is compatible. The C18 compiler is only for the PIC18 family.

You need a different compiler to program the PIC16 in C.

Regards,

Mike

Well, if you’re trying to branch out, you might want to try bra, bnz, bnov, bnc, bnn, bov…

Uhhhh… perhaps a few definitions for those abbrv.s?

they’re conditional branch instructions.

assembly language stuff.

I got a chuckle out of the post!

There is a free C compiler called CC5X that has an 16F819.H file so you may be able to use it. You can do an internet search on CC5X to find it.

Also do a search on PICList and subscribe to it. When I last subscribed several years ago there was a VERY active community of PICers that would answer any question you had.

Good luck, but be warned, this stuff is VERY addictive!

Adam