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

Problems with starting up the PIC16F883

Discussion in 'Oshonsoft' started by Winch, Mar 10, 2016.

  1. Winch

    Winch New Member

    Joined:
    Sep 5, 2014
    Messages:
    24
    Likes:
    0
    I have problems with the startup of the PIC16F883!
    Communication with the 16F883 gives many problems.
    I use the oshonsoft software and have the code posted below. Does anyone see what the problem is?

    Most likely the problem is in the "Define CONFIG" setting? But I'am not sure.
    I have experience with the PIC16F873A never had a problem with it, wants to use the 883 for more analog inputs.

    code (text):

    'device pic16f883

    Define CONFIG = 0x23e1
    Define CONFIG = 0x3eff
    Define CLOCK_FREQUENCY = 20

    AllDigital 'alle ports digital

    'port names
    Symbol led1 = PORTA.4 'control LED for microcontroller

    'A gate set to the desired value
    '76543210
    PORTA = %00000000 'make all ports "PORTA" low
    TRISA = %11111111 'all are set for input.

    OPTION_REG.7 = 0 'PORTB pull-ups are enabled

    'B gate set to the desired value
    '76543210
    PORTB = %00000000 'make all ports "PORTB" low
    TRISB = %11111111 'all ports are set for input

    'C gate set To the desired value
    '76543210
    PORTC = %00000000 'make all ports "PORTC" low
    TRISC = %11111111

    main: 'endless loop

    led1 = 1
    WaitMs 500
    led1 = 0
    WaitMs 500

    Goto main
    End
     
  2. Winch

    Winch New Member

    Joined:
    Sep 5, 2014
    Messages:
    24
    Likes:
    0
    At this time, programming will work if PGM (RB3) is connected to the 0 volt!
    If I toggle the LED with 100 mSec then I see the LED flashes, with 500Msec the LED light continuously.
    If I disconnect the PGM from the 0 volt everything will stop?
    Somewhere there must be something around the PGM?

    Now I read the following!

    To disable the Low-Voltage ICSP mode, the LVP bit must be programmed to ‘0’.
    This must be done while entered in the High-Voltage Entry mode (LVP bit = ‘1’).
    RB3 is now a general purpose I/O pin.

    The factory default settings are LVP = '0'!
    I use the Picket 3 programmer so I program with High voltage that means that LVP bit must be '1'
    The question is how do I program it?

    Has anyone done this before?
     
  3. Winch

    Winch New Member

    Joined:
    Sep 5, 2014
    Messages:
    24
    Likes:
    0
    Oke!
    It works.
    It was all about the following!

    Define CONFIG = 0x23e1
    Define CONFIG = 0x3eff

    It must be...
    Define CONFIG1 = 0x23e1
    Define CONFIG2 = 0x3eff

    Thats all.....
    Thanks
     
  4. dave

    Dave New Member

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


     
  5. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,157
    Likes:
    907
    Location:
    Rochdale UK

    Apologies!! I've only just seen this... Good to see you resolved it!!
     
  6. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,811
    Likes:
    121
    Location:
    Buenos Aires - Argentina
    ONLINE
    I know, not a contribution to the Winch's (solved) problem but wondering why they use such an obscure way to express the settings...

    In my case (working in Assembly), I find the following much more, if not intuitive, explicit:

    Config excerpt.png
     
    • Agree Agree x 1
  7. Dave46

    Dave46 New Member

    Joined:
    May 3, 2015
    Messages:
    2
    Likes:
    0
    Even more explicit in Oshonsoft...........
    upload_2016-3-13_17-14-11.png

    Clicking on a "D" gives a description of the config........
    upload_2016-3-13_17-16-35.png


    Finally clicking on "Generate Basic Code" generates the code and places it in the start area of the BASIC listing.
    E.g. (with my comments underneath).
    upload_2016-3-13_17-20-10.png

    Dave
     

    Attached Files:

    • Informative Informative x 2
  8. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,811
    Likes:
    121
    Location:
    Buenos Aires - Argentina
    ONLINE
    Very explicit, really. He should have posted THAT, not the resulting code.
     
  9. Dave46

    Dave46 New Member

    Joined:
    May 3, 2015
    Messages:
    2
    Likes:
    0
    Most of Oshonsoft functions are pletiful and easy to use. I see from another thread (so perhaps I'm wrong to bring it up here!!) that you were wondering what Oshonsoft stuff was like, all I can say is give it a try. I use it extensively with 16F, 10F and 12F older parts and it is fine for this. Its downfall is that it is a one man operation with sporadic development so newer chips are not fully supported. This is a shame as it is a lovely piece of development software with lots of good features.
     
    • Informative Informative x 1

Share This Page