587,481 active members*
3,083 visitors online*
Register for free
Login
Page 1 of 2 12
Results 1 to 20 of 28
  1. #1
    Join Date
    Apr 2005
    Posts
    462

    any pic experts?

    I am using PIC16F628. Why do I get around 1V on RB04 and 5.5V on all other RBs? I am using RAs for step and dir inputs, RB0-3 for X axis and RB4-7 for Y axis and my Y axis is playing up because of the missing step on RB4. And I tracked it down to a 1V output on RB4. I cannot find anything in the documentation as far as RB4 is concerned (like for example RA0-4 being analogue as well as digital inputs, software settable or something similar)

    I know what a burnt 16F628 looks like (i.e. - totally dead!) so I doubt I could've fried just a single output pin (RB4). Any ideas anyone before I go out and buy another PIC?

  2. #2
    Join Date
    Apr 2005
    Posts
    462
    Oh, and BTW this is my controller/driver combo. I am a computer person by trade and in my line of work you learn to split things into manageable chunks or modules. Since I am new to electronics maybe what I have done is silly when it could've all been done on a single PCB but I thought splitting it all up makes it more manageable and easier to troubleshoot. Please feel free to slag my "design" off as much as you like. I am still learning. :withstupi

    P.S. Transistors used are TIP122/BD901 and not TIP120 as per picture.
    Attached Thumbnails Attached Thumbnails driver.png   controller.png  

  3. #3
    Join Date
    Apr 2005
    Posts
    462
    Would you kind electronic gurus please look at these and perhaps suggest what needs to be added to this setup (capacitors, diodes, transistors, tetrion field emitters, multiphasic discombobulators, etc...) so it looks like something a sane person might have "designed". Thanks! :wee:

  4. #4
    Join Date
    Apr 2004
    Posts
    733
    Well I've burned out plenty of single pin i/o on PIC microcontrollers over the years. The rest of the chip would work just fine. I mark them as bad and use the chips for projects that don't require the dead i/o pin.

    Do you have a schematic of the circuit? To hard to see how the PIC is hooked up from your two posted images.

    If you can still program and do a flash memory verify, that means the chip is partially working.

    Jim

  5. #5
    Join Date
    Apr 2003
    Posts
    361
    RB4 is the low voltage programming pin.
    To ensure proper use as I/O pin, your configuration bits (LVP bit) must be programmed correctly (i.e., LVP Disabled).

    I would also add current limiting resistors between the PIC pins and the transistor base as well as decoupling capacitor near each PIC (0.1uF). Also add a diode between the transistor common/emitter pins.

    PIC are spec for 5V, wondering why you're getting 5.5V on the pins.

    Something similar with what you're doing is here http://www.dakeng.com/u2.html
    Stupid questions make me smarter...
    See how smart I've become at www.9w2bsr.com ;-P

  6. #6
    Join Date
    Jun 2003
    Posts
    3312
    If they were AVR's I could help some, but not PIC's. Why the bipolar transistors, and not MOSFET's?

    Phil
    Phil, Still too many interests, too many projects, and not enough time!!!!!!!!
    Vist my websites - http://pminmo.com & http://millpcbs.com

  7. #7
    Join Date
    Apr 2005
    Posts
    462
    Quote Originally Posted by abasir
    RB4 is the low voltage programming pin.
    To ensure proper use as I/O pin, your configuration bits (LVP bit) must be programmed correctly (i.e., LVP Disabled).
    I thought having read the PIC pdf that LVP disabled is only used if you're using RB4 for input. But I have LVP disabled anyway.

    I would also add current limiting resistors between the PIC pins and the transistor base as well as decoupling capacitor near each PIC (0.1uF). Also add a diode between the transistor common/emitter pins.
    I have 1k resistors between each RB and transistor base. Is that ok?
    I had zener diodes 4148 between C and E in my previous "design". I just left them out for no reason. Should I put them back in?
    PIC are spec for 5V, wondering why you're getting 5.5V on the pins.

    Something similar with what you're doing is here http://www.dakeng.com/u2.html
    Yes I know. My "design" is a cross-breed between dakeng's sample circuit and linistepper (it's using dakeng "layout" and linistepper transistors - tip122)

  8. #8
    Join Date
    Apr 2005
    Posts
    462
    Quote Originally Posted by pminmo
    If they were AVR's I could help some, but not PIC's. Why the bipolar transistors, and not MOSFET's?

    Phil
    I don't know, that's what linistepper uses so I thought I might as well stick to that. Got any better suggestions for me? I'm listeninig

  9. #9
    Join Date
    Apr 2005
    Posts
    462
    And here are the schematics for the two
    Attached Thumbnails Attached Thumbnails controller-sch.png   driver-sch.png  

  10. #10
    Join Date
    Apr 2005
    Posts
    462
    I made a mistake. I'm having problems with RB03 not 04! I simply counted from 1 but forgot that the first RB i/o pin is RB0 not RB1! So it's definitely RB03 I'm having problems with.

  11. #11
    Join Date
    Apr 2003
    Posts
    361
    Ensure LVP is disabled and TRISB set for output. Write a simple code to set RB4 to HIGH. Measure the voltage on RB4, if still not 5V, probably the bit is fried. Get a new PIC
    Stupid questions make me smarter...
    See how smart I've become at www.9w2bsr.com ;-P

  12. #12
    Join Date
    Apr 2005
    Posts
    462
    Ok will do. One more thing. I'm currently using the internal 4MHz oscillator. To add an external 20MHz crystal (the metal can thingamabob) it's just a matter of connecting one leg to OSC1 and the other to OSC2 pins and setting the HS flag in icprog and that's that? I have a feeling the PIC is struggling to get all the step/dir signals at 4MHz when running two axis at the same time rather than just one. I had to set minimum pulse width to 20us and direction prechange to 50us and kernel speed to 25000Hz for it to work. Anything faster and it starts to become jerky and loses steps.

    Also has anyone built linistepper? Should I just throw all my stuff out the window and go with that?

  13. #13
    Join Date
    Apr 2005
    Posts
    462
    Did I forget to mention that I'm using an AT computer psu? Is that a bad thing<sup>tm</sup>?

  14. #14
    Join Date
    Apr 2005
    Posts
    462
    Stupid LVP (chair)
    Set all outputs to 1 and it's showing 5.1 or thereabouts on all of them.
    Everything working fine now! thanks! :cheers:

  15. #15
    Join Date
    Apr 2004
    Posts
    733
    Metal cans with two leads are crystal oscillators. You will also need to hook up two small capacitors (around 20pf) to get the crystal to resonate. The datasheet shows a small drawing of how to hook one up correctly. I usually use a 3 lead ceramic resonator since they have built in capacitors. Just a little bit easier to use.

    I did a simple stepper controller using a 16f627 which is similiar to your 628. I used the external resister ER oscillator mode. Hooked up a 1K resister to OSC1 and ground gets the chip working around 10Mhz. I used the interrupt on change B4 and B5 for step input. At 10Mhz, it was plenty fast to control 2 stepper motors. I did have to set the pulse width output of TurboCNC to about 20us. This gave the chip enough time to service the interrupt, poll the direction pins and output next step sequence.

    The 12volt AT supply will limit your overall top end speed for your steppers which should be around 300RPM or so depending on the quality of your motors. 300RPM is about 2000steps/sec for half step mode. With careful coding, the internal 4Mhz oscillator speed should be able to handle atleast 300RPM using polled port A inputs. Just set Mach2 pulse width setting high enough so you don't miss the next step pulse.


    Jim

  16. #16
    Join Date
    Apr 2003
    Posts
    361
    My driver is my own design using the 16F628 as well (with LMD18245). I've used PORTB for input because I needed the 'Interrupt on Port Change'. With internal OSC, I'm able to handle about 30kHz step signal. No issue with pulse width because it's 'bit-change' driven.
    Stupid questions make me smarter...
    See how smart I've become at www.9w2bsr.com ;-P

  17. #17
    Join Date
    Apr 2005
    Posts
    462
    abasir would you mind explaining the "decoupling capacitor near each pic" bit to me? where exactly do I put it? and what would be the purpose of it? also which diode should I use between e and c of transistors? :drowning:

  18. #18
    Join Date
    Apr 2003
    Posts
    361
    Put 100nF capacitor between VCC and GND as close as possible to the PIC supply pins. Switching high current (your TIP...) will cause voltage spikes on the supply lines so the decoupling caps should take care of it. As for the diode, you need to pick based on the current and switching frequencies (both is unknown to me )
    Stupid questions make me smarter...
    See how smart I've become at www.9w2bsr.com ;-P

  19. #19
    Join Date
    Apr 2005
    Posts
    462
    URGENT!

    Problems with a PIC

    All of a sudden, everything having worked ok so far, my PIC is just sitting there doing nothing. Now, when I say nothing I mean, it sort of initialises itself (I can see voltage on some pins) and that's it. I am using a 20MHz crystal and two 27pF caps (on my other board I'm using 20pF but the spec sheet says between 15 and 30pF so I guess I'm ok with 27)

    So it's sitting there doing nothing. I put it into another board and it's working. In this, new, board it's just sitting there even if I reprogram it with the internal resonator at 4MHz. Any ideas? I don't seem to have any shorts on this board. What would make it halt? Anything particular I should look out for?

    Thanks!

  20. #20
    Join Date
    Apr 2003
    Posts
    361
    Check voltages on VCC/GND & MCLR. Either a short or a break somewhere
    Stupid questions make me smarter...
    See how smart I've become at www.9w2bsr.com ;-P

Page 1 of 2 12

Similar Threads

  1. PIC Open source Servo Driver Schematics development?
    By Rossz in forum Open Source Controller Boards
    Replies: 90
    Last Post: 10-26-2011, 09:37 PM
  2. Need PIC programmed
    By randyf1965 in forum CNC Wood Router Project Log
    Replies: 0
    Last Post: 03-27-2005, 12:56 AM
  3. pic chip SERIAL to step/dir and controll
    By berin in forum Open Source Controller Boards
    Replies: 13
    Last Post: 02-19-2005, 12:23 AM
  4. Posting pic from the galley
    By cncadmin in forum Community Club House
    Replies: 1
    Last Post: 07-10-2003, 11:30 PM

Posting Permissions

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