Society of Robots - Robot Forum

Software => Software => Topic started by: sambhav on March 07, 2007, 11:11:45 AM

Title: regarding MPLAB and PIC...
Post by: sambhav on March 07, 2007, 11:11:45 AM
hiii..
i m writing a program for my project in assembly using MPLAB for pic16f877 ...
i referred to some tutorials on the net and learnt about it...
howevr i still didnt understand wat the configuration word stands for...
its sumthin dat begins wid
__CONFIG
and has many parameters in it...
Can anyone plz explain me...in detail...also wat is PWRTE_ON and PWRTE_OFF...???

i have brought the PIC16f877 chip... is der any way by testing if the chip is working or nt..???

plz help me..plz...

thanx..
Title: Re: regarding MPLAB and PIC...
Post by: Admin on March 07, 2007, 02:33:36 PM
i dont know the answers to your other questions, but i can help you on this one . . .

Quote
is der any way by testing if the chip is working or nt.
the easiest test is to make a digital output pin go high, then use a multimeter to measure if the pin is high or low.
Title: Re: regarding MPLAB and PIC...
Post by: Kohanbash on March 07, 2007, 09:11:43 PM
__config is an assembler directive that indicates the configuration bits to use. if you set the config options than you don't need to use the GUI to set compile options when programming the device.

the config bits are code protect, watchdog timer, power up timer,  and setting the oscillator type. The code protect bits are kind of complicated (the easiest is to disable them by using all 1's or h'3FF', but the other bits are simple to figure out and add on.

I don't know much about the ~PWRTE other than that its the power up timer and it is usually set to enable (ie '0').

Note: their are 2 underbars in front of the config (ie. 2 x _ = __config)
Title: Re: regarding MPLAB and PIC...
Post by: Admin on March 07, 2007, 09:46:55 PM
sounds exactly like fuse settings for AVR microcontrollers . . .
Title: Re: regarding MPLAB and PIC...
Post by: JesseWelling on March 07, 2007, 10:46:20 PM
pretty much. I was trying to dig up my old code for my goldfish bot. I think I used the config for fuse programing.
but yea my avr recently broke and became unresponsive  :'( good thing they're only $49.
Title: Re: regarding MPLAB and PIC...
Post by: Hal9000 on March 08, 2007, 07:35:35 AM
Yeah, these are all fuse settings I think.

All I can really say is that if you go onto the Microchip website then there are datasheets and stuff to flick through.

I've only just got used to using them myself, and it is a useful thing to know how to do!
Title: Re: regarding MPLAB and PIC...
Post by: Admin on March 08, 2007, 10:08:32 AM
just a note . . . be very careful when changing fuse settings . . .

i broke several AVR cause I didnt know what I was doing . . .
Title: Re: regarding MPLAB and PIC...
Post by: Hal9000 on March 08, 2007, 12:39:20 PM
Surely fuse settings only mean stuff like...........I think when I ticked the box for low voltage programming, the program halted every time I went near it.

It didn't damage the device though. Can it really damage stuff?
Title: Re: regarding MPLAB and PIC...
Post by: JesseWelling on March 08, 2007, 01:16:49 PM
yea if you burn the "No more burning fuse" it won't program any more.
Title: Re: regarding MPLAB and PIC...
Post by: Hal9000 on March 08, 2007, 01:45:20 PM
Woah. never saw that one!
Title: Re: regarding MPLAB and PIC...
Post by: JesseWelling on March 08, 2007, 03:38:57 PM
I don't remember what it's called but most chips these days have them.
Mostly the fuses deal with clock scaling and eeprom writing and stuff like that.
Title: Re: regarding MPLAB and PIC...
Post by: Admin on March 08, 2007, 10:42:53 PM
if you set the fuse to the wrong timer speed, the AVR wont be programmable anymore unless you get a new crystal for that speed . . .
Title: Re: regarding MPLAB and PIC...
Post by: Hal9000 on March 09, 2007, 03:40:04 AM
Ohh, right I see.

Mainly I just click on HS or INT (High speed or Internal Oscillator) so it's always ok