1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

PIC doesn't run with internal oscillator

Discussion in 'Oshonsoft' started by camerart, Apr 13, 2014.

  1. skimask87

    skimask87 Member

    Joined:
    Mar 23, 2014
    Messages:
    128
    Likes:
    10
    Location:
    Logan (Minot), ND
    Again........
    would've been nice to know.......
     
  2. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,326
    Likes:
    11
    Location:
    Dorset UK.
    I've been trying lots of different things, perhaps one every 5 minutes for days, I can't post them all.

    You haven't let me know if this is what you were hinting at. See what I mean?
     
  3. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,326
    Likes:
    11
    Location:
    Dorset UK.
    '16f684A xtl

    Define CONF_WORD = 0x3f41 'XTL
    Define CLOCK_FREQUENCY = 4 'Changed from 12
    AllDigital

    'Define SIMULATION_WAITMS_VALUE = 1 'SIMULATION ONLY

    Define LCD_BITS = 4
    Define LCD_DREG = PORTB
    Define LCD_DBIT = 4
    Define LCD_RSREG = PORTA
    Define LCD_RSBIT = 2
    Define LCD_RWREG = PORTA
    Define LCD_RWBIT = 3
    Define LCD_EREG = PORTA
    Define LCD_EBIT = 4
    Define LCD_READ_BUSY_FLAG = 1

    Lcdinit 'Stalls here...Lcdinit commented out RA1 flashes.

    loop:
    'Lcdcmdout LcdClear
    'Lcdout "WORKING!?"
    'Lcdcmdout LcdLine2Home
    'Lcdout "TEST"
    Toggle RA1 'INDICATOR LED
    WaitMs 100
    Goto loop

    The RA1 LED flashes with all the defines, but stalls if LCdinit, is in the set-up.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. skimask87

    skimask87 Member

    Joined:
    Mar 23, 2014
    Messages:
    128
    Likes:
    10
    Location:
    Logan (Minot), ND

    Don't read the busy flag...
     
  6. jjw

    jjw Member

    Joined:
    Apr 16, 2012
    Messages:
    262
    Likes:
    15
    Location:
    Helsinki, Finland
    The program looks now right.
    Have you checked the display specifications ( delays etc. )?
    You could try it without the busy flag, the compiler should generate correct delays.
    Have you checked the wiring?
     
  7. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,326
    Likes:
    11
    Location:
    Dorset UK.
    Do you mean make Define LCD_READ_BUSY_FLAG = 1 [=0]?
     
  8. jjw

    jjw Member

    Joined:
    Apr 16, 2012
    Messages:
    262
    Likes:
    15
    Location:
    Helsinki, Finland
    Yes.
     
  9. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,326
    Likes:
    11
    Location:
    Dorset UK.
    Hi,

    I added a 4.7K pull up resistor to PIN 3, this got the LED to flash with the program as it should be.

    I put a logic probe on the 7 LCD pins, and they all seem to be firing.

    I have the contrast full on, I assume the screen should still be able to be read, and not whited out?

    As suggested by JJW my guess would be something to do with timing. I'll have to read up about it.
     
  10. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,326
    Likes:
    11
    Location:
    Dorset UK.
    No difference.
     
  11. skimask87

    skimask87 Member

    Joined:
    Mar 23, 2014
    Messages:
    128
    Likes:
    10
    Location:
    Logan (Minot), ND
    Ok...how about this...

    Read the first line of your post #43.

    Now go over and read the part number on your PIC installed on the board.

    Point being you've got half a dozen different PICs mentioned here...
    16F819, 16F628A in a picture, PIC16F684 in the code, looks like it's wired up for a 16F648A.
     
    Last edited: Apr 17, 2014
  12. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,169
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    Are you still in the simulator? As it works in the IDE.... Make sure you have a resistor on RA4 as there is no internal pullup on this output!!
     
  13. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,326
    Likes:
    11
    Location:
    Dorset UK.
    I've been using the simulator as a guide, then putting it in the circuit. It has a 4.7K resistor on RA4.
     
  14. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,326
    Likes:
    11
    Location:
    Dorset UK.
    Look at #11, It's been 16F648A since then.
     
  15. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,169
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    If you are going to drop the busy flag polling.... Then you have to tie RW to ground....

    0x3f41 is correct if you have a 4Mhz crystal... There doesn't seem to be anything wrong with your code so you need to look at your connections....
     
  16. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,326
    Likes:
    11
    Location:
    Dorset UK.
    Hi all,

    I checked over and over, then tried a continuity test between each pin against all the pins. PIN1 showed it was connected to 5V.

    At the bottom of the board 100mm from the circuit, I have the power connection, and a +V link across the board. So the copper line was connected all the way the up board to pin 1.

    Sorry for time wasted, I was warned!!

    It is working ok now.

    Thanks to everyone who helped me, and once again apologies.

    Camerart
     
  17. Inquisitive

    Inquisitive Super Moderator

    Joined:
    Aug 31, 2011
    Messages:
    924
    Likes:
    86
    Location:
    Georgia, USA
    Enquiring minds want to know. What was it?
     
  18. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,169
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    Looks like "pin 1" ?? was shorted to 5v
     
  19. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,326
    Likes:
    11
    Location:
    Dorset UK.
    As Ian rogers says, it was pin 1 shorted to 5V. I checked a few times, but, the short was a link away from the circuit, at the bottom of the board.
     
  20. Inquisitive

    Inquisitive Super Moderator

    Joined:
    Aug 31, 2011
    Messages:
    924
    Likes:
    86
    Location:
    Georgia, USA
    It happens to us all. Glad you got it solved.
     
  21. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,326
    Likes:
    11
    Location:
    Dorset UK.
    Thanks.

    I had tested it with a logic probe, but it sounded to me as if PIN1 was working ok. I found it when I did a test of each pin against every other pin, which for me is not usual.

    Cheers, Camerart.
     
    Last edited: Apr 18, 2014

Share This Page