How do I program a pic to accept inputs?


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2012
    Posts
    9

    Default How do I program a pic to accept inputs?

    I am planning of using a 16F88 to control my future 3D printer I am working on. This is a projection type of 3d printer and it's controlled by a pic that in general the Arduino is used. I want to use the pics I am learning now (16Fxxx) and I have no idea of how to communicate with it after the pic is programmed and soldered on board. In other words, every object to be printed varies the projection time, the thickness of the cut and some other parameters that needs to be input before the pic takes control of that printing. What I really need is an example program that leads me of how to do those inputs before every printing take place. I am sure that someone of you has tried it before. Please help me learn about it. Thanks.

  2. #2
    Join Date
    Oct 2012
    Location
    Philadelphia Metro, PA
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Re: How do I program a pic to accept inputs?

    Would you be talking about a (for simplicity) ports or "pins" that are dual direction, AKA bidirectional?

    I'll look for some articles. I just dont know off the top of my head, although I do know that you would need to build within your code instructions to flip from output to input. That being said, some external circuitry would be needed as for if you have a wigit connected to a specific pin, such as an LED, and you flip that output to an input that input signal could possibly interfere with the device connected.

    -OR-

    Are you simply looking for a interface to communicate with the device to send it instructions? That can be accomplished with a serial connection, (pins 8-RX and 11-TX) or you could get really fancy with a USB interface. Either way requires SERIN SEROUT commands and code plus much more to make this happen.

    -OR- (Not recommended, really)

    You could (and Im only throwing this out there, I would not suggest it) build your circuit with the In-circuit Serial Programming (ICSP) connection point.... Although this should be added anyway to fix bugs and creepies that come up in the code AFTER you have soldered it in place (and it happens, A LOT) but again I would not go this route to send the uC instructions for your printer, ONLY for ease of changing code for fixes/improvements. It's worth the 50 cents in lieu of de-soldering the chip.

  3. #3
    Join Date
    Nov 2012
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: How do I program a pic to accept inputs?

    Hi, thank you Electromark for your time and your answer. I probably did not explain my self clear enough. I apology my English is not the best, it's my second language. Anyway, let me put it this way: you buy let say a coffee maker. First time you use it you must key in the time; when you want it to star brewing the coffee every morning; how do you like the coffee, light or bold and few other things. All of these instructions I supposed goes into the data eeprom or somewhere like that and the processor read these instructions and follow these every day until they are changed. I understand I'll need some extra electronics to do the job but that is part of learning this process. Only I need is someone that had that experience and lead me to books or places or his own knowledge on how to be able to accomplish this. Thanks a lot.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: How do I program a pic to accept inputs?

    Seems like you just answered your own question... Do you need help with reading and writing to the EEPROM?
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Nov 2012
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: How do I program a pic to accept inputs?

    Ok, that's a good start point! But any where to go on line? Any good book, Any program that does something alike. Thanks.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: How do I program a pic to accept inputs?

    This page has links to examples for using the internal EEPROM and for using an external via I2C.
    Depending on the amount of data you need to store and the frequency will probably determine if you use an internal or external solution.

    I will suggest starting with the internal for practice.
    http://melabs.com/samples/PBP-mixed/ee.htm
    and
    http://melabs.com/samples/PBP-mixed/eeword.htm

    Once the examples are working then add an input button. Try increasing the data stored at a location by 1 every time the button is pressed.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Nov 2012
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: How do I program a pic to accept inputs?

    Thank you Mackrackit, now I can get the taste of it. I also have found some other examples and I think that that's the way to go. I'll report back. Thanks to all of you!

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: How do I program a pic to accept inputs?

    I would ask you what your expectations are for your controller to do. Do you want it to interpret G code, or do you only expect it to act as a stepper motor controller/interpreter under the control of Mach III or similar?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  9. #9
    Join Date
    Nov 2012
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: How do I program a pic to accept inputs?

    No, I think that once I have the control program burned on the Pic it will control the projector and the stepper motor with pulses from within. The projector will need a digital pulse to advance the slide show for a number of milliseconds and the controller will count the slides to 0 and stop. The stepper motor will control the thickness of every slice and keep the resin in motion. I wanted to write the initial numbers at the eeprom en case the power is lost the program will read the number of slices and subtract a unit every time it read it and remember the thickness also. One print will take hours to make and you don't want to trash an almost finished part because of power failure. The program will have that contingency on it. I think the rest will be very easy once I finished the programming and test it for bugs. Thanks

Similar Threads

  1. Single PIC to Blink 5 LEDs Independently?
    By RossWaddell in forum mel PIC BASIC Pro
    Replies: 68
    Last Post: - 18th July 2015, 16:56
  2. Replies: 7
    Last Post: - 20th November 2012, 19:41
  3. Which pic? up to date basic chip for 16f877
    By tasmod in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 19th November 2012, 11:26
  4. How not to prototype your next PIC project
    By SteveB in forum General
    Replies: 3
    Last Post: - 12th November 2012, 09:35
  5. PortA as Inputs in PIC16F628A program
    By JackBauer2424 in forum mel PIC BASIC
    Replies: 12
    Last Post: - 1st June 2006, 08:34

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts