Cant get it to work


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    May 2004
    Posts
    81

    Default Cant get it to work

    Ok, I dont know WHAT in the world is going wrong here. I can not even get so much as a simple blink to happen. Here is the code:

    Code:
    DEFINE OSC 8                                    ' 8 Mhz Oscillation
    OSCCON = $70                                    ' Oscilator Config reg.
    
    start:
        High 0
        pause 1000
        low 0
        pause 1000
    goto start
    Compiles fine. I am using picbasic 2.60, Microcode Studio 3.0.0.5, and IC_prog 1.06B.

    1. Compile the program, get a hex file
    2. Load up the hex file in IC-Prog. Im using 16F818 or 16F819. I have tried like 10 chips and none will work and I doubt they are ALL bad.
    3. Selecting IntRC for oscilator in ICPROG
    4. Config is as follows:
    - WDT = true
    - PWRT = true
    - MCLR = True
    - BODEN = True
    - LVP = False
    - CPD = False
    - Debugger = False
    - CCPMX = True

    I program it, it verifies.. so far so good..

    yet when I plug it up to the most basic circuit, I get NOTHING. Its like the chip is just not doing anything at all. Ive even included power indicator LED's to make sure it is getting power etc. What in the world am I missing here? Im sure its something so incredibly simple I just cant see it... (We've all been there Im sure)

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Is MCLR pulled HIGH?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    May 2004
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Here is the schematic


  4. #4
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    According to the datasheet ( http://ww1.microchip.com/downloads/e...doc/39598e.pdf ) pin 4 is MCLR - from the schematic it seems you have pin 3 (RA4) pulled high via a resistor.

    You also don't show any timing crystal, so assume you are using the internal osc

    The PIC16F818/819 devices include an internal
    oscillator block which generates two different clock
    signals; either can be used as the system’s clock
    source. This can eliminate the need for external
    oscillator circuits on the OSC1 and/or OSC2 pins.
    The main output (INTOSC) is an 8 MHz clock source
    which can be used to directly drive the system clock. It
    also drives the INTOSC postscaler which can provide a
    range of clock frequencies from 125 kHz to 4 M
    Therefore you might need to configure the PIC for internal OSC

    FOSC2:FOSC0: Oscillator Selection bits
    111 = EXTRC oscillator; CLKO function on RA6/OSC2/CLKO pin
    110 = EXTRC oscillator; port I/O function on RA6/OSC2/CLKO pin
    101 = INTRC oscillator; CLKO function on RA6/OSC2/CLKO pin and port I/O function on
    RA7/OSC1/CLKI pin

    or
    100 = INTRC oscillator; port I/O function on both RA6/OSC2/CLKO pin and RA7/OSC1/CLKI pin
    011 = EXTCLK; port I/O function on RA6/OSC2/CLKO pin
    010 = HS oscillator
    001 = XT oscillator
    000 = LP oscillator

    Hope that helps

  5. #5
    Join Date
    May 2004
    Posts
    81


    Did you find this post helpful? Yes | No

    Default

    Yeah, thats just an error in my schematic diagram. I have the resistor on pin 4 not pin 3. Im prety sure my problem is somewhere in the config fuses. Its been a while since Ive played with any of this but Ive writen a bunch of far more complex programs than this and have had them work. If only I could find the code maybe I would see what I am missing.

  6. #6
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I have the resistor on pin 4 not pin 3.
    That is fine, but from your schematic the resistor (hope 10 KOhms) is connected to Vss, which is a pulldown not a pullup. Connect the resistor to Vdd.

    In your schematic you are showing Vdd as ground! Remember that Vdd is + 5 Volts and Vss is ground.

    Al.
    Last edited by aratti; - 7th April 2010 at 22:09.
    All progress began with an idea

  7. #7
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    First thing to do is to put all pins to digital, since you are not going to use ADC.

    ADCON1 = 7


    Second thing to do is to fix what you want to do with these digital pins. Outputs? or Inputs? Now since you want to flash one led then we will set all as outputs, setting the TRIS register.

    TRISA = %00000000
    TRISB = %00000000

    And place all to low level

    PortA = 0
    PortB = 0


    Now your code


    start:
    High PortB.0
    pause 1000
    low PortB.0
    pause 1000
    goto start

    Here I assume you have connected your led with 330 Ohms resistor in series to portB.0, which is pin 6. If you have use a different pin then change the reference.

    You can also use ALIAS giving a name to the port, but you must declare it before to use it.

    Led var PortB.0

    start:
    High Led
    pause 1000
    low Led
    pause 1000
    goto start


    Will do the same as the previuos code. Hope it will help.

    I didn't check if your oscillator setting is correct or not, I assume that is correct.

    Al.
    All progress began with an idea

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