The PIC does not start its program.


Closed Thread
Results 1 to 37 of 37

Hybrid View

  1. #1
    Ted's's Avatar
    Ted's Guest

    Lightbulb The PIC does not start its program.

    I assembled my new pic 16f628a circuitry. The PIC does not start its program.

    My checklist:

    Voltage: +5V Pin 14, Mass Pin 5 OK
    Osc 20Mhz quarz: Pin 15 and Pin 16 OK - I only have a multimeter, so what I found is that values change between 0 and +5V, I assume a sine wave.
    Program: PIC is being programmed well according to software. As usual.

    PIC Program
    Code:
    @ DEVICE MCLR_OFF
    @ DEVICE hs_osc
    @ DEVICE wdt_off
    @ DEVICE lvp_off
    @ DEVICE protect_off
    
    Define OSC 20
    INTCON = 0
    CMCON = 7
    TRISB = %00100100
    TRISA = %11111100
    
    LED_Kalib VAR PORTB.7
    LED_Halb VAR PORTB.4
    LED_Voll VAR PORTB.6
    LED_Besch VAR PORTA.0
    LED_OK VAR PORTB.0
    
    Low LED_Kalib
    Low LED_Halb
    Low LED_Voll
    Low LED_Besch
    Low LED_OK
    High LED_Kalib
    High LED_Halb
    High LED_Voll
    High LED_Besch
    High LED_OK
    Pause 500
    Low LED_Kalib
    Low LED_Halb
    Low LED_Voll
    Low LED_Besch
    Low LED_OK
    Anything missing in the checklist? Any ideas on how to solve the issue?
    Last edited by Ted's; - 26th July 2008 at 20:18.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    So, you're switching on 5 LED's then switching them off again. That routine will run only once, and in fairness, there is in theory only half a second between the ON and OFF sequence. Do you have 5V on the MCLR pin?

  3. #3
    Ted's's Avatar
    Ted's Guest


    Did you find this post helpful? Yes | No

    Default

    There is a 22kOhms resistor from +5V to RA5 and from RA5 to Mass is a push-button. So without pressing the button it is +5V. But that shouldn't be important because of "@ DEVICE MCLR_OFF".

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    You might try using upper case letters in those DEVICE STATEMENTS and DEFINE. http://www.picbasic.co.uk/forum/showthread.php?t=558
    Last edited by Archangel; - 26th July 2008 at 22:44.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Ted's's Avatar
    Ted's Guest


    Did you find this post helpful? Yes | No

    Default

    I did. This did not change anything.

    I used this code before and it worked with exactly this chip.

    I replaced the pic and it still did not work.

    Do you know a better way of measuring the pic's quarz using a multimeter? I presume that having a 20Mhz Quarz is way out of this device's possibilities.
    Last edited by Ted's; - 26th July 2008 at 23:18.

  6. #6
    Ted's's Avatar
    Ted's Guest


    Did you find this post helpful? Yes | No

    Default

    *deleted****
    Last edited by Ted's; - 26th July 2008 at 23:19.

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Get back to basics...
    For on thing...

    Code:
    .......DEVICE statements, PIC Setup statements etc.
    All LEDs are set OFF
    All LEDs are set ON
    Wait for 1/2 second
    Turn all LEDs all
    It runs one time, and one time only. Don'tcha think it would be better to continuously blink the LEDs so you have time to probe around and see what's going on?
    Code:
    @ DEVICE MCLR_OFF
    @ DEVICE hs_osc
    @ DEVICE wdt_off
    @ DEVICE lvp_off
    @ DEVICE protect_off
    Define OSC 20
    INTCON = 0 : CMCON = 7 : TRISB = %00100100 : TRISA = %11111100
    LED_Kalib VAR PORTB.7 : LED_Halb VAR PORTB.4 : LED_Voll VAR PORTB.6
    LED_Besch VAR PORTA.0 : LED_OK VAR PORTB.0
    main: Low LED_Kalib : Low LED_Halb : Low LED_Voll : Low LED_Besch : Low LED_OK
    pause 500
    High LED_Kalib : High LED_Halb : High LED_Voll : High LED_Besch : High LED_OK
    Pause 500
    goto main
    END

  8. #8
    Ted's's Avatar
    Ted's Guest


    Did you find this post helpful? Yes | No

    Default

    Not right now, skimask.

    The issue is that the pic is not even starting its programme.

    I want to give you more information. When voltage is being applied to the circuitry, these levels are given on the pic's socket:

    RA3 = Undefined, Floating
    RA4,RA5,RB2,Vdd,RB5 = 5.01 Volts
    RA7,RA7 = OSC

  9. #9
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ted's View Post
    Not right now, skimask.
    The issue is that the pic is not even starting its programme.
    I want to give you more information. When voltage is being applied to the circuitry, these levels are given on the pic's socket:
    RA3 = Undefined, Floating
    RA4,RA5,RB2,Vdd,RB5 = 5.01 Volts
    RA7,RA7 = OSC
    That's EXACTLY the issue. If you break it down into it's simplest form, you can probe around, put parts in, pull parts out, play around, without worrying about anything.
    And again, YOUR program only execute ONE TIME. Are you going to sit there and keep pressing RESET while you mess around trying to probe?

  10. #10
    Ted's's Avatar
    Ted's Guest


    Did you find this post helpful? Yes | No

    Default

    Do you recommend soldering on a running system?

    To me it is about what is given the first time when voltage is being applied. Or will it work if I replace the quarz while there is already voltage applied to vdd and vss? I doubt so.
    Last edited by Ted's; - 26th July 2008 at 23:42.

  11. #11
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ted's View Post
    Do you recommend soldering on a running system?
    If it's only 5v and you've only got a PIC, an LED, a resistor, and the rest of the glue that goes with, sure...why not?

Similar Threads

  1. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 07:57
  2. Replies: 14
    Last Post: - 26th September 2007, 05:41
  3. Pic16f84 and RC5 kode
    By terminator in forum Bluetooth
    Replies: 5
    Last Post: - 18th June 2007, 21:40
  4. Pic Start Plus Help
    By shawn in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th March 2007, 03:47
  5. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10

Members who have read this thread : 0

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