Quote Originally Posted by Chadhammer
I have been playing around with a pair of Pic 16f870 chips. I have a project that I'm working on with some goals in mind. I thought I'd post this as an example t other newbies like myself and hopefully get some critique/feedback how to make my coding better for the learning experience from you good people here. I just a begginner with Pics really . Have too many other projects going on most of the time.

My project: 2 Pics each with a 2x16 LCD and 2 buttons communicate with each other using Hserin and Hserout. When either chip sends a comm the other chip responds for confirmation. It's a starting point.

My goal is to put my message strings in EEPROM, increase the number of message strings and access them with a nested menu system that uses 1 or 2 buttons to send messages back and forth.

I have it bread boarded and working. Any help or ideas to improve my code would be appreciated greatly. I was also wondering If I could use the serial HX/TX with IR instead of wires possibly? I'm using one pair of a cat5 cable now.

Serial TX/RX direct from the chip instead of serin and serout? Sure, why not. Good call using the cat5 cable, at least it has some shielding going for it. Most 'nubs' would use straight hookup wire and wonder why high baud rates don't work.

If you want to try out some simple IR, check out some of the stuff at www.rentron.com, and do a bit of research on the Sony IR protocol for a method of encoding/decoding your bits and bytes. It works well for me for short range, albiet it's a bit slow, but it works.
While you're at Rentron's site, you may as well check out the cheaper RF modules and figure out a scheme for bidirectional comm's between 2 PIC's (i.e. you'll have to figure out some way for the individual PICs to ignore itself while it's transmitting to the other PIC, such as turning off it's own receiver or something along those lines).

JDG

P.S. You're code looks good enough. If you try to streamline it and make it real pretty looking, it might get hard for you to read later on. At least that's my opinion.