Forums

Help newbe with 16F87

Started by Unknown February 25, 2008
Can't get it to light a LED. I'm using MPLAB with CC5X compiler and
WinPIC programmer with an RCD programmer.  Here's the program: 
Compiles and programs with WinPic ok.

  void main( void)
{
	OSCCON= 0x7C;
    PORTB = 0x00;   
    TRISB = 0x00;  //outputs

	while (1)
	{
			PORTB=1;
	}
}

Here's the configure word from WinPic:
Internal RC osc, WDT Disabled: 11 1111 1111 1000 
Using an LED and 330 ohm from pin 7 to gnd.
Any help?

In article <83f4s39vroilvu9bmekmmbgg06smvos14b@4ax.com>, sdeyoreo@hotmail.com wrote:
>Can't get it to light a LED. I'm using MPLAB with CC5X compiler and >WinPIC programmer with an RCD programmer. Here's the program: >Compiles and programs with WinPic ok. > > void main( void) >{ > OSCCON= 0x7C; > PORTB = 0x00; > TRISB = 0x00; //outputs > > while (1) > { > PORTB=1; > } >} > >Here's the configure word from WinPic: >Internal RC osc, WDT Disabled: 11 1111 1111 1000 >Using an LED and 330 ohm from pin 7 to gnd. >Any help?
You didn't say which package you are using, but if you're using the DIP or SOIC package, then pin 7 is RB1 but your program is setting RB0. If you're using the SSOP or QFN package then pin 7 is in fact RB0 so it should work assuming no loose connections or LED connected backwards, etc.
On Mon, 25 Feb 2008 07:08:21 GMT, tom@nospam.com (Tom) wrote:

>In article <83f4s39vroilvu9bmekmmbgg06smvos14b@4ax.com>, sdeyoreo@hotmail.com wrote: >>Can't get it to light a LED. I'm using MPLAB with CC5X compiler and >>WinPIC programmer with an RCD programmer. Here's the program: >>Compiles and programs with WinPic ok. >> >> void main( void) >>{ >> OSCCON= 0x7C; >> PORTB = 0x00; >> TRISB = 0x00; //outputs >> >> while (1) >> { >> PORTB=1; >> } >>} >> >>Here's the configure word from WinPic: >>Internal RC osc, WDT Disabled: 11 1111 1111 1000 >>Using an LED and 330 ohm from pin 7 to gnd. >>Any help? > >You didn't say which package you are using, but if you're using the DIP
DIP package.
>or SOIC package, then pin 7 is RB1 but your program is setting RB0.
Silly me. I'll try it again.
> If you're >using the SSOP or QFN package then pin 7 is in fact RB0 so it should work >assuming no loose connections or LED connected backwards, etc.
Do I do anything with MCLR? I only have Vss,Vdd and pin 7 connected.
On Feb 26, 8:08=A0am, sdeyo...@hotmail.com wrote:
> On Mon, 25 Feb 2008 07:08:21 GMT, t...@nospam.com (Tom) wrote: > >In article <83f4s39vroilvu9bmekmmbgg06smvos...@4ax.com>, sdeyo...@hotmail=
.com wrote:
> >>Can't get it to light a LED. I'm using MPLAB with CC5X compiler and > >>WinPIC programmer with an RCD programmer. =A0Here's the program: > >>Compiles and programs with WinPic ok. > > >> =A0void main( void) > >>{ > >> =A0 =A0 =A0 =A0OSCCON=3D 0x7C; > >> =A0 =A0PORTB =3D 0x00; =A0 > >> =A0 =A0TRISB =3D 0x00; =A0//outputs > > >> =A0 =A0 =A0 =A0while (1) > >> =A0 =A0 =A0 =A0{ > >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0PORTB=3D1; > >> =A0 =A0 =A0 =A0} > >>} > > >>Here's the configure word from WinPic: > >>Internal RC osc, WDT Disabled: 11 1111 1111 1000 > >>Using an LED and 330 ohm from pin 7 to gnd. > >>Any help? > > >You didn't say which package you are using, but if you're using the DIP > DIP package. > >or SOIC package, then pin 7 is RB1 but your program is setting RB0. > > Silly me. I'll try it again.> If you're > >using the SSOP or QFN package then pin 7 is in fact RB0 so it should work=
> >assuming no loose connections or LED connected backwards, etc. > > Do I do anything with MCLR? I only have Vss,Vdd and pin 7 connected.- Hide=
quoted text -
> > - Show quoted text -
What about the OSC pins ?
On Tue, 26 Feb 2008 01:39:34 -0800 (PST), dk <mcdivyakanth@gmail.com>
wrote:

>On Feb 26, 8:08&#2013266080;am, sdeyo...@hotmail.com wrote: >> On Mon, 25 Feb 2008 07:08:21 GMT, t...@nospam.com (Tom) wrote: >> >In article <83f4s39vroilvu9bmekmmbgg06smvos...@4ax.com>, sdeyo...@hotmail.com wrote: >> >>Can't get it to light a LED. I'm using MPLAB with CC5X compiler and >> >>WinPIC programmer with an RCD programmer. &#2013266080;Here's the program: >> >>Compiles and programs with WinPic ok. >> >> >> &#2013266080;void main( void) >> >>{ >> >> &#2013266080; &#2013266080; &#2013266080; &#2013266080;OSCCON= 0x7C; >> >> &#2013266080; &#2013266080;PORTB = 0x00; &#2013266080; >> >> &#2013266080; &#2013266080;TRISB = 0x00; &#2013266080;//outputs >> >> >> &#2013266080; &#2013266080; &#2013266080; &#2013266080;while (1) >> >> &#2013266080; &#2013266080; &#2013266080; &#2013266080;{ >> >> &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;PORTB=1; >> >> &#2013266080; &#2013266080; &#2013266080; &#2013266080;} >> >>} >> >> >>Here's the configure word from WinPic: >> >>Internal RC osc, WDT Disabled: 11 1111 1111 1000 >> >>Using an LED and 330 ohm from pin 7 to gnd. >> >>Any help? >> >> >You didn't say which package you are using, but if you're using the DIP >> DIP package. >> >or SOIC package, then pin 7 is RB1 but your program is setting RB0. >> >> Silly me. I'll try it again.> If you're >> >using the SSOP or QFN package then pin 7 is in fact RB0 so it should work >> >assuming no loose connections or LED connected backwards, etc. >> >> Do I do anything with MCLR? I only have Vss,Vdd and pin 7 connected.- Hide quoted text - >> >> - Show quoted text - > >What about the OSC pins ?
Nothing connecting to them. I thought the config word I used, 11 1111 1111 1000, set it up for internal osc, no? I'll try using the ext RC. Like I said, I'm a newbe to this, though I've been using a BasicStamp and a 8051 with SDCC for a compiler. I've also used a robotic controller using an 18F8722 with MPLAB 7.2, though all the setup used pre-written code.