Next 18F458 Question

Started by June 22, 2004
I'm trying to establish simple I/O. Here's what I have. PortC
connected to my serial port on my computer. Here is my code:

#include <18F458.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock00000)
#use rs232(baud00, xmit=PIN_C6, rcv=PIN_C7)

void main() {
do {
output_high(PIN_B0);
delay_ms(1000);
printf("Hey now!");
delay_ms(1000);
output_low(PIN_B0);
} while (TRUE);
}

I have an LED connected to B0 and of course, the serial connections
for C6 and C7 and my connection to GND.

Any advice would be greatly appreciated.

Shamoon



You don't mention if you are using a
Max232 chip. You'll need one if you are
talking to the PC directly.

Also, for others he's using the CCS-C compiler.
I recognize the '#use' stuff.

And, are you sure you should be using the 'HS'
clock option? Perhaps the XT one would be better. --- In , honamos@y... wrote:
> I'm trying to establish simple I/O. Here's what I have. PortC
> connected to my serial port on my computer. Here is my code:
>
> #include <18F458.h>
> #fuses HS,NOWDT,NOPROTECT,NOLVP
> #use delay(clock00000)
> #use rs232(baud00, xmit=PIN_C6, rcv=PIN_C7)
>
> void main() {
> do {
> output_high(PIN_B0);
> delay_ms(1000);
> printf("Hey now!");
> delay_ms(1000);
> output_low(PIN_B0);
> } while (TRUE);
> }
>
> I have an LED connected to B0 and of course, the serial connections
> for C6 and C7 and my connection to GND.
>
> Any advice would be greatly appreciated.
>
> Shamoon





Why would I need a Max232 chip? Don't the PC and the PIC both use
TTL?

Shamoon
--- In , "Allan Lane" <allan.lane@h...> wrote:
> You don't mention if you are using a
> Max232 chip. You'll need one if you are
> talking to the PC directly.
>
> Also, for others he's using the CCS-C compiler.
> I recognize the '#use' stuff.
>
> And, are you sure you should be using the 'HS'
> clock option? Perhaps the XT one would be better. > --- In , honamos@y... wrote:
> > I'm trying to establish simple I/O. Here's what I have. PortC
> > connected to my serial port on my computer. Here is my code:
> >
> > #include <18F458.h>
> > #fuses HS,NOWDT,NOPROTECT,NOLVP
> > #use delay(clock00000)
> > #use rs232(baud00, xmit=PIN_C6, rcv=PIN_C7)
> >
> > void main() {
> > do {
> > output_high(PIN_B0);
> > delay_ms(1000);
> > printf("Hey now!");
> > delay_ms(1000);
> > output_low(PIN_B0);
> > } while (TRUE);
> > }
> >
> > I have an LED connected to B0 and of course, the serial
connections
> > for C6 and C7 and my connection to GND.
> >
> > Any advice would be greatly appreciated.
> >
> > Shamoon





----- Original Message -----
From: <>
To: <>
Sent: Tuesday, June 22, 2004 7:43 PM
Subject: [piclist] Re: Next 18F458 Question > Why would I need a Max232 chip? Don't the PC and the PIC both use
> TTL?
The PC serial port uses RS-232.

Leon



If you want to properly communicate with all RS232 type ports, you must
use a MAX232 in order to keep levels correct. Well worth the investment
and protection.
Rick

wrote:

> Why would I need a Max232 chip? Don't the PC and the PIC both use
> TTL?
>
> Shamoon
> --- In , "Allan Lane" <allan.lane@h...> wrote:
> > You don't mention if you are using a
> > Max232 chip. You'll need one if you are
> > talking to the PC directly.
> >
> > Also, for others he's using the CCS-C compiler.
> > I recognize the '#use' stuff.
> >
> > And, are you sure you should be using the 'HS'
> > clock option? Perhaps the XT one would be better.
> >
> >





or to be more general, some sort of level converter/rs232 driver.
The max232 is pretty much a standard and there are lots of second-
source versions for well less than the Maxim part costs. look at the
datasheet here.

--- In , rixy04 <rixy04@v...> wrote:
> If you want to properly communicate with all RS232 type ports, you
must
> use a MAX232 in order to keep levels correct. Well worth the
investment
> and protection.
> Rick
>
> honamos@y... wrote:
>
> > Why would I need a Max232 chip? Don't the PC and the PIC both
use
> > TTL?
> >
> > Shamoon
> > --- In , "Allan Lane" <allan.lane@h...>
wrote:
> > > You don't mention if you are using a
> > > Max232 chip. You'll need one if you are
> > > talking to the PC directly.
> > >
> > > Also, for others he's using the CCS-C compiler.
> > > I recognize the '#use' stuff.
> > >
> > > And, are you sure you should be using the 'HS'
> > > clock option? Perhaps the XT one would be better.
> > >
> > >





er, try here http://pdfserv.maxim-ic.com/en/ds/MAX220-MAX249.pdf

--- In , "Phil" <phil1960us@y...> wrote:
> or to be more general, some sort of level converter/rs232 driver.
> The max232 is pretty much a standard and there are lots of second-
> source versions for well less than the Maxim part costs. look at
the
> datasheet here.
>
> --- In , rixy04 <rixy04@v...> wrote:
> > If you want to properly communicate with all RS232 type ports,
you
> must
> > use a MAX232 in order to keep levels correct. Well worth the
> investment
> > and protection.
> > Rick
> >
> > honamos@y... wrote:
> >
> > > Why would I need a Max232 chip? Don't the PC and the PIC both
> use
> > > TTL?
> > >
> > > Shamoon
> > > --- In , "Allan Lane" <allan.lane@h...>
> wrote:
> > > > You don't mention if you are using a
> > > > Max232 chip. You'll need one if you are
> > > > talking to the PC directly.
> > > >
> > > > Also, for others he's using the CCS-C compiler.
> > > > I recognize the '#use' stuff.
> > > >
> > > > And, are you sure you should be using the 'HS'
> > > > clock option? Perhaps the XT one would be better.
> > > >
> > > >




No, the PC uses +/- 10V or so, and in addition the signals are inverted.
Use a MAX 202 or something similar.

h...@yahoo.com wrote:

 Why would I need a Max232 chip?  Don't the PC and the PIC both use
TTL?
--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Best Regards
Eirik Karlsen
 

In addition to the interface misunderstandings already discussed on this
thread, I'd like to point out that the LOW transition of PIN_B0 would be
only momentary in the code shown. It will be low only for the period of a
jump instruction back to the top of the program loop. As it stands your LED
will be either permanently lit or out depending on how it's wired. You need
to swap the last delay and low instructions if you want the lamp to flash.

At 04:08 AM 23/06/04, you wrote:
>I'm trying to establish simple I/O. Here's what I have. PortC
>connected to my serial port on my computer. Here is my code:
>
>#include <18F458.h>
>#fuses HS,NOWDT,NOPROTECT,NOLVP
>#use delay(clock00000)
>#use rs232(baud00, xmit=PIN_C6, rcv=PIN_C7)
>
>void main() {
> do {
> output_high(PIN_B0);
> delay_ms(1000);
> printf("Hey now!");
> delay_ms(1000);
> output_low(PIN_B0);
> } while (TRUE);
>}
>
>I have an LED connected to B0 and of course, the serial connections
>for C6 and C7 and my connection to GND.
>
>Any advice would be greatly appreciated.
>
>Shamoon >
>
>to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
>Yahoo! Groups Links >
>





Haha, yeah I caught that. Thanks though.
What do I need for:
http://www.maxstream.net/products/xstream/module/9xstream.php Thanks,
Shamoon

--- In , Phil Seakins <pseakins@a...> wrote:
> In addition to the interface misunderstandings already discussed
on this
> thread, I'd like to point out that the LOW transition of PIN_B0
would be
> only momentary in the code shown. It will be low only for the
period of a
> jump instruction back to the top of the program loop. As it stands
your LED
> will be either permanently lit or out depending on how it's wired.
You need
> to swap the last delay and low instructions if you want the lamp
to flash.
>
> At 04:08 AM 23/06/04, you wrote:
> >I'm trying to establish simple I/O. Here's what I have. PortC
> >connected to my serial port on my computer. Here is my code:
> >
> >#include <18F458.h>
> >#fuses HS,NOWDT,NOPROTECT,NOLVP
> >#use delay(clock00000)
> >#use rs232(baud00, xmit=PIN_C6, rcv=PIN_C7)
> >
> >void main() {
> > do {
> > output_high(PIN_B0);
> > delay_ms(1000);
> > printf("Hey now!");
> > delay_ms(1000);
> > output_low(PIN_B0);
> > } while (TRUE);
> >}
> >
> >I have an LED connected to B0 and of course, the serial
connections
> >for C6 and C7 and my connection to GND.
> >
> >Any advice would be greatly appreciated.
> >
> >Shamoon
> >
> >
> >
> >
> >to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> >Yahoo! Groups Links
> >
> >
> >
> >