Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Discussion Groups

Discussion Groups | Piclist | Re: Serial input

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

Serial input - JCullins - Oct 21 9:28:00 2005


Hello,
  I need to read rs232 in using and interrupt, do I need the URT function
in the PIC to do this?
I am driving a 4 digit 7 seg display with the B port pins 0 t0 6 and 7 is the
serial in. PortA.1 to PortA.4 are the digit select pins.
PortA.0 is analog in. Running at 20 MHZ. 
I am  using a PIC16F818 and would like to stick with it because of the price.
I can change to the PIC18F88 if I need to.
The problem I am having is interrupting the scanning of the displays to read the RS232 causes . My thought is to use the URT to read the serial in
and monitor the received bit to move the data into a variable. I only need to read one byte.
Is there a way to do this with out the URT?
Thanks
Jim




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Serial input - Gilmar Ribeiro de Oliveira - Oct 21 10:01:00 2005

Hello, Jim



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Serial input - rtstofer - Oct 21 10:37:00 2005

--- In piclist@picl..., "JCullins" <james_cullins@s...>
wrote:
>
> Hello,
> I need to read rs232 in using and interrupt, do I need the URT
function
> in the PIC to do this?

It is the best, if not the only, way to do this without mangling the
display.

> I am driving a 4 digit 7 seg display with the B port pins 0 t0 6
and 7 is the
> serial in. PortA.1 to PortA.4 are the digit select pins.
> PortA.0 is analog in. Running at 20 MHZ.
> I am using a PIC16F818 and would like to stick with it because of
the price.
> I can change to the PIC18F88 if I need to.

When I first read your post, I had forgotten that the 818 didn't
have a USART. If that is the 16F88 (not 18F) then it should work
well. It is fast becoming my favorite 18 pin device.

> The problem I am having is interrupting the scanning of the
displays to read the RS232 causes . My thought is to use the URT to
read the serial in
> and monitor the received bit to move the data into a variable. I
only need to read one byte.

That is exactly the problem. If you try to bit-bang the serial IO
you can not be driving the display at the same time.

> Is there a way to do this with out the URT?

You MIGHT be able to do it using a combination of timers and
interrupts on the incoming serial stream. Basically use the timers
to time between transitions but that seems like the long way around.

In my view, you would use the USART to receive the chars on a
character interrupt basis. If the message is really only one byte
then just set it in a variable. If the message can be somewhat
longer then stick the chars in a circular buffer and write an
enqueue and dequeue routine.

I suppose anything CAN be done but I would just go for the 16F88 and
get it over with.

> Thanks
> Jim




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: Re: Serial input - Alan Marconett - Oct 21 12:11:00 2005

Hi Jim, Rt(?),

The 16F88 may be the easiest way to go. But if one wants to set up Timer 0
to do "time slices" for LED refresh and derive other timing as well, then
the receive line could possibly be polled fast enough to get the bits
(provided the baud rate is not too high).

USARTS make things a lot easier!

Alan KM6VV

> -----Original Message-----
> From: piclist@picl... [mailto:piclist@picl...] On Behalf
> Of rtstofer
> Sent: Friday, October 21, 2005 7:38 AM
> To: piclist@picl...
> Subject: [piclist] Re: Serial input
>
> --- In piclist@picl..., "JCullins" <james_cullins@s...>
> wrote:
> >
> > Hello,
> > I need to read rs232 in using and interrupt, do I need the URT
> function
> > in the PIC to do this?
>
> It is the best, if not the only, way to do this without mangling the
> display.
>
> > I am driving a 4 digit 7 seg display with the B port pins 0 t0 6
> and 7 is the
> > serial in. PortA.1 to PortA.4 are the digit select pins.
> > PortA.0 is analog in. Running at 20 MHZ.
> > I am using a PIC16F818 and would like to stick with it because of
> the price.
> > I can change to the PIC18F88 if I need to.
>
> When I first read your post, I had forgotten that the 818 didn't
> have a USART. If that is the 16F88 (not 18F) then it should work
> well. It is fast becoming my favorite 18 pin device.
>
> > The problem I am having is interrupting the scanning of the
> displays to read the RS232 causes . My thought is to use the URT to
> read the serial in
> > and monitor the received bit to move the data into a variable. I
> only need to read one byte.
>
> That is exactly the problem. If you try to bit-bang the serial IO
> you can not be driving the display at the same time.
>
> > Is there a way to do this with out the URT?
>
> You MIGHT be able to do it using a combination of timers and
> interrupts on the incoming serial stream. Basically use the timers
> to time between transitions but that seems like the long way around.
>
> In my view, you would use the USART to receive the chars on a
> character interrupt basis. If the message is really only one byte
> then just set it in a variable. If the message can be somewhat
> longer then stick the chars in a circular buffer and write an
> enqueue and dequeue routine.
>
> I suppose anything CAN be done but I would just go for the 16F88 and
> get it over with.
>
> > Thanks
> > Jim
>





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Serial input - JCullins - Oct 21 12:44:00 2005

That was my first choice but the 818 is cheaper by about 65 cents. That adds up over a few hundred units. Still think I will give it a try.
Thanks for you conformation.
Jim
----- Original Message -----
From: rtstofer
To: p...@yahoogroups.com
Sent: Friday, October 21, 2005 9:37 AM
Subject: [piclist] Re: Serial input

--- In p...@yahoogroups.com, "JCullins" <james_cullins@s...>
wrote:
>
> Hello,
>   I need to read rs232 in using and interrupt, do I need the URT
function
> in the PIC to do this?

It is the best, if not the only, way to do this without mangling the
display.

> I am driving a 4 digit 7 seg display with the B port pins 0 t0 6
and 7 is the
> serial in. PortA.1 to PortA.4 are the digit select pins.
> PortA.0 is analog in. Running at 20 MHZ. 
> I am  using a PIC16F818 and would like to stick with it because of
the price.
> I can change to the PIC18F88 if I need to.

When I first read your post, I had forgotten that the 818 didn't
have a USART. If that is the 16F88 (not 18F) then it should work
well.  It is fast becoming my favorite 18 pin device.

> The problem I am having is interrupting the scanning of the
displays to read the RS232 causes . My thought is to use the URT to
read the serial in
> and monitor the received bit to move the data into a variable. I
only need to read one byte.

That is exactly the problem.  If you try to bit-bang the serial IO
you can not be driving the display at the same time.

> Is there a way to do this with out the URT?

You MIGHT be able to do it using a combination of timers and
interrupts on the incoming serial stream.  Basically use the timers
to time between transitions but that seems like the long way around.

In my view, you would use the USART to receive the chars on a
character interrupt basis.  If the message is really only one byte
then just set it in a variable.  If the message can be somewhat
longer then stick the chars in a circular buffer and write an
enqueue and dequeue routine.

I suppose anything CAN be done but I would just go for the 16F88 and
get it over with.

> Thanks
> Jim




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Serial input - JCullins - Oct 21 12:49:00 2005

Thanks Alan
After reading the post on my question I think I will give the 16F88 a try. I may even have one in my parts bin.
If I don't have it I may give the timer 0 a try. I was mulling that over in my mind, like you said just doing a refresh with the timer just may do it.
I only need to read one byte.
What is the best price you have found on the pic16F88 and 818. I use the
dip package. I do a lot of my own assembly and I don't see well enough to mess with he surface mount stuff.
thanks
Jim
----- Original Message -----
From: Alan Marconett
To: p...@yahoogroups.com
Sent: Friday, October 21, 2005 11:11 AM
Subject: RE: [piclist] Re: Serial input

Hi Jim, Rt(?),

The 16F88 may be the easiest way to go.  But if one wants to set up Timer 0
to do "time slices" for LED refresh and derive other timing as well, then
the receive line could possibly be polled fast enough to get the bits
(provided the baud rate is not too high).

USARTS make things a lot easier!

Alan  KM6VV

> -----Original Message-----
> From: p...@yahoogroups.com [mailto:p...@yahoogroups.com] On Behalf
> Of rtstofer
> Sent: Friday, October 21, 2005 7:38 AM
> To: p...@yahoogroups.com
> Subject: [piclist] Re: Serial input
>
> --- In p...@yahoogroups.com, "JCullins" <james_cullins@s...>
> wrote:
> >
> > Hello,
> >   I need to read rs232 in using and interrupt, do I need the URT
> function
> > in the PIC to do this?
>
> It is the best, if not the only, way to do this without mangling the
> display.
>
> > I am driving a 4 digit 7 seg display with the B port pins 0 t0 6
> and 7 is the
> > serial in. PortA.1 to PortA.4 are the digit select pins.
> > PortA.0 is analog in. Running at 20 MHZ.
> > I am  using a PIC16F818 and would like to stick with it because of
> the price.
> > I can change to the PIC18F88 if I need to.
>
> When I first read your post, I had forgotten that the 818 didn't
> have a USART. If that is the 16F88 (not 18F) then it should work
> well.  It is fast becoming my favorite 18 pin device.
>
> > The problem I am having is interrupting the scanning of the
> displays to read the RS232 causes . My thought is to use the URT to
> read the serial in
> > and monitor the received bit to move the data into a variable. I
> only need to read one byte.
>
> That is exactly the problem.  If you try to bit-bang the serial IO
> you can not be driving the display at the same time.
>
> > Is there a way to do this with out the URT?
>
> You MIGHT be able to do it using a combination of timers and
> interrupts on the incoming serial stream.  Basically use the timers
> to time between transitions but that seems like the long way around.
>
> In my view, you would use the USART to receive the chars on a
> character interrupt basis.  If the message is really only one byte
> then just set it in a variable.  If the message can be somewhat
> longer then stick the chars in a circular buffer and write an
> enqueue and dequeue routine.
>
> I suppose anything CAN be done but I would just go for the 16F88 and
> get it over with.
>
> > Thanks
> > Jim
>




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )