Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

New to programming, trying to accomplish the following

Status
Not open for further replies.

crazylegsmurphy

New Member
Hey All,

I just got my PICKit 2 starter kit and have been reading over as much stuff as I can, but I'm pretty new to all this and so I'm getting quite stuck. I had someone who seemed willing to help, but they flaked out, so I'm back to square one.

I'm looking for some help to get this project going. I don't really want someone to program it all for me as I want to learn, but I am willing to compensate anyone who feels like putting in a legit effort to get things going.

With that said, here is what I am trying to do.

I need to program three PIC's (16F690).

The following is a document that someone was helping me with, but no longer has the time.

IR Communications:


Using USART in Asynch mode, with an IR modulation frequency that is a multiple of the bitrate, 2 bytes are to be sent from the lower end of the chain of command upward: One byte will tell the receiving device to listen for the next byte (To avoid false-positives in transmission). The slave devices will each send a specific code to the next highest in command. For a practical example, the Lower Slave will first send the handshake code (10100101, or 0xA5) to tell the next higher device that it will be sending, then it's own device code (e.g. 00110101, or 0x35). If the highest chain of command receives the next bit out-of-order, it's parsing routine will ignore it. This will make the system avoid spontaneous synchronous transmissions, which would confuse the system. The Middle Slave device and master device would both receive the signal if in range, but the device code would cause only the Middle Slave to act on the signal. The middle slave, upon receiving the Lower Slave's device code, would transmit it's own device code after the handshake (e.g. 01110101, or 0x75).

After each device has transmitted it's code, it will wait for a predetermined amount of time for an Acknowledge code (Also device-specific) to be sent from it's next-in-command. Upon receiving the acknowledgement code, the device waits for the Master code to start the lighting routine.

The master device needs only to receive the Middle Slave's code and transmit a Master code.


Lower Slave:

Timeline of activities:
Transmit Handshake -> Transmit Device Code -> Wait .5s for Middle Slave and Master communication -> Back to Transmit Handshake

Middle Slave:

Timeline:
Wait for Lower Slave Handshake & Device Code -> Transmit Handshake -> Transmit Device Code -> Wait .5s for Master Signal -> Back to Wait for Lower Slave HS & DC

Basically, I need the three devices to communicated with each other so they know when each device is present.

From there, I need to write code to allow the devices to turn on up to 5 LED's/Bulbs. When all three devices are present, the lights will turn on, and then randomly fade from light to dim.

Once the devices are brought away from each other, the lights fade out and turn off.

So that is what I am basically trying to do. I am willing to put in as much time as possible to get it working, but I really need some solid direction and help so I'm actually working towards the right goals and not just puttering around.

Thanks!

Jeff
 
You should first try some simpler projects to get some experience in PICs.

I suppose I'll get this out of the way right now as well. THIS is the project I'm trying to get done. So I mean no offense to anyone, but unless you have something to help me out, then please don't clog up this thread with "You should 's"

I get what you're saying, but I have a specific project in mind, and I don't really want to spend the next 6 months making LED's flash on my PICKit board.
 
It would be easier to help if you ask specific questions on something that you are stuck on. What are you having a problem with?

Edit to add: I only saw your next reply after I posted. If you don't want to flash LED's and stuff for the next few months, rather hire a company to do the work for you.
 
Last edited:
Well, specifically....

What I need help with is breaking down the code into sections I can work through. For example say this project needed the following:

(Master)

- PIC Information (_config, etc)
- IR TX Send (Master)
- IR RX Receive (Master)
- LED's ON
- LED's Randomize


(Slave 1)

- PIC Information (_config, etc)
- IR TX Send
- IR RX Receive
- LED's ON
- LED's Randomize

If that makes sense....

I need help breaking this project down into workable sections. Then from there, any help as far as examples, or things to read up on, or things to look out for would be great.

As I said before, I don't expect anyone to sit down and code it for me, but I have some money in the budget for someone willing to walk me through the steps and keep me in the right direction. I guess I can't ask anything more specific at this point because I'm not really that far.
 
Edit to add: I only saw your next reply after I posted. If you don't want to flash LED's and stuff for the next few months, rather hire a company to do the work for you.

I realize I'm sounding a tad like a jerk here, but you have to understand I have been working on this project 8 hours + a day now for almost a month. I have been posting on many forums and I am finding it a tad trying when a bunch of people come into the threads and spend all their time reminding me of what I don't know.

I'm really at the point where I need people to be proactive with this project.

Have you worked through the "basics?"

I have done the best I can. I have read a lot of material, tried to work through a lot of tutorials but because my PIC isn't what they're using in the tutorials many times it comes to a dead stop because it simply won't work.

So far, I'm at the point where I have a pretty ok understanding of how things are supposed to work, but because I don't have any documentation specifically to my chip, or what I'm doing, I only really have random success.

But as I said before, I'm willing to put in as much work as needed to get this thing working, but I need direction because I'm wasting so much time reading stuff that simply isn't relevant.
 
Do some tutorials first, just sitting around waiting for people to help is not going to take you very far. Once you have a better idea of how PIC's work you should be able to figure all of that out.

I "flashed LED's" for a good few months while figuring out the datasheets and assembler.... there is just no other way.. have fun!
 
"So far, I'm at the point where I have a pretty ok understanding of how things are supposed to work, but because I don't have any documentation specifically to my chip, or what I'm doing, I only really have random success."

Does microchip not have a datasheet for your PIC? 90% of the thing it tried when I started did not work the first time, or sometimes the 100th time, but with enough effort you will get it right... I love that feeling when something starts working that took me 2 weeks to figure out!
 
Does microchip not have a datasheet for your PIC? 90% of the thing it tried when I started did not work the first time, or sometimes the 100th time, but with enough effort you will get it right... I love that feeling when something starts working that took me 2 weeks to figure out!

Yup, and I have it printed out and on my desk. I have read it over cover to cover...but the problem is....

Well, you see I learn best when I have a project...a goal in mind. It's like say I wanted to make a cake and someone said, "you have to spend two weeks cracking eggs". I simply don't learn that way.

I have been blinking lights, turning them off and on, making them go random...for days now, but I'm not really learning all that much because I need something to work towards. This project is very important to me, and I am sure I can get it done, but I need some help getting pointed in the right direction. Again, that is also why I am offering some cash to the person who really puts forth an effort to help as I realize just helping for the sake of helping can suck sometimes when it's something this grand.
 
Last edited:
I'll also put this question out there....

Based on what I have put...what would you (you being whoever is reading this) charge to simply program it for me?
 
What you should really do is try to get each of the things working separately. For example first figure out how to fade a LED.Then try to get the UART to communicate with a PC. Then build a circuit that will transmit the right signal for the IR module to detect.That means like making a LED flash or turn on on its output.Then join these two and try to talk to the PC over this IR link, then try to put a PIC on the other side. And then finally merge this with the LED fading and you got a finished project.

I could help you a bit if you add me on MSN.
 
What you should really do is try to get each of the things working separately.

Exactly. I need to break down this project in to "chunks" to work on...but I need your guys' help to break it down. It's like I know what I want it to do, and the basic idea of how to do it, but I need to "Reverse engineer" the ideas to I can do one thing at a time.

That's where I need your help.

If you guys can help by say going, Ok...lets work on the flashing LED's for now.

Then I can pour my time into working on that....then once I get that working, move onto the next thing.
 
Yeah i suggest that too. I guess PWM is the easiest to do from all of those. When that is done i guess it would be time for UART.
 
According to the datasheet ya...

And I found this a few days ago.

PIC PWM Calculator & Code Generator

EDIT: Keep in mind...I'm not "married" to any one chip. The 16F690 was simply the one that came with the PICKit 2. If you guys think there is a better chip for the task feel free to suggest it. From what I gather though, the one I have will work pretty good. I was going to order a few more, but was waiting to see what everyone thought.
 
Last edited:
Murph',

Do you have a development language preference at this point Sir?

Mike


Hey Mike,

Not at all. I have been working in MPLAB (which is assembler I think), but I don't really care one way or the other. I have pretty good knowledge of CSS/HTML/ASP/PHP, so to me BASIC looked a lot more familiar with the language, but no...I'm pretty open to anything at this point.

Whatever is most fun and gets the job done is cool with me.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top