closing tag is in template navbar
timefactors watches



TZ-UK Fundraiser
Results 1 to 14 of 14

Thread: PIC programming

  1. #1
    Craftsman
    Join Date
    Nov 2015
    Location
    West Midlands
    Posts
    630

    PIC programming

    I have a few projects that I want to make on a budget, I am happy programming PLCs in ladder but have never touched a PIC. They do seem to offer some reasonable versatility and the cost is pennies. My questions are who here has experience I’d them? Is there an easy way to program them or can ladder be converted easily? How to assign I/O? I have one PIC that I purchased online, it is programmed already but I want to modify it, in ladder it would be a single line of code, in PIC I have noooooo idea.

    Any suggestions?

  2. #2
    Master reggie747's Avatar
    Join Date
    Oct 2013
    Location
    The Mersey Riviera
    Posts
    7,208
    Quote Originally Posted by Mrbarry View Post

    Any suggestions?
    Yeah, ask on a computer forum !!

  3. #3
    Craftsman
    Join Date
    Nov 2015
    Location
    West Midlands
    Posts
    630
    Most helpful. Thank you.

  4. #4
    We programme about 3000 microchip devices a day, are you after writing the program or blowing the device?

  5. #5
    Craftsman
    Join Date
    Nov 2015
    Location
    West Midlands
    Posts
    630
    I have an existing device. It’s a PIC18323 and is programmed to do one of two things when I lower the roof of my car, it gets inputs from the roof switches and as the windows drop and it sees the roof has been latched either fully up, or fully down, it then uses pins 5 or 7 ,and 8 or 9 to either lower or raise the windows by using a three second timer to those pins.
    What I want to do is add code so a double click of the up button will trigger pins 5 and 7 on the same three second timer to auto close the windows, the car has no auto up as standard only auto down. The device does monitor the switches so this would be a simple code issue no hardware changes needed.

    Also, I am trying to decide if I connect both pins 5 and 9 to the raise termination of the window switch will the back feed damage the IC. It’s designed to open via pin 9 close via pin 5 but I don’t wish it to be able to open the windows, only close them.
    Thanks.

  6. #6
    Craftsman
    Join Date
    Nov 2015
    Location
    West Midlands
    Posts
    630
    Ok I have found that the IC has open drain outputs so there is no detriment to using them in pairs or connected together.
    Just need to find out about coding now but truth be told I think that’s going to come to a dead end.
    Thanks again.

  7. #7
    Master petethegeek's Avatar
    Join Date
    Jul 2011
    Location
    Worcestershire
    Posts
    2,932
    A little while back I did something similar for a friend who was restoring an old classic (as he described it) lorry. He was looking for a simple controller to drive a bar of flashing orange hazard/warning lights he had mounted on the cab.

    I can't recall offhand exactly which microcontroller I used, but it was an eight bit flash programmable one from Microchip's Atmel ATtiny family.

    Quote Originally Posted by Mrbarry View Post
    What I want to do is add code...
    I'm still a little confused over how you are expecting to be able to program (or modify) the 16F18323. Are you planning to (re)write the program and upload it, or hoping to somehow modify the code/device in situ? (In either case do you have access to the source code?)

    There are a number of tools and utilities which are freely available to program these types of microcontrollers, not least from Microchip themselves, eg https://www.microchip.com/design-cen...et-started-now

    Quote Originally Posted by reggie747 View Post
    Quote Originally Posted by Mrbarry View Post
    Any suggestions?
    Yeah, ask on a computer forum !!
    I'm sure you are making enquiries in various other places as well, but I'll just concur with reggie747's advice, eg https://www.microchip.com/forums/f516.aspx

  8. #8
    Craftsman
    Join Date
    Nov 2015
    Location
    West Midlands
    Posts
    630
    I was planning to upload the program from the IC and modify it, then download back to it with the extra code. I know I would have to but the interface hardware but it’s something I would be using more than once so that’s fine, and I like tinkering, it’s just what I enjoy.
    The problem here is it seems to be basically ‘C’ and I can’t program it, ladder and logic etc yes, but ‘C’ is another storey.

    I did a bit of searching about the processor and found the links you posted. Think I’m just going to do it the easy way and use preprogrammed controllers and select the operations I want from them. Shame, I would have enjoyed the versatility they offer.

    Thanks for the reply’s 👍

  9. #9
    Modifying the code without having the source code will probably be very difficult unless you are very lucky and the existing device is unlocked, you could try reading it with a picmate

  10. #10
    Master petethegeek's Avatar
    Join Date
    Jul 2011
    Location
    Worcestershire
    Posts
    2,932
    Quote Originally Posted by Mrbarry View Post
    I was planning to upload the program from the IC and modify it, then download back to it with the extra code.
    Unfortunately this approach isn't really feasible. You are almost certainly correct in assuming that the program has been written in something like C, which will then have been compiled into the native instruction set for the microcontroller you are going to use. (As Adrian has already pointed out whilst I was typing this.)

    However if what you are looking for is a gentle introduction into the C programming language, along with implementing it on programmable microcontrollers, then you could do a lot worse than checking out the readily available and relatively inexpensive arduino products.

  11. #11
    Quote Originally Posted by petethegeek View Post
    Unfortunately this approach isn't really feasible. You are almost certainly correct in assuming that the program has been written in something like C, which will then have been compiled into the native instruction set for the microcontroller you are going to use. (As Adrian has already pointed out whilst I was typing this.)

    However if what you are looking for is a gentle introduction into the C programming language, along with implementing it on programmable microcontrollers, then you could do a lot worse than checking out the readily available and relatively inexpensive arduino products.
    My test guys love them, very quick and easy

  12. #12
    Craftsman
    Join Date
    Nov 2015
    Location
    West Midlands
    Posts
    630
    Looks interesting, I’m going to do further reading. I am under no illusions though, it’s not easy and if I don’t dedicate my self to it I won’t learn enough to be competent, and truth be told I don’t have that sort of time/dedication. I do have time to play a bit.
    Thanks again for the replies.

  13. #13
    Journeyman
    Join Date
    Jun 2020
    Location
    USA/NY
    Posts
    61
    Quote Originally Posted by Mrbarry View Post
    I have an existing device. It’s a PIC18323 and is programmed to do one of two things when I lower the roof of my car, it gets inputs from the roof switches and as the windows drop and it sees the roof has been latched either fully up, or fully down, it then uses pins 5 or 7 ,and 8 or 9 to either lower or raise the windows by using a three second timer to those pins.
    What I want to do is add code so a double click of the up button will trigger pins 5 and 7 on the same three second timer to auto close the windows, the car has no auto up as standard only auto down. The device does monitor the switches so this would be a simple code issue no hardware changes needed.
    I recall how crucial it was for me to learn about the Ruby programming language and how crucial it was for me to comprehend cookies. After I found all this knowledge at cookie exists in the ruby I can now recommend it to many people. I sincerely hope I was able to assist you, as it was quite beneficial. I wish you the best of luck.
    Also, I am trying to decide if I connect both pins 5 and 9 to the raise termination of the window switch will the back feed damage the IC. It’s designed to open via pin 9 close via pin 5 but I don’t wish it to be able to open the windows, only close them.
    Thanks.
    I should have just reconfigured, that's all.
    Last edited by bobocat; 27th March 2023 at 05:25.

  14. #14
    Master
    Join Date
    Jan 2010
    Location
    Coming Straight Outer Trumpton
    Posts
    9,385
    Quote Originally Posted by bobocat View Post
    I should have just reconfigured, that's all.
    Have you ever posted something helpful that wasn’t a bump of a years old dead thread, or even acknowledged that that’s all you post?

Posting Permissions

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

Do Not Sell My Personal Information