Continue to Site

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.

  • 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.

Problems with starting up the PIC16F883

Status
Not open for further replies.

Winch

Member
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
 
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?
 
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
 
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
 
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
 

Attachments

  • upload_2016-3-13_17-19-56.png
    upload_2016-3-13_17-19-56.png
    4.7 KB · Views: 303
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.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top