need a pic basic program


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Mar 2014
    Location
    Pakistan
    Posts
    19

    Default need a pic basic program

    hello everyone
    I need this simple program please someone help me,
    I have b.0 as inputpin and b.1 as output ,
    I want if input increases then output volt which is 5 volt dc should decrease with 1:1 relation but reverse order,for example if my input is
    0 percent then output should be 100 percent and if
    input is 10 %then output should be 90 %
    if input is 55 %then output should be 45 %
    i hope i have explained my requirement clearly ,thanks

  2. #2
    Join Date
    Dec 2004
    Location
    USA
    Posts
    36


    Did you find this post helpful? Yes | No

    Default Re: need a pic basic program

    And how much will you pay the first person who does this work for you?

  3. #3
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: need a pic basic program

    I think you've explained it quite clearly.

    First, you need to go to the Microchip site and download the datasheet for the specific chip you're using. Read through it noting what registers if any need to be set for the chip to work.

    I'd then recommend you search this forum for simple programs to blink and LED on pin b.1 to ensure you're communicating with the chip.

    Then, search this forum for PWM, Pulse Width Modulation, and use those posts to write your own code.

    Once that's done post your code and your schematic along with chip number, PBP version and most everyone here will help you to "fix" your errors.

    I look forward to hearing from you.

  4. #4
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    159


    Did you find this post helpful? Yes | No

    Default Re: need a pic basic program

    Quote Originally Posted by AvionicsMaster1 View Post
    I think you've explained it quite clearly.

    First, you need to go to the Microchip site and download the datasheet for the specific chip you're using. Read through it noting what registers if any need to be set for the chip to work.

    I'd then recommend you search this forum for simple programs to blink and LED on pin b.1 to ensure you're communicating with the chip.

    Then, search this forum for PWM, Pulse Width Modulation, and use those posts to write your own code.

    Once that's done post your code and your schematic along with chip number, PBP version and most everyone here will help you to "fix" your errors.

    I look forward to hearing from you.
    Isn't it funny how people seem to think we all having NOTHING to do of our own, but are just waiting to create their 'dream device' for them for nothing. Heck, I have enough problems creating my own, let alone someone else's!
    "I have noticed that even those who assert that everything is predestined and that
    we can change nothing about it still look both ways before they cross the street"


    -Stephen Hawking

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: need a pic basic program

    Just out of curiosity, can't this be done using discrete chips alone?

    if input increases then output volt which is 5 volt dc should decrease with 1:1 relation but reverse order
    I've only dabbled with gates, transistors and amplifiers; but can't they do this very well?

    Robert

  6. #6
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: need a pic basic program

    Absolutely, Robert. But that would not be the point of the school project, would it?

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: need a pic basic program

    everyone assumes the input is a pwm stream ,if so what frequency . what if the input is actually an analog level ?
    ditto for the output. there not enough info in this question

  8. #8
    Join Date
    Mar 2014
    Location
    Pakistan
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: need a pic basic program

    well i am a student and cant pay anything ,i have to build a project as assighnment ,i have to build a triac and microchip based voltage stablizer, i have a transformer with 0-150-250 volts loops and a triac drives the 150 loop of transformer ,an optocoupler drives the triac ,its input is 0 to 1 volt dc which will be controlled by pic 16f72 outputpin and another inputpin of 16f72 which is attached with transformer's 250 loop which is also a output of stablizer voltage ,it ia attached through a optocoupler ,when voltage will vary from 150 to 250 then microcontroller and triac will adjust is to 220 volt ,I have done all work with electronics circuit the only missing thing is a programm , the only thing i know is how to blink a led with microcontroller , can someone tell me how to use pwm to build my project ,thanks in advance

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: need a pic basic program

    simple pwm is not what you want for a triac regulator , search this forum for light dimmer projects , one of them should give you some ideas

  10. #10


    Did you find this post helpful? Yes | No

    Default Re: need a pic basic program

    Phase control with feedback has several hardware/software functions that must work together.
    I break down each function to its own operation and write the program so each function can be tested separately.... then the main program brings the functions together.
    For Phase control you may need.....
    -zero cross detector circuit and software (requires interrupts by microprocessor)
    -Triac drive function ckt/routine , pulsed or timed pulse for inductive loads (inductive loads can 'bounce triac off at wrong time if gate not held on)
    - voltage feedback ckt/routines.....takes some smoothing hardware to get reasonable DC level from the AC voltage.
    - a main program loop to combine all the functions, control/on/off, adjust parameters, check and handle errors etc.
    Breaking projects down to testable individual parts has been the easiest method to make working stuff for me.
    don

  11. #11


    Did you find this post helpful? Yes | No

    Default Re: need a pic basic program

    Sounds like you need to find a late model Chevrolet throttle position sensor and call it a day!

    So...
    i don't know if this is the case (I'm actually a lil curious...) Is 5v output as PWM a straight % based on dutycycle? For instance...
    5v output @ 50% dutycycle = 2.5v?

    cuz if so then set

    HPWM dutycycle = ((5-ADCIN0)/5)*255

    and ur straight....

    Subtract INPUT from 5 to get the inverse
    Divide by 5 to get the percentage output you want
    multiply the % by 255 because dutycycle is set 0-255

    of course, if 50% dutycycle <> 50% voltage, I just wasted the last 7 minutes of my life...

Similar Threads

  1. serial interface pic 18f452 using pic basic pro
    By syed ahmed in forum Serial
    Replies: 0
    Last Post: - 16th May 2010, 05:46
  2. Transfer Program PIC to PIC
    By kelip2 in forum USB
    Replies: 0
    Last Post: - 14th April 2010, 14:12
  3. PIC BASIC or PIC BASIC PRO
    By kirkmans in forum USB
    Replies: 3
    Last Post: - 20th April 2007, 00:52
  4. HEX to Basic or any workage program
    By assouad in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd April 2007, 14:38
  5. Replies: 5
    Last Post: - 17th January 2006, 19:26

Members who have read this thread : 1

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