Pic will not run


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2009
    Posts
    583

    Default Pic will not run

    I've been working on a project for the past few months but now have an issue which is causing my grey hair to fall out !

    The project was developed on my trusty old EasyPIC5 board and solderless breadboad, and worked fine. Initially I was using an 18F4620 and a this was used to build a prototype on veroboad strip board, which worked well. As I don't really need all the 40 pins on the 18F4620 I ported the code to an 18F2620 and tested that in the Easypic5 board, which worked fine. So I decided to have some boards made, and spent weeks coming up with a final version that checked out and looked good. I sent the gerbers off and the boards arrived yesterday. I spent around three hours last night building a board only to find that the LCD just displayed one line of blocks. It was rapidly approaching 1am so I retired to bed.

    Now I'm not sure if it's simply my iron isn't hot enough, or they's used lead free solder in the plating process, but all the pins that connect to the ground plane are a slightly brighter colour and are a bitch to solder, so thinking that it might be a dry joint I took another board (I have 5 to play with) and this time belled each connection out to ensure it followed the schematic before placing the components just for the PIC and LCD. So basically I just have the 28pin DIL socket, 10mhz crystal, two 22pf caps, 1k LCD backlight resistor, 10k MCLR pull up resistor and the 10k pot on the board. Connected up a 5v supply and I get the same thing. I also get the same thing if I power up the LCD in the Easypic5 board without the PIC inserted, so it's like the pick isn't running. If I plug the PIC back in the development board it runs fine.

    The only thing that is different between the stripboard prototype and the PCB schematic is that all unused pins are grounded. So I have a hunch that possibly I need to change something in the config of the code to disable those pins just in case this is causing the PIC to lock up ?? - or possibly I'm barking up the wrong tree !

    I've attached the centre section of the schematic, which I've belled out with a continuity tester on the board, and it all rings true with no shorts. The LCD follows the same layout as the diagram in the easypic5 manual, and also bells out correctly. I've also included the config settings for the ports, just in case I'm missing something,.



    Any suggestions ?

    Code:
    ASM 
      __CONFIG    _CONFIG1H, _OSC_HS_1H
      __CONFIG    _CONFIG2L, _PWRT_ON_2L  
      __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
      __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H  
      __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
    
    '*******************************************************************************
    ' LCD (20 x 4) set up 
    '*******************************************************************************
    
    DEFINE LCD_DREG  PORTB                  ' LCD Data port
    DEFINE LCD_DBIT  0                      ' starting Data bit (0 or 4)
    DEFINE LCD_EREG  PORTB                  ' LCD Enable port
    DEFINE LCD_EBIT  5                      '     Enable bit  (on EasyPIC 5 LCD)
    DEFINE LCD_RSREG PORTB                  ' LCD Register Select port
    DEFINE LCD_RSBIT 4                      '     Register Select bit   (on EasyPIC 5 LCD)
    DEFINE LCD_BITS  4                      ' LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 4                      ' number of lines on LCD
    DEFINE LCD_COMMANDUS 2000               ' Command delay time in us 
    DEFINE LCD_DATAUS 50                    ' Data delay time in us 
    
    '*******************************************************************************
    ' Defines Statements
    '*******************************************************************************
    
    DEFINE  OSC 20                         
    ADCON1 = $0F
    clear    
    
    '*******************************************************************************
    'Analog and Comparator settings
    '*******************************************************************************
    
    ADCON0 = %00000000                      'AD converter module disabled
    ADCON1 = %00001111                      'All Digital
    ADCON2 = %00000000
    CMCON = 7                               'Disable Comparators
    
    '*******************************************************************************
    'Port settings
    '*******************************************************************************
        
    TRISA  = %00010111              
    TRISB  = %00000011 
    TRISD  = %00000011              
    T0CON  = %11000111
    Last edited by Scampy; - 23rd July 2016 at 11:58.

  2. #2
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Pic will not run

    OK this simple test works on the second board with just the PIC

    Code:
    ASM 
      __CONFIG    _CONFIG1H, _OSC_HS_1H
      __CONFIG    _CONFIG2L, _PWRT_ON_2L  
      __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
      __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H  
      __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM
    
    
    '*******************************************************************************
    ' Defines Statements
    '*******************************************************************************
    
    DEFINE  OSC 20                          ' 18F4520, 20mhz crystal
    ADCON1 = $0F
    clear    
    
    '*******************************************************************************
    'Analog and Comparator settings
    '*******************************************************************************
    
    ADCON0 = %00000000                      'AD converter module disabled
    ADCON1 = %00001111                      'All Digital
    ADCON2 = %00000000
    CMCON = 7                               'Disable Comparators
    
    '*******************************************************************************
    'Port settings
    '*******************************************************************************
        
    TRISA  = %00010111              
    TRISB  = %00000011             
    T0CON  = %11000111
    
    
     
     
     
     Main:
     high portb.4
     pause 1000
     low portb.4
     pause 1000
     goto main
    So the board routing seems OK, so it must be a dry joint or issue with the 1st board...

  3. #3
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Pic will not run

    Well I have the PIC running the main code, and it displays the main intro and main screen, but it's not reading the DS1307 as it displays 10:10 regardless if the DS1307 is present on the board. I've checked continuity between the SCL and SDA lines, pullups and supplies - changed the DS1307, swapped pullups from 10k to 4.7K and back, and replaced the 37Khz crysta, but still no change in the display

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Pic will not run

    disable those pins just in case this is causing the PIC to lock up
    It can't do any harm to set all grounded pins to inputs.

    Decoupling?

    Do you still have access to a working breadboard version?
    George

  5. #5
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Pic will not run

    Boards can sometimes have an issue with plate through holes. If you've found one with a problem. likely all the boards in that batch will have issues - just not necessarily in the same location. Where the through hole devices are, I'd make sure the solder wicked through completely, and maybe even put a bit extra solder top and bottom to guarantee the connection. It also wouldn't hurt to solder a bit of wire in the vias and cut it off flush when done. That should address your marginal connection situation. Sometimes a track will "buzz out" fine, but contain enough resistance to make signals flaky if you've got a poorly manufactured board.

    Your pull up resistors likely need to be smaller, not larger. The trade off is that smaller resistors consume a bit more energy, but speed up the rise time of the waveform. I'd try 2K2 or 3K3. I don't think I've ever used anything over 3K9, especially with multiple devices sharing the bus. 10K is at the extreme upper limit of the spec. Unless battery life is a critical design requirement, go small. 1K is the absolute minimum, so don't go quite that far.

    Any chance you can share a picture of the board layout?
    Last edited by Charlie; - 23rd July 2016 at 17:03.

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: Pic will not run

    Just in case - If you changed the battery on the DS1307 or removed it, I believe you'll need to send the enable bit code to get it running again otherwise your time will not change but will be stuck where it was when it lost backup power.

    btw, the DS3231 is tremendously more accurate, in case you wanted that improved. It leaves the 1307 in the dust.

    Picster
    Last edited by picster; - 23rd July 2016 at 17:05. Reason: edited to include DS3231

  7. #7
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Pic will not run

    thanks for the comments guys,

    I've attached board layouts as requested. I've been out this afternoon, so will have a further play in reducing the ic2 pullups to see if that helps
    Attached Images Attached Images   

  8. #8
    Join Date
    Jan 2014
    Posts
    84


    Did you find this post helpful? Yes | No

    Default Re: Pic will not run

    May be I'm wrong, but verify if you have a shortcircuit between pin3 and pin6 from LCD (Vo pin and E pin)

  9. #9
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Pic will not run

    Well I think I've discovered the cause, the tactile switches I have are not the same as the ones used in the schematic and either have different pinouts or I made an error in the schematic... bottom line is the reset, and programming buttons are directly shorted to gnd when fitted. But that't the reason we prototype stuff - to work out issues and refine the design.

    The quality of the board is OK, but I think they have used lead free solder as a lot of the joints, especially when connected to the ground plane took a lot more heat to get a good bond, and then they didn't look as neat as older boards when stuff was all leaded. But then for around £8 a board including shipping I can't really complain.

    The issue with the RTC was the battery in the holder. It was taken from an old project and needed cleaning, after that it worked fine. I'll look at the DS3231, but for this project the accuracy of the 1307 is fine, but thanks for the suggestion.

  10. #10


    Did you find this post helpful? Yes | No

    Default Re: Pic will not run

    Did you note that 3231 would save you thr cost of a crystal.
    George

Similar Threads

  1. PIC16F628A Will not run at all....
    By thasatelliteguy in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 23rd May 2014, 08:26
  2. PIC programs, resonator resonates, but does not run code.
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th August 2012, 02:47
  3. Run-Time Config
    By Darrel Taylor in forum PBP Extensions
    Replies: 1
    Last Post: - 1st February 2012, 17:26
  4. 16F628 does not run. I can't believe this
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd October 2009, 16:41
  5. How to run program in parallel?
    By vanxn in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th July 2006, 22:59

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