Another beginer looking for a jumpstart

Started by Travis L. F Bailey November 15, 2003
I am another newbie, trying to get started with pic programming.

I have the following items:
MPLAB, Pic-MCP-C programmer, a c18 compiler and three pic18f452 chips,
powered protoboard. and various other supplies

I want to get started and just get a simple LED to blink. Does any one
have a simple schematic to hook up LEDs on port b?

I am not totally sure which pins get what. I think it should be the
following:

Pins 11,32 - +5V
Pins 12,31 - Ground
Pins 13,14 - Resonator
Pin 33-40 - LEDs

Sample C code I am using:
/*
* This is example 1 from "Getting Started with MPLAB C18".
*/

#include <p18cxxx.h> /* for TRISB and PORTB declarations */

int counter;
void main (void)
{
counter = 0;
TRISB = 0; /* configure PORTB for output */
while (counter < 11111112)
{
PORTB = counter; /* display value of 'counter' on the LEDs */
Delay1KTCYx(1); /* delay 1000 */
counter++;
}
}

This does compile and I have programmed the PIC chip. But LEDs are no
lighting. I am assuming I have something improperly wired.
Any Ideas?

Thanks

Travis Bailey




I don't see the part where you set the PIC CONFIG word. By default,
the oscillator is set to use an RC circuit and not a crystal or
resonator. See page 195 of the manual.

In fact, configuartion of this chip is quite advanced. Maybe the
compiler makes some assumptions? It is certainly more complex than
the 16F87x series.

Pull pin 1 to +5V through a 10k resistor.

--- In , "Travis L. F Bailey" <tbailey@l...>
wrote:
> I am another newbie, trying to get started with pic programming.
>
> I have the following items:
> MPLAB, Pic-MCP-C programmer, a c18 compiler and three pic18f452
chips,
> powered protoboard. and various other supplies
>
> I want to get started and just get a simple LED to blink. Does any
one
> have a simple schematic to hook up LEDs on port b?
>
> I am not totally sure which pins get what. I think it should be
the
> following:
>
> Pins 11,32 - +5V
> Pins 12,31 - Ground
> Pins 13,14 - Resonator
> Pin 33-40 - LEDs
>
> Sample C code I am using:
> /*
> * This is example 1 from "Getting Started with MPLAB C18".
> */
>
> #include <p18cxxx.h> /* for TRISB and PORTB declarations */
>
> int counter;
> void main (void)
> {
> counter = 0;
> TRISB = 0; /* configure PORTB for output */
> while (counter < 11111112)
> {
> PORTB = counter; /* display value of 'counter' on the
LEDs */
> Delay1KTCYx(1); /* delay 1000 */
> counter++;
> }
> }
>
> This does compile and I have programmed the PIC chip. But LEDs are
no
> lighting. I am assuming I have something improperly wired. >
> Any Ideas?
>
> Thanks
>
> Travis Bailey





I depend on mplab for the config word. I switched timing to  HS-PLL Enabled. I don't understand it. But now things seem to be working, except for the led in RB5.
I have change my c code a little. and the LED's all light except the one on RB5. I have used two seperate pic chips and verified the LED does work on a differnt pin.
Any ideas?

Here is the code:
/*
 * This is example 1 from "Getting Started with MPLAB C18".
 */

#include <p18cxxx.h>   /* for TRISB and PORTB declarations */
#include <delays.h>

int counter;
void main (void)
{
    TRISB = 0;            /* configure PORTB for output */
while (1)
 {
    counter = 1;
    while (counter < 256)
    {
       PORTB = counter;   /* display value of 'counter' on the LEDs */
       Delay10KTCYx(1000); /* delay 1000 */
       counter++;
       PORTB = 0;
       Delay10KTCYx(500);
    }
 }
}
  

rtstofer wrote:
I don't see the part where you set the PIC CONFIG word. By default,
the oscillator is set to use an RC circuit and not a crystal or resonator. See
page 195 of the manual.
In fact, configuartion of this chip is quite advanced. Maybe the compiler makes
some assumptions? It is certainly more complex than the 16F87x series.
Pull pin 1 to +5V through a 10k resistor.
--- In p...@yahoogroups.com, "Travis L. F Bailey" <tbailey@l...> wrote:
I am another newbie, trying to get started with pic programming.
I have the following items:
MPLAB, Pic-MCP-C programmer, a c18 compiler and three pic18f452 
chips, 
powered protoboard. and various other supplies
I want to get started and just get a simple LED to blink. Does any 
one 
have a simple schematic to hook up LEDs on port b?
I am not totally sure which pins get what. I think it should be 
the 
following:
Pins 11,32 - +5V
Pins 12,31 - Ground
Pins 13,14 - Resonator
Pin 33-40 - LEDs
Sample C code I am using:
/*
* This is example 1 from "Getting Started with MPLAB C18".
*/
#include <p18cxxx.h> /* for TRISB and PORTB declarations */
int counter;
void main (void)
{
counter = 0;
TRISB = 0; /* configure PORTB for output */
while (counter < 11111112)
{
PORTB = counter; /* display value of 'counter' on the 
LEDs */
 Delay1KTCYx(1); /* delay 1000 */
counter++;
}
}
This does compile and I have programmed the PIC chip. But LEDs are 
no 
lighting. I am assuming I have something improperly wired.
Any Ideas?
Thanks
Travis Bailey
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cidU11
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/dN_tlB/TM
---------------------------------~->
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
">http://docs.yahoo.com/info/terms/ 




See page 9-2 of the datasheet. As long as you enable LVP, whether
you use it or not, you have to handle PORTB.5 as a special case.

Basically, set LATB = 0

--- In , "Travis L. F Bailey" <tbailey@l...>
wrote:
> I depend on mplab for the config word. I switched timing to HS-
PLL
> Enabled. I don't understand it. But now things seem to be working,
> except for the led in RB5.
> I have change my c code a little. and the LED's all light except
the one
> on RB5. I have used two seperate pic chips and verified the LED
does
> work on a differnt pin.
> Any ideas?
>
> Here is the code:
> /*
> * This is example 1 from "Getting Started with MPLAB C18".
> */
>
> #include <p18cxxx.h> /* for TRISB and PORTB declarations */
> #include <delays.h>
>
> int counter;
> void main (void)
> {
> TRISB = 0; /* configure PORTB for output */
> while (1)
> {
> counter = 1;
> while (counter < 256)
> {
> PORTB = counter; /* display value of 'counter' on the
LEDs */
> Delay10KTCYx(1000); /* delay 1000 */
> counter++;
> PORTB = 0;
> Delay10KTCYx(500);
> }
> }
> } > rtstofer wrote:
>
> >I don't see the part where you set the PIC CONFIG word. By
default,
> >the oscillator is set to use an RC circuit and not a crystal or
> >resonator. See page 195 of the manual.
> >
> >In fact, configuartion of this chip is quite advanced. Maybe the
> >compiler makes some assumptions? It is certainly more complex
than
> >the 16F87x series.
> >
> >Pull pin 1 to +5V through a 10k resistor.
> >
> >--- In , "Travis L. F Bailey"
<tbailey@l...>
> >wrote:
> >
> >
> >>I am another newbie, trying to get started with pic programming.
> >>
> >>I have the following items:
> >>MPLAB, Pic-MCP-C programmer, a c18 compiler and three pic18f452
> >>
> >>
> >chips,
> >
> >
> >>powered protoboard. and various other supplies
> >>
> >>I want to get started and just get a simple LED to blink. Does
any
> >>
> >>
> >one
> >
> >
> >>have a simple schematic to hook up LEDs on port b?
> >>
> >>I am not totally sure which pins get what. I think it should be
> >>
> >>
> >the
> >
> >
> >>following:
> >>
> >>Pins 11,32 - +5V
> >>Pins 12,31 - Ground
> >>Pins 13,14 - Resonator
> >>Pin 33-40 - LEDs
> >>
> >>Sample C code I am using:
> >>/*
> >> * This is example 1 from "Getting Started with MPLAB C18".
> >> */
> >>
> >>#include <p18cxxx.h> /* for TRISB and PORTB declarations */
> >>
> >>int counter;
> >>void main (void)
> >>{
> >> counter = 0;
> >> TRISB = 0; /* configure PORTB for output */
> >> while (counter < 11111112)
> >> {
> >> PORTB = counter; /* display value of 'counter' on the
> >>
> >>
> >LEDs */
> >
> >
> >> Delay1KTCYx(1); /* delay 1000 */
> >> counter++;
> >> }
> >>}
> >>
> >>This does compile and I have programmed the PIC chip. But LEDs
are
> >>
> >>
> >no
> >
> >
> >>lighting. I am assuming I have something improperly wired.
> >>
> >>
> >>
> >>Any Ideas?
> >>
> >>Thanks
> >>
> >>Travis Bailey
> >>
> >>
> >
> >
> >
> >to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> >
> >">http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> >






I turned off the LVP and my LEDs are now working as expected. Thanks!!!
.
Now I can move on to my next problem.

Any idea on how to hook the pic up to a computer serial port. I have
some C-code for USART support, but I don't know what pins to wire.
I plan to use cat 5 cable and a rj45 to db9f modular adapter. i have
to wire the rj45 to db9f and then connect to pic. Any pointers?
Thanks again.

Travis

rtstofer wrote:

>See page 9-2 of the datasheet. As long as you enable LVP, whether
>you use it or not, you have to handle PORTB.5 as a special case.
>
>Basically, set LATB = 0
>
>--- In , "Travis L. F Bailey" <tbailey@l...>
>wrote: >>I depend on mplab for the config word. I switched timing to HS-
>>
>>
>PLL >>Enabled. I don't understand it. But now things seem to be working,
>>except for the led in RB5.
>>I have change my c code a little. and the LED's all light except
>>
>>
>the one >>on RB5. I have used two seperate pic chips and verified the LED
>>
>>
>does >>work on a differnt pin.
>>Any ideas?
>>
>>Here is the code:
>>/*
>> * This is example 1 from "Getting Started with MPLAB C18".
>> */
>>
>>#include <p18cxxx.h> /* for TRISB and PORTB declarations */
>>#include <delays.h>
>>
>>int counter;
>>void main (void)
>>{
>> TRISB = 0; /* configure PORTB for output */
>>while (1)
>> {
>> counter = 1;
>> while (counter < 256)
>> {
>> PORTB = counter; /* display value of 'counter' on the
>>
>>
>LEDs */ >> Delay10KTCYx(1000); /* delay 1000 */
>> counter++;
>> PORTB = 0;
>> Delay10KTCYx(500);
>> }
>> }
>>}
>>
>>
>>rtstofer wrote:
>>
>>
>>
>>>I don't see the part where you set the PIC CONFIG word. By
>>>
>>>
>default, >>>the oscillator is set to use an RC circuit and not a crystal or
>>>resonator. See page 195 of the manual.
>>>
>>>In fact, configuartion of this chip is quite advanced. Maybe the
>>>compiler makes some assumptions? It is certainly more complex
>>>
>>>
>than >>>the 16F87x series.
>>>
>>>Pull pin 1 to +5V through a 10k resistor.
>>>
>>>--- In , "Travis L. F Bailey"
>>>
>>>
><tbailey@l... >>>wrote:
>>>
>>>
>>>
>>>
>>>>I am another newbie, trying to get started with pic programming.
>>>>
>>>>I have the following items:
>>>>MPLAB, Pic-MCP-C programmer, a c18 compiler and three pic18f452
>>>>
>>>>
>>>>
>>>>
>>>chips,
>>>
>>>
>>>
>>>
>>>>powered protoboard. and various other supplies
>>>>
>>>>I want to get started and just get a simple LED to blink. Does
>>>>
>>>>
>any >>>>
>>>>
>>>>
>>>>
>>>one
>>>
>>>
>>>
>>>
>>>>have a simple schematic to hook up LEDs on port b?
>>>>
>>>>I am not totally sure which pins get what. I think it should be
>>>>
>>>>
>>>>
>>>>
>>>the
>>>
>>>
>>>
>>>
>>>>following:
>>>>
>>>>Pins 11,32 - +5V
>>>>Pins 12,31 - Ground
>>>>Pins 13,14 - Resonator
>>>>Pin 33-40 - LEDs
>>>>
>>>>Sample C code I am using:
>>>>/*
>>>>* This is example 1 from "Getting Started with MPLAB C18".
>>>>*/
>>>>
>>>>#include <p18cxxx.h> /* for TRISB and PORTB declarations */
>>>>
>>>>int counter;
>>>>void main (void)
>>>>{
>>>> counter = 0;
>>>> TRISB = 0; /* configure PORTB for output */
>>>> while (counter < 11111112)
>>>> {
>>>> PORTB = counter; /* display value of 'counter' on the
>>>>
>>>>
>>>>
>>>>
>>>LEDs */
>>>
>>>
>>>
>>>
>>>> Delay1KTCYx(1); /* delay 1000 */
>>>> counter++;
>>>> }
>>>>}
>>>>
>>>>This does compile and I have programmed the PIC chip. But LEDs
>>>>
>>>>
>are >>>>
>>>>
>>>>
>>>>
>>>no
>>>
>>>
>>>
>>>
>>>>lighting. I am assuming I have something improperly wired.
>>>>
>>>>
>>>>
>>>>Any Ideas?
>>>>
>>>>Thanks
>>>>
>>>>Travis Bailey
>>>>
>>>>
>>>>
>>>>
>>>
>>>to unsubscribe, go to http://www.yahoogroups.com and follow the
>>>
>>>
>instructions >>>">http://docs.yahoo.com/info/terms/ >>>
>>>
>>>
>>>
>> >
>to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
>
>">http://docs.yahoo.com/info/terms/






I don't want to get in the middle of all that adapter stuff but if
you look at www.junun.org for the Mark III robot in the datasheets
section you will find a link to the schematic. You will find on the
schematic how to connect the DS232 (or MAX232 I believe) to convert
from logic levels to RS232 levels for connection to the PC. You
will also see which pins on the DB9 the Rx and Tx signals need to be
connected to.

If you decide to implement CTS and RTS this is also shown.

Personally, I would use the MAX233 device since it does not require
external capacitors but I think is has more pins. Your choice. --- In , "Travis L. F Bailey" <tbailey@l...>
wrote:
>
> I turned off the LVP and my LEDs are now working as expected.
Thanks!!!
> .
> Now I can move on to my next problem.
>
> Any idea on how to hook the pic up to a computer serial port. I
have
> some C-code for USART support, but I don't know what pins to wire.
> I plan to use cat 5 cable and a rj45 to db9f modular adapter.
i have
> to wire the rj45 to db9f and then connect to pic. Any pointers?
> Thanks again.
>
> Travis
>
> rtstofer wrote:
>
> >See page 9-2 of the datasheet. As long as you enable LVP,
whether
> >you use it or not, you have to handle PORTB.5 as a special case.
> >
> >Basically, set LATB = 0
> >
> >--- In , "Travis L. F Bailey"
<tbailey@l...>
> >wrote:
> >
> >
> >>I depend on mplab for the config word. I switched timing to HS-
> >>
> >>
> >PLL
> >
> >
> >>Enabled. I don't understand it. But now things seem to be
working,
> >>except for the led in RB5.
> >>I have change my c code a little. and the LED's all light except
> >>
> >>
> >the one
> >
> >
> >>on RB5. I have used two seperate pic chips and verified the LED
> >>
> >>
> >does
> >
> >
> >>work on a differnt pin.
> >>Any ideas?
> >>
> >>Here is the code:
> >>/*
> >> * This is example 1 from "Getting Started with MPLAB C18".
> >> */
> >>
> >>#include <p18cxxx.h> /* for TRISB and PORTB declarations */
> >>#include <delays.h>
> >>
> >>int counter;
> >>void main (void)
> >>{
> >> TRISB = 0; /* configure PORTB for output */
> >>while (1)
> >> {
> >> counter = 1;
> >> while (counter < 256)
> >> {
> >> PORTB = counter; /* display value of 'counter' on the
> >>
> >>
> >LEDs */
> >
> >
> >> Delay10KTCYx(1000); /* delay 1000 */
> >> counter++;
> >> PORTB = 0;
> >> Delay10KTCYx(500);
> >> }
> >> }
> >>}
> >>
> >>
> >>rtstofer wrote:
> >>
> >>
> >>
> >>>I don't see the part where you set the PIC CONFIG word. By
> >>>
> >>>
> >default,
> >
> >
> >>>the oscillator is set to use an RC circuit and not a crystal or
> >>>resonator. See page 195 of the manual.
> >>>
> >>>In fact, configuartion of this chip is quite advanced. Maybe
the
> >>>compiler makes some assumptions? It is certainly more complex
> >>>
> >>>
> >than
> >
> >
> >>>the 16F87x series.
> >>>
> >>>Pull pin 1 to +5V through a 10k resistor.
> >>>
> >>>--- In , "Travis L. F Bailey"
> >>>
> >>>
> ><tbailey@l...>
> >
> >
> >>>wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>I am another newbie, trying to get started with pic
programming.
> >>>>
> >>>>I have the following items:
> >>>>MPLAB, Pic-MCP-C programmer, a c18 compiler and three
pic18f452
> >>>>
> >>>>
> >>>>
> >>>>
> >>>chips,
> >>>
> >>>
> >>>
> >>>
> >>>>powered protoboard. and various other supplies
> >>>>
> >>>>I want to get started and just get a simple LED to blink. Does
> >>>>
> >>>>
> >any
> >
> >
> >>>>
> >>>>
> >>>>
> >>>>
> >>>one
> >>>
> >>>
> >>>
> >>>
> >>>>have a simple schematic to hook up LEDs on port b?
> >>>>
> >>>>I am not totally sure which pins get what. I think it should
be
> >>>>
> >>>>
> >>>>
> >>>>
> >>>the
> >>>
> >>>
> >>>
> >>>
> >>>>following:
> >>>>
> >>>>Pins 11,32 - +5V
> >>>>Pins 12,31 - Ground
> >>>>Pins 13,14 - Resonator
> >>>>Pin 33-40 - LEDs
> >>>>
> >>>>Sample C code I am using:
> >>>>/*
> >>>>* This is example 1 from "Getting Started with MPLAB C18".
> >>>>*/
> >>>>
> >>>>#include <p18cxxx.h> /* for TRISB and PORTB declarations */
> >>>>
> >>>>int counter;
> >>>>void main (void)
> >>>>{
> >>>> counter = 0;
> >>>> TRISB = 0; /* configure PORTB for output */
> >>>> while (counter < 11111112)
> >>>> {
> >>>> PORTB = counter; /* display value of 'counter' on the
> >>>>
> >>>>
> >>>>
> >>>>
> >>>LEDs */
> >>>
> >>>
> >>>
> >>>
> >>>> Delay1KTCYx(1); /* delay 1000 */
> >>>> counter++;
> >>>> }
> >>>>}
> >>>>
> >>>>This does compile and I have programmed the PIC chip. But LEDs
> >>>>
> >>>>
> >are
> >
> >
> >>>>
> >>>>
> >>>>
> >>>>
> >>>no
> >>>
> >>>
> >>>
> >>>
> >>>>lighting. I am assuming I have something improperly wired.
> >>>>
> >>>>
> >>>>
> >>>>Any Ideas?
> >>>>
> >>>>Thanks
> >>>>
> >>>>Travis Bailey
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>to unsubscribe, go to http://www.yahoogroups.com and follow the
> >>>
> >>>
> >instructions
> >
> >
> >>>">http://docs.yahoo.com/info/terms/
> >
> >
> >>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> >
> >">http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> >





or use a max232A (or equiv) since it only requires .1 uF caps (and
thus takes a lot less space). The ST version can be had 10 for $10
from bg micro (1.25 for 1). it seems to work pretty well so I
stocked up. it also works fine with 1uF caps if you still have a
bunch lying around. The 233, last time I looked, was like $5.

by the way, I found a great additional use for the max232 since I
have a bunch - generating a -V from a single +5 supply. (its a long
story but I got a 40x2 LCD for $6 that needs negative contrast
voltage).

phil

--- In , "rtstofer" <rstofer@p...> wrote:
>
> I don't want to get in the middle of all that adapter stuff but if
> you look at www.junun.org for the Mark III robot in the datasheets
> section you will find a link to the schematic. You will find on
the
> schematic how to connect the DS232 (or MAX232 I believe) to convert
> from logic levels to RS232 levels for connection to the PC. You
> will also see which pins on the DB9 the Rx and Tx signals need to
be
> connected to.
>
> If you decide to implement CTS and RTS this is also shown.
>
> Personally, I would use the MAX233 device since it does not require
> external capacitors but I think is has more pins. Your choice. > --- In , "Travis L. F Bailey" <tbailey@l...>
> wrote:
> >
> > I turned off the LVP and my LEDs are now working as expected.
> Thanks!!!
> > .
> > Now I can move on to my next problem.
> >
> > Any idea on how to hook the pic up to a computer serial port. I
> have
> > some C-code for USART support, but I don't know what pins to
wire.
> > I plan to use cat 5 cable and a rj45 to db9f modular adapter.
> i have
> > to wire the rj45 to db9f and then connect to pic. Any pointers?
> > Thanks again.
> >
> > Travis
> >
> > rtstofer wrote:
> >
> > >See page 9-2 of the datasheet. As long as you enable LVP,
> whether
> > >you use it or not, you have to handle PORTB.5 as a special case.
> > >
> > >Basically, set LATB = 0
> > >
> > >--- In , "Travis L. F Bailey"
> <tbailey@l...>
> > >wrote:
> > >
> > >
> > >>I depend on mplab for the config word. I switched timing to HS-
> > >>
> > >>
> > >PLL
> > >
> > >
> > >>Enabled. I don't understand it. But now things seem to be
> working,
> > >>except for the led in RB5.
> > >>I have change my c code a little. and the LED's all light
except
> > >>
> > >>
> > >the one
> > >
> > >
> > >>on RB5. I have used two seperate pic chips and verified the LED
> > >>
> > >>
> > >does
> > >
> > >
> > >>work on a differnt pin.
> > >>Any ideas?
> > >>
> > >>Here is the code:
> > >>/*
> > >> * This is example 1 from "Getting Started with MPLAB C18".
> > >> */
> > >>
> > >>#include <p18cxxx.h> /* for TRISB and PORTB declarations */
> > >>#include <delays.h>
> > >>
> > >>int counter;
> > >>void main (void)
> > >>{
> > >> TRISB = 0; /* configure PORTB for output */
> > >>while (1)
> > >> {
> > >> counter = 1;
> > >> while (counter < 256)
> > >> {
> > >> PORTB = counter; /* display value of 'counter' on the
> > >>
> > >>
> > >LEDs */
> > >
> > >
> > >> Delay10KTCYx(1000); /* delay 1000 */
> > >> counter++;
> > >> PORTB = 0;
> > >> Delay10KTCYx(500);
> > >> }
> > >> }
> > >>}
> > >>
> > >>
> > >>rtstofer wrote:
> > >>
> > >>
> > >>
> > >>>I don't see the part where you set the PIC CONFIG word. By
> > >>>
> > >>>
> > >default,
> > >
> > >
> > >>>the oscillator is set to use an RC circuit and not a crystal
or
> > >>>resonator. See page 195 of the manual.
> > >>>
> > >>>In fact, configuartion of this chip is quite advanced. Maybe
> the
> > >>>compiler makes some assumptions? It is certainly more complex
> > >>>
> > >>>
> > >than
> > >
> > >
> > >>>the 16F87x series.
> > >>>
> > >>>Pull pin 1 to +5V through a 10k resistor.
> > >>>
> > >>>--- In , "Travis L. F Bailey"
> > >>>
> > >>>
> > ><tbailey@l...>
> > >
> > >
> > >>>wrote:
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>>I am another newbie, trying to get started with pic
> programming.
> > >>>>
> > >>>>I have the following items:
> > >>>>MPLAB, Pic-MCP-C programmer, a c18 compiler and three
> pic18f452
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>chips,
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>>powered protoboard. and various other supplies
> > >>>>
> > >>>>I want to get started and just get a simple LED to blink.
Does
> > >>>>
> > >>>>
> > >any
> > >
> > >
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>one
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>>have a simple schematic to hook up LEDs on port b?
> > >>>>
> > >>>>I am not totally sure which pins get what. I think it should
> be
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>the
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>>following:
> > >>>>
> > >>>>Pins 11,32 - +5V
> > >>>>Pins 12,31 - Ground
> > >>>>Pins 13,14 - Resonator
> > >>>>Pin 33-40 - LEDs
> > >>>>
> > >>>>Sample C code I am using:
> > >>>>/*
> > >>>>* This is example 1 from "Getting Started with MPLAB C18".
> > >>>>*/
> > >>>>
> > >>>>#include <p18cxxx.h> /* for TRISB and PORTB declarations */
> > >>>>
> > >>>>int counter;
> > >>>>void main (void)
> > >>>>{
> > >>>> counter = 0;
> > >>>> TRISB = 0; /* configure PORTB for output */
> > >>>> while (counter < 11111112)
> > >>>> {
> > >>>> PORTB = counter; /* display value of 'counter' on the
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>LEDs */
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>> Delay1KTCYx(1); /* delay 1000 */
> > >>>> counter++;
> > >>>> }
> > >>>>}
> > >>>>
> > >>>>This does compile and I have programmed the PIC chip. But
LEDs
> > >>>>
> > >>>>
> > >are
> > >
> > >
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>no
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>>lighting. I am assuming I have something improperly wired.
> > >>>>
> > >>>>
> > >>>>
> > >>>>Any Ideas?
> > >>>>
> > >>>>Thanks
> > >>>>
> > >>>>Travis Bailey
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>>
> > >>>to unsubscribe, go to http://www.yahoogroups.com and follow
the
> > >>>
> > >>>
> > >instructions
> > >
> > >
> > >>>">http://docs.yahoo.com/info/terms/
> > >
> > >
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >
> > >
> > >
> > >to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions
> > >
> > >">http://docs.yahoo.com/info/terms/
> > >
> > >
> > >
> > >
> > >






Must be my lazy typing - on the actual schematic the device is a
DS232A which also uses the 0.1 uF capacitors. Huge difference!

But, again, I would go for the MAX233 and skip the capacitors.

--- In , "Phil" <phil1960us@y...> wrote:
> or use a max232A (or equiv) since it only requires .1 uF caps (and
> thus takes a lot less space). The ST version can be had 10 for
$10
> from bg micro (1.25 for 1). it seems to work pretty well so I
> stocked up. it also works fine with 1uF caps if you still have a
> bunch lying around. The 233, last time I looked, was like $5.
>
> by the way, I found a great additional use for the max232 since I
> have a bunch - generating a -V from a single +5 supply. (its a
long
> story but I got a 40x2 LCD for $6 that needs negative contrast
> voltage).
>
> phil
>
> --- In , "rtstofer" <rstofer@p...> wrote:
> >
> > I don't want to get in the middle of all that adapter stuff but
if
> > you look at www.junun.org for the Mark III robot in the
datasheets
> > section you will find a link to the schematic. You will find on
> the
> > schematic how to connect the DS232 (or MAX232 I believe) to
convert
> > from logic levels to RS232 levels for connection to the PC. You
> > will also see which pins on the DB9 the Rx and Tx signals need
to
> be
> > connected to.
> >
> > If you decide to implement CTS and RTS this is also shown.
> >
> > Personally, I would use the MAX233 device since it does not
require
> > external capacitors but I think is has more pins. Your choice.
> >
> >
> > --- In , "Travis L. F Bailey"
<tbailey@l...>
> > wrote:
> > >
> > > I turned off the LVP and my LEDs are now working as
expected.
> > Thanks!!!
> > > .
> > > Now I can move on to my next problem.
> > >
> > > Any idea on how to hook the pic up to a computer serial port.
I
> > have
> > > some C-code for USART support, but I don't know what pins to
> wire.
> > > I plan to use cat 5 cable and a rj45 to db9f modular
adapter.
> > i have
> > > to wire the rj45 to db9f and then connect to pic. Any pointers?
> > > Thanks again.
> > >
> > > Travis
> > >
> > > rtstofer wrote:
> > >
> > > >See page 9-2 of the datasheet. As long as you enable LVP,
> > whether
> > > >you use it or not, you have to handle PORTB.5 as a special
case.
> > > >
> > > >Basically, set LATB = 0
> > > >
> > > >--- In , "Travis L. F Bailey"
> > <tbailey@l...>
> > > >wrote:
> > > >
> > > >
> > > >>I depend on mplab for the config word. I switched timing to
HS-
> > > >>
> > > >>
> > > >PLL
> > > >
> > > >
> > > >>Enabled. I don't understand it. But now things seem to be
> > working,
> > > >>except for the led in RB5.
> > > >>I have change my c code a little. and the LED's all light
> except
> > > >>
> > > >>
> > > >the one
> > > >
> > > >
> > > >>on RB5. I have used two seperate pic chips and verified the
LED
> > > >>
> > > >>
> > > >does
> > > >
> > > >
> > > >>work on a differnt pin.
> > > >>Any ideas?
> > > >>
> > > >>Here is the code:
> > > >>/*
> > > >> * This is example 1 from "Getting Started with MPLAB C18".
> > > >> */
> > > >>
> > > >>#include <p18cxxx.h> /* for TRISB and PORTB declarations */
> > > >>#include <delays.h>
> > > >>
> > > >>int counter;
> > > >>void main (void)
> > > >>{
> > > >> TRISB = 0; /* configure PORTB for output */
> > > >>while (1)
> > > >> {
> > > >> counter = 1;
> > > >> while (counter < 256)
> > > >> {
> > > >> PORTB = counter; /* display value of 'counter' on
the
> > > >>
> > > >>
> > > >LEDs */
> > > >
> > > >
> > > >> Delay10KTCYx(1000); /* delay 1000 */
> > > >> counter++;
> > > >> PORTB = 0;
> > > >> Delay10KTCYx(500);
> > > >> }
> > > >> }
> > > >>}
> > > >>
> > > >>
> > > >>rtstofer wrote:
> > > >>
> > > >>
> > > >>
> > > >>>I don't see the part where you set the PIC CONFIG word. By
> > > >>>
> > > >>>
> > > >default,
> > > >
> > > >
> > > >>>the oscillator is set to use an RC circuit and not a
crystal
> or
> > > >>>resonator. See page 195 of the manual.
> > > >>>
> > > >>>In fact, configuartion of this chip is quite advanced.
Maybe
> > the
> > > >>>compiler makes some assumptions? It is certainly more
complex
> > > >>>
> > > >>>
> > > >than
> > > >
> > > >
> > > >>>the 16F87x series.
> > > >>>
> > > >>>Pull pin 1 to +5V through a 10k resistor.
> > > >>>
> > > >>>--- In , "Travis L. F Bailey"
> > > >>>
> > > >>>
> > > ><tbailey@l...>
> > > >
> > > >
> > > >>>wrote:
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>>>I am another newbie, trying to get started with pic
> > programming.
> > > >>>>
> > > >>>>I have the following items:
> > > >>>>MPLAB, Pic-MCP-C programmer, a c18 compiler and three
> > pic18f452
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>chips,
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>>>powered protoboard. and various other supplies
> > > >>>>
> > > >>>>I want to get started and just get a simple LED to blink.
> Does
> > > >>>>
> > > >>>>
> > > >any
> > > >
> > > >
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>one
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>>>have a simple schematic to hook up LEDs on port b?
> > > >>>>
> > > >>>>I am not totally sure which pins get what. I think it
should
> > be
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>the
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>>>following:
> > > >>>>
> > > >>>>Pins 11,32 - +5V
> > > >>>>Pins 12,31 - Ground
> > > >>>>Pins 13,14 - Resonator
> > > >>>>Pin 33-40 - LEDs
> > > >>>>
> > > >>>>Sample C code I am using:
> > > >>>>/*
> > > >>>>* This is example 1 from "Getting Started with MPLAB C18".
> > > >>>>*/
> > > >>>>
> > > >>>>#include <p18cxxx.h> /* for TRISB and PORTB declarations
*/
> > > >>>>
> > > >>>>int counter;
> > > >>>>void main (void)
> > > >>>>{
> > > >>>> counter = 0;
> > > >>>> TRISB = 0; /* configure PORTB for output */
> > > >>>> while (counter < 11111112)
> > > >>>> {
> > > >>>> PORTB = counter; /* display value of 'counter' on
the
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>LEDs */
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>>> Delay1KTCYx(1); /* delay 1000 */
> > > >>>> counter++;
> > > >>>> }
> > > >>>>}
> > > >>>>
> > > >>>>This does compile and I have programmed the PIC chip. But
> LEDs
> > > >>>>
> > > >>>>
> > > >are
> > > >
> > > >
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>no
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>>>lighting. I am assuming I have something improperly wired.
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>Any Ideas?
> > > >>>>
> > > >>>>Thanks
> > > >>>>
> > > >>>>Travis Bailey
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>
> > > >>>to unsubscribe, go to http://www.yahoogroups.com and follow
> the
> > > >>>
> > > >>>
> > > >instructions
> > > >
> > > >
> > > >>>">http://docs.yahoo.com/info/terms/
> > > >
> > > >
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >
> > > >
> > > >
> > > >to unsubscribe, go to http://www.yahoogroups.com and follow
the
> > instructions
> > > >
> > > >">http://docs.yahoo.com/info/terms/
> > > >
> > > >
> > > >
> > > >
> > > >




--- In , "Phil" <phil1960us@y...> wrote:
> or use a max232A (or equiv) since it only requires .1 uF caps (and
> thus takes a lot less space). The ST version can be had 10 for $10
> from bg micro (1.25 for 1). it seems to work pretty well so I
> stocked up. it also works fine with 1uF caps if you still have a
> bunch lying around. The 233, last time I looked, was like $5.
>
> by the way, I found a great additional use for the max232 since I
> have a bunch - generating a -V from a single +5 supply. (its a
long
> story but I got a 40x2 LCD for $6 that needs negative contrast
> voltage).
>
> phil


I received 2 of the MAX233 chips, 20 pin, internal caps for my
WISP628 programmer.

Digi-Key offers the 20pin MAX233 DIP for a King Midas $7.45 ea.
the 16 pin MAX232 DIP is 75 cents for the TI version or $3.31 for the
MAX brand.

not sure how much you get caps for, but if cost or size is an issue,
the 16 pin is pretty attractive. Dave
<snip



not meaning to quibble but the TI part at digikey is the non-A part.
The A part is rated for higher speeds and uses .1 uF caps vs 1uF. I
didn't see a Max232A equiv on the TI site. too bad, that's a great
price for the non-A part.

--- In , "Dave Mucha" <davemucha@j...> wrote:
> --- In , "Phil" <phil1960us@y...> wrote:
> > or use a max232A (or equiv) since it only requires .1 uF caps
(and
> > thus takes a lot less space). The ST version can be had 10 for
$10
> > from bg micro (1.25 for 1). it seems to work pretty well so I
> > stocked up. it also works fine with 1uF caps if you still have a
> > bunch lying around. The 233, last time I looked, was like $5.
> >
> > by the way, I found a great additional use for the max232 since I
> > have a bunch - generating a -V from a single +5 supply. (its a
> long
> > story but I got a 40x2 LCD for $6 that needs negative contrast
> > voltage).
> >
> > phil > I received 2 of the MAX233 chips, 20 pin, internal caps for my
> WISP628 programmer.
>
> Digi-Key offers the 20pin MAX233 DIP for a King Midas $7.45 ea.
> the 16 pin MAX232 DIP is 75 cents for the TI version or $3.31 for
the
> MAX brand.
>
> not sure how much you get caps for, but if cost or size is an
issue,
> the 16 pin is pretty attractive. > Dave >
> <snip>