Menu

Pic16f84A beginner - first program

Help
Anonymous
2011-07-20
2013-05-30
  • Anonymous

    Anonymous - 2011-07-20

    Hello,
    I'm new in programming the PIC16f84A. I'm trying to make my first programm and see how it works.
    I use PIC16f84A 4MHz
    -this is my simple program and configuration:

    _
    ;Chip Settings
    #chip 16F84A,4

    ;Defines (Constants)
    #define LED PORTB.0

    Dir PORTB.0 Out
    Do Forever
    PulseOut LED, 1 s
    Wait 1 s
    Loop_

    I compile this and save to desktop. With "PICkit 2 v2.61" I download .hex file to PIC without errors. OK.
    Now I want to see how it works -visual.

    On the PIC I connected
    pin 5 - minus
    pin 14 + plus
    pin 6 LED (anode to pin) in series with resistance 1k (also tryed with 0,5k)
    And I can't see that LED is blinking.

    Where am I wrong? Please help?!

     
  • Nobody/Anonymous

    Did you use external oscillator at 4 MHZ (pin 15 and pin 16) ?
    I think 16f84 has not internal clock.

     
  • Hugh Considine

    Hugh Considine - 2011-07-21

    With a newer and nicer chip like a 16F628A, 16F819 or 16F88, that would work. The 16F84A is one of the oldest PIC chips, and is a bit more complicated to get working. If you can't get one of those chips easily, it is possible to make the 16F84A work by adding a few extra parts.

    You need to attach an oscillator to the oscillator pins - connect a 4 MHz crystal at pins 15 and 16, then a 22 pf capacitor from pin 15 to ground, and another 22 pf capacitor from pin 16 to ground . You also need to have a 10K resistor from the MCLR pin (pin 4) to +5 volts.

     
  • Nobody/Anonymous

    I'll try to do this small modifications but also try to buy this new one PICs
    I'll let you know the results!

    Thanks!

     
  • Nobody/Anonymous

    Hi,
    I bought 4MHz crystal and capacitor and now it's working. Now I'm going to play with it :)

    thanks again!

     
  • Anonymous

    Anonymous - 2011-08-10

    hi, me again

    @w_cholmondeley

    With a newer and nicer chip like a 16F628A, 16F819 or 16F88, that would work.

    I made again this small program with PIC16f819-1/P and pin 5 - minus; pin 14 + plus; pin 6 LED;
    Do I again need oscilator (also tryed with every osc in setup)
    Something doesn't work :/
    Which are right parameters for setup to have 8+8 I/O

    _;Chip Settings
    #chip 16F819, 8

    ;Defines (Constants)
    #define LED PORTB.0

    Dir PORTB.0 Out
    Do Forever
    PulseOut LED, 1 s
    Wait 1 s
    Loop_

     
  • Mauried

    Mauried - 2011-08-10

    The 16F819 has an internal oscillator, but you havnt told the chip to use it.
    You need to add this line to your code.
    #Config osc = int

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.