Searching \ for '[PIC]:Dual USART PIC' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=usart
Search entire site for: 'Dual USART PIC'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:Dual USART PIC'
2002\03\17@041816 by Jinx

face picon face
I've got an application that needs dual RS232. I can do it
with the 16F628 by adding a s/w USART but thought I'd look
around for a h/w solution too. Ideally a small PIC with virtually
no memory or other frills - just enough brains to know when
it's being spoken to and to pass the information on. I keep
being sent on wild goose chases by Microchip's damn search
engine so thought I'd ask you lot

Closest thing to a 16F628 with dual USART ?

Not a one-off, low cost/simplicity/flash preferred

=================================================

One page I did end up at was this "musical PIC" app note

http://www.microchip.com/1000/edit/proceed/archive/9_179/index.htm

which has no mention of USART in it whatsoever

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2002\03\17@073928 by Dave Dilatush

picon face
Jinx wrote...

>I've got an application that needs dual RS232. I can do it
>with the 16F628 by adding a s/w USART but thought I'd look
>around for a h/w solution too. Ideally a small PIC with virtually
>no memory or other frills - just enough brains to know when
>it's being spoken to and to pass the information on. I keep
>being sent on wild goose chases by Microchip's damn search
>engine so thought I'd ask you lot
>
>Closest thing to a 16F628 with dual USART ?
>
>Not a one-off, low cost/simplicity/flash preferred

I just took a peek at their latest full-line card, and the only
dual-USART parts I found are the 17C7xx parts (big, 64/80 pin monsters)
and the 18F6x20/18F8x20 (also big, plus not yet available).

Microchip's website has gone from being merely an inconvenience to being
a titanic pain in the ass.  Their search engine is useless (or maybe
it's just I've never gotten the hang of using it) and they keep finding
new ways to make stuff hard to find.  Their webmaster should be sent to
Singapore, where they know how to administer a proper caning.

Dave

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam@spam@mitvma.mit.edu


2002\03\17@075842 by Jinx

face picon face
> I just took a peek at their latest full-line card, and the only
> dual-USART parts I found are the 17C7xx parts (big,
> 64/80 pin monsters) and the 18F6x20/18F8x20 (also
> big, plus not yet available)

Had a feeling that might be the case. Oh well, was just
a Plan B thought anyway

> Singapore where they know how to administer a proper
> caning

I've got this girlfriend who could show the Singaporeans
a thing or two. But you didn't hear it from me, right ?

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu


2002\03\17@083235 by Dave Dilatush

picon face
You wrote...

>> I just took a peek at their latest full-line card, and the only
>> dual-USART parts I found are the 17C7xx parts (big,
>> 64/80 pin monsters) and the 18F6x20/18F8x20 (also
>> big, plus not yet available)
>
>Had a feeling that might be the case. Oh well, was just
>a Plan B thought anyway

I haven't encountered a situation where I needed an extra USART but I
often wish I could have more than two PWMs; three, four or even five
would be nice.

Dave

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu


2002\03\17@084314 by Jinx

face picon face
> often wish I could have more than two PWMs; three,
> four or even five would be nice

I know a couple of people here have had a go at
multiple PWM. There's some code here

http://www.piclist.com/techref/microchip/pwm.htm

James or the authors will know other locations

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUTspamTakeThisOuTmitvma.mit.edu


2002\03\17@100246 by Olin Lathrop

face picon face
> I've got an application that needs dual RS232. I can do it
> with the 16F628 by adding a s/w USART but thought I'd look
> around for a h/w solution too. Ideally a small PIC with virtually
> no memory or other frills - just enough brains to know when
> it's being spoken to and to pass the information on. I keep
> being sent on wild goose chases by Microchip's damn search
> engine so thought I'd ask you lot
>
> Closest thing to a 16F628 with dual USART ?

The only PICs with more than one UART are rather large, and are in the 17
and 18 families.  I've used a 17C756A for this purpose a few times.  Another
possibility is to think of a 16F628 as a UART with a programmable interface.
You can hang lots of them off a main controller via IIC, a parallel 8 bit
bus, or anything else you can concoct.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinspamspam_OUTembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
@spam@piclist-unsubscribe-requestKILLspamspammitvma.mit.edu


2002\03\17@115148 by Barry Michels

flavicon
face
I have an application that requires a dual UART also.  One monitoring a
serial port and the other monitoring a radio link.  Neither can miss a
character.  So, I'm considering using 2 16F628's and having them swap data
at a higher speed than either UART is running.  One is 9600 and the other
will be 57600.

Barry

{Original Message removed}

2002\03\17@120641 by Al Williams

flavicon
face
With a Ubicom SX, I'd just put the software UARTs in the timer interrupt
running at several times over the baud rate. I was going to suggest the
same thing here, but you may not have enough horsepower to do it.

Assume you use the hardware UART for the faster baud rate. The slower
baud rate is 9600 or around 104uS/bit. On a 20MHz PIC, each timer tick
is 200nS, so a timer rollover of 200 gives you 40uS (51.2uS for the
whole 255). If you sample every 40uS you should see every switch of
104uS signal. However, to account for sloppy senders you'd like to be
well over 2x not just close to 2X. If you roll over every 100 counts,
that would give you 20uS (about 5x). Of course, that also gives you less
time to do your "real" work whatever that is and requires your interrupt
code to be tighter.

A MAX3110 would do it too but they sure are hard to get. Have a look at
http://www.al-williams.com/wd5gnr/suart.htm for more about the MAX3110.


Al Williams
AWC
* Control 8 servos at once
http://www.al-williams.com/awce/pak8.htm



> {Original Message removed}

2002\03\17@120856 by Olin Lathrop

face picon face
> I haven't encountered a situation where I needed an extra USART but I
> often wish I could have more than two PWMs; three, four or even five
> would be nice.

Fortunately PWMs are a lot easier to do in firmware than UARTs, unless you
need the high bandwidth.  A 20MHz PIC can easily take an interrupt every
100uS (500 instructions) and update as many PWM outputs as you like.  At 1%
resolution you get 10Hz PWM frequency, which can be useful for many
mechanical control applications.  I'm sure you already know this, Dave, but
I'm pointing this out for others on the list.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, KILLspamolinKILLspamspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2002\03\17@121732 by Barry Michels

flavicon
face
All my application has to do is get a 9600 baud character from the serial
port and send it with a lead character and xor character across the 57600
link and confirm that the other side got it, resending if neccessary.  Then
on the reverse, get those 3 characters and make sure it's the right one,
requesting a resend if neccessary and sending the good character over the
9600 baud port.  I figured the 9600 baud '628 could also hold the buffer and
the 57600 baud '628 could concentrate on getting the characters right.

I'm sure it could be done in one chip, but these are so cheap, why go
through the headache.  Maybe once it's working, I might see a way to
integrate them...

I got a sample of their MAX3100CPD after reading an article about IrDA.
Haven't used them yet...

Barry

----- Original Message -----
From: "Al Williams" <spamBeGonealwspamBeGonespamAL-WILLIAMS.COM>
To: <TakeThisOuTPICLISTEraseMEspamspam_OUTMITVMA.MIT.EDU>
Sent: Sunday, March 17, 2002 12:04 PM
Subject: Re: [PIC]:Dual USART PIC


{Quote hidden}

> > {Original Message removed}

2002\03\17@121929 by Al Williams

flavicon
face
Yes, we do this on a client's board with 5 PWM outputs. If you don't
have the software time/space, you could look at a PAK-V or PAK-VIII to
do the PWM externally.

Anyone on the list working with CPLDs or FPGAs? I have a PWM function in
a CPLD that you could replicate some obscene number of times on any
modern CPLD. I can't remember if it is in Verilog or Altera schematic
entry, but if anyone wants it (maybe in EDIF?) let me know - wish there
was a good list like this for programmable logic devices....

Al Williams
AWC
* 8 channels of PWM
http://www.al-williams.com/awce/pak5.htm



> {Original Message removed}

2002\03\17@125925 by Dave Dilatush

picon face
Olin Lathrop wrote...

>> I haven't encountered a situation where I needed an extra USART but I
>> often wish I could have more than two PWMs; three, four or even five
>> would be nice.
>
>Fortunately PWMs are a lot easier to do in firmware than UARTs, unless you
>need the high bandwidth.

Yeah, they're certainly easy to implement; but every time I've needed
extra PWMs I've needed the hardware PWM's speed, too.  :(

>A 20MHz PIC can easily take an interrupt every
>100uS (500 instructions) and update as many PWM outputs as you like.  At 1%
>resolution you get 10Hz PWM frequency, which can be useful for many
>mechanical control applications.

1% resolution at 10Hz PWM frequency?  Or 0.1%?

Dave

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestspamTakeThisOuTmitvma.mit.edu


2002\03\17@161924 by Jinx

face picon face
> So, I'm considering using 2 16F628's and having them swap
> data at a higher speed than either UART is running

The prototype I'm building has 22 16F628s on it. The intention
is to use two (PIC1, PIC2) as transceivers with external PCs,
with the other 20 in between. After receiving data from the PC1
PIC1 sends it to one of the others that isn't busy. After a little
processing, that PIC then passes the data on to PIC2 which
interacts with the second PC2. And all this has to happen in
reverse as well, ie PC2 becomes the transmitter and PC1 the
receiver, with each PIC in between them a transceiver

To take advantage of the addressable USART mode within
the network (probably at the highest speed available), I'll have
to use s/w UART for the two external connections, more than
likely 9600 or 19200

I don't know much about ASICs, PLDs etc. Can they be made
with smarts or are they just gates ?

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestEraseMEspam.....mitvma.mit.edu


2002\03\17@173038 by Jinx

face picon face
> that would give you 20uS (about 5x). Of course, that also gives
> you less time to do your "real" work whatever that is and requires
> your interrupt code to be tighter

I've got the luxury of knowing that data strings are fixed length.
Only the time at which they appear is unpredictable but that's
no big deal. Organising firmware to avoid data collisions and
prioritise will be the major work

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspammitvma.mit.edu


2002\03\17@180639 by Olin Lathrop

face picon face
> >A 20MHz PIC can easily take an interrupt every
> >100uS (500 instructions) and update as many PWM outputs as you like.  At
1%
> >resolution you get 10Hz PWM frequency, which can be useful for many
> >mechanical control applications.
>
> 1% resolution at 10Hz PWM frequency?  Or 0.1%?

Oops, your're right.  If the PWM interrupt period is 100uS then you can get,
for example, 100Hz at 1% resolution or 10Hz at .1% resolution.  I've
actually done software PWM with 40uS interrupt period, or every 200
instructions.  That still left most of the cycles for the foreground task
and gave me 8 bit resolution at 98Hz.  This worked fine for controlling a
bunch of DC motors from a 16F876.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, RemoveMEolinEraseMEspamEraseMEembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestspam_OUTspamKILLspammitvma.mit.edu


2002\03\18@082952 by Edson Brusque

face
flavicon
face
Hello Barry,

> All my application has to do is get a 9600 baud character from the serial
> port and send it with a lead character and xor character across the 57600
> link and confirm that the other side got it, resending if neccessary.
Then
> on the reverse, get those 3 characters and make sure it's the right one,
> requesting a resend if neccessary and sending the good character over the
> 9600 baud port.  I figured the 9600 baud '628 could also hold the buffer
and
> the 57600 baud '628 could concentrate on getting the characters right.
>
> I'm sure it could be done in one chip, but these are so cheap, why go
> through the headache.  Maybe once it's working, I might see a way to
> integrate them...

   I would try to make this with only a F628. Hardware USART at 57600,
software USART at 9600. You could use RB0 pin for the softUSART input and
use it's interrupt capabilities.

   You could have a timer0 interrupt each 104uS (about 521 instructions)
and use RB0 to detect an start bit and sync the timer with the serial input.
When you got RB0/INT going LOW (start bit) you put a value on timer0 so it
will overflow in 52uS and you confirm the start bit. Then timer0 will
overflow in 104uS and you got the first bit. So on untill you got the stop
bit.

   As the F628 have 3 timers, you can use timer1 or timer2 implement serial
data output.

   Not as easy as two hardware USARTs on the same PIC, but for me it sounds
simpler than having to interface two PICs.

   Best regards,

   Brusque

-----------------------------------------------------------------
Edson Brusque                 C.I.Tronics Lighting Designers Ltda
Researcher and Developer               Blumenau  -  SC  -  Brazil
Say NO to HTML mail                          http://www.citronics.com.br
-----------------------------------------------------------------

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\03\18@084520 by Carlos Ojea

flavicon
face
>I've got an application that needs dual RS232. I can do it
>with the 16F628 by adding a s/w USART but thought I'd look
>around for a h/w solution too.

And how about interface your pic with a external hardware uart like TL16C550
from texas instruments ?

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\03\18@091302 by michael brown

flavicon
face
>     You could have a timer0 interrupt each 104uS (about 521 instructions)
> and use RB0 to detect an start bit and sync the timer with the serial
input.
> When you got RB0/INT going LOW (start bit) you put a value on timer0 so it
> will overflow in 52uS and you confirm the start bit. Then timer0 will
> overflow in 104uS and you got the first bit. So on untill you got the stop
> bit.

I have done this with great success on a 16f84a running at 4mhz except my
first delay was at 156us.  (who cares about start-bit confirmation ;-D)  It
works very well.  You just set up the PIC to use the RB0/INT for detecting
the start bit, then you turn off RB0/INT's and use TMR0 INTS to call your
handler every 104us (aiming for the center of the bit).  When you get the
stop bit, switch back to RB0/INT's.  There's even time for inserting the
data into a circular queue that (auto-magically) uses all the unused RAM
locations.  Then at main level you just pull the stuff out of the queue and
process it at leisure.  If the receive queue gets full, just apply some
hardware flow-control.  Cake.  Really.  ;-)

michael brown

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\03\18@092236 by Eoin Ross

flavicon
face
I hate to be a traitor - but check out Cypress Micros PSoC chips - looks like the limit for UARTS on them is the pin count !

THey are configurable uP ... pick the peripherals you want (internal osc too - 48/24 MHz

>>> RemoveMEdilatushTakeThisOuTspamspamCOMCAST.NET 03/17/02 08:28AM >>>
You wrote...

>> I just took a peek at their latest full-line card, and the only
>> dual-USART parts I found are the 17C7xx parts (big,
>> 64/80 pin monsters) and the 18F6x20/18F8x20 (also
>> big, plus not yet available)
>
>Had a feeling that might be the case. Oh well, was just
>a Plan B thought anyway

I haven't encountered a situation where I needed an extra USART but I
often wish I could have more than two PWMs; three, four or even five
would be nice.

Dave

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspamspamspamBeGonemitvma.mit.edu
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\03\18@100804 by Edson Brusque

face
flavicon
face
Hello Eoin,

>I hate to be a traitor - but check out Cypress Micros PSoC chips - looks
like the limit >for UARTS on them is the pin count !
>THey are configurable uP ... pick the peripherals you want (internal osc
too - 48/24 MHz

   I've seen a demo of it 10 days ago and was very impressed. I'll will
receive an starter kit in about two weeks.

   Actually, it have 12 analog and 8 digital blocks (UMs, User Modules)
that you can configure as PWM generators, USARTs, ADCs, DACs, comparators
etc.

   You could easily have 2 USARTS with only 4 user digital modules. The
user modules are the same (both quality and quantity) from the 8pin to the
44pin devices. The IDE are cool and the ICE/Programmer seens to be first
class.

   Starter kit with ICE, cables, 28-pin demo parts, 28-pin pod, C compiler
etc costs about US$400.00 here in Brazil.

   Best regards,

   Brusque

-----------------------------------------------------------------
Edson Brusque                 C.I.Tronics Lighting Designers Ltda
Researcher and Developer               Blumenau  -  SC  -  Brazil
Say NO to HTML mail                          http://www.citronics.com.br
-----------------------------------------------------------------

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\03\18@105735 by Alan B. Pearce

face picon face
>I have done this with great success on a 16f84a
>running at 4mhz except my first delay was at 156us.
>  (who cares about start-bit confirmation ;-D)
>It works very well.

You would be well advised to worry about start bit verification unless
working in a known noise free environment. It will save a lot of hassle with
apparently corrupted messages. You only need one noise pulse 100uS earlier
than your start pulse and your whole byte is shifted one bit right, with the
highest bit being a 0.

I speak from experience here, having seen noise pulses produce many
extraneous interrupts on a processor because the designer did exactly this,
filling the buffer with much extraneous junk.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\03\18@121005 by michael brown

flavicon
face
> >I have done this with great success on a 16f84a
> >running at 4mhz except my first delay was at 156us.
> >  (who cares about start-bit confirmation ;-D)
> >It works very well.
>
> You would be well advised to worry about start bit verification unless
> working in a known noise free environment. It will save a lot of hassle
with
> apparently corrupted messages. You only need one noise pulse 100uS earlier
> than your start pulse and your whole byte is shifted one bit right, with
the
> highest bit being a 0.
>
> I speak from experience here, having seen noise pulses produce many
> extraneous interrupts on a processor because the designer did exactly
this,
> filling the buffer with much extraneous junk.

Alan,

I should have been more clear, I did it for a one-off hobby project.  If it
were to be a "real" product, I would have sampled every bit, multiple times
just for this reason.  In all of my testing, however, it never failed.

michael brown

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\03\18@155327 by Jinx

face picon face
> I would try to make this with only a F628. Hardware USART at
> 57600, software USART at 9600. You could use RB0 pin for the
> softUSART input and use it's interrupt capabilities

Exactly my plan, and looks as though that's how others have
successfully done it too. Once it's all up and running I'll share
what I can

The Cypress parts sound interesting

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\03\20@155922 by Erik Hall

picon face
Is there code available for a software UAR (no T) that uses the RB0
interrupt for each bit? I've seen ones that only use RB0 to know when the
start bit is starting.

Thanks,
Erik

{Original Message removed}

2002\03\20@171603 by Jinx

face picon face
> code available for a software UAR that uses the RB0 interrupt

You might want to check out the I/O section at http://www.piclist.com
There are interrupt and interruptless code samples

I plan to use RB0 interrupts but can't say how soon it will
before I have any presentable code. Still pencil-sketching

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\03\20@215254 by michael brown

flavicon
face
> > code available for a software UAR that uses the RB0 interrupt
>
> You might want to check out the I/O section at http://www.piclist.com
> There are interrupt and interruptless code samples
>
> I plan to use RB0 interrupts but can't say how soon it will
> before I have any presentable code. Still pencil-sketching

Jinx,
I think he wants to *only* use RB0 ints to receive each "bit".  This would
be impossible without using a timer, of some sort, to figure out how many
consecutive bits you didn't get an interrupt for.  IIRC, if you trigger on
the start bit, you (not specifically you Jinx, but you know what I mean
;-D) wouldn't even be guaranteed an interrupt on the stop bit.  I don't see
any "feasible" way to receive serial data using *only* RB0/INT's.

If your gonna have to use a timer anyway, then you would just use RB0/INT to
get the first bit, and TMR0 ints to trigger interrupts at the appropriate
time to receive the data bits and stop bit.

However, if it *can* be done, I'm sure you could think of a way Jinx.  ;-)

michael brown

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\03\20@224749 by Jinx

face picon face
> However, if it *can* be done, I'm sure you could think
> of a way Jinx.  ;-)

Well, that's right neighbourly of you to say so ;-)

I've been looking at a 56k PC on one side of the PIC network
and Pacnet connection for the data on the other and could go
as high as 128kB/sec with that. The overall concept of what I
need to do is not complicated (ie looks simple enough on
paper !! ha !!) but the timing and prioritising issues could get
very involved, as each PIC has to have dual UART functions

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\03\21@011704 by M. Adam Davis

flavicon
face
I've found the book Serial PIC'n invaluable for this sort of thing.  An
example of an interrupt routine is available on the book's website (sans
comments :-( ...)

The source code is here:
http://www.sq-1.com/srccode.html

And the particular file is indigo2.asm

It's only half duplex, and without comments it may not be worth your
time, but there it is.

-Adam

Erik Hall wrote:

>Is there code available for a software UAR (no T) that uses the RB0
>interrupt for each bit? I've seen ones that only use RB0 to know when the
>start bit is starting.
>
>Thanks,
>Erik
>
>{Original Message removed}

2002\03\21@091152 by Hubba

flavicon
face
> > > code available for a software UAR that uses the RB0 interrupt
> >
> > You might want to check out the I/O section at http://www.piclist.com
> > There are interrupt and interruptless code samples
> >
> > I plan to use RB0 interrupts but can't say how soon it will
> > before I have any presentable code. Still pencil-sketching
>
> Jinx,
> I think he wants to *only* use RB0 ints to receive each "bit".  This would
> be impossible without using a timer, of some sort, to figure out how many
> consecutive bits you didn't get an interrupt for.  IIRC, if you trigger on
> the start bit, you (not specifically you Jinx, but you know what I mean
> ;-D) wouldn't even be guaranteed an interrupt on the stop bit.  I don't
see
> any "feasible" way to receive serial data using *only* RB0/INT's.
>
> If your gonna have to use a timer anyway, then you would just use RB0/INT
to
> get the first bit, and TMR0 ints to trigger interrupts at the appropriate
> time to receive the data bits and stop bit.

If you want to retain RB0/INT for other stuff, you should be able to use
RA0/T0CKI pin as described in Microchip Application note AN555. Please note
that I am a newbie, so I have not tested it, nor am I sure that this pin is
available on all common PICs.

Best regards,

Jacob Grydholt Jensen

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2002\03\21@091751 by Erik Hall

picon face
Yup, that was more of what I was looking for. You are correct, there is no
guarantee of an interrupt at the stop bit. I think the interrupt/timer0
approach is the way I'm going to go.

Thanks,
Erik

{Original Message removed}

2002\03\22@031715 by Mahmood Elnasser

flavicon
face
Here is the code for software 2nd serial port by RB0 interrupt, it works
in the background completely and was tested and used on PIC16F876



/***********************************************************************
****
*               INTERRUPT SERVICE ROUTINES
************************************************************************
***/
interrupt isr()
{
       // TIMER0 ISR
       if(T0IF == 1)
       {
           if(startBitFlag == 1)            // proceed only after
start bit                                                        // has
been received
           {
               // Read serial data                 TMR0 = (byte)(255 - bitLength);// re-initialise Timer0
to                                                               //
interrupt middle of next bit
//(bit length is 52uSec for 19200
// Baud rate
               if(bitCounter < 9)  // start bit not counted coz it was
detected
// by the interrupt
               {
                   rxShift = (rxShift >> 1) | (RxData << 7);        
               }
               bitCounter++;
               if(bitCounter == 9)
               {
                   bitCounter = 0;

                   // a byte has been received in rxShift Process it!
               }
// RB0 INTERRUPT     if(INTF == 1)
   if(startBitFlag == 0)                           // only do if
start
// bit is 0
   {
       TMR0 = (byte)(255 - bitLength * 1.5); // set TMR0 to
// interrupt at middle
// of first bit to read it
     T0IE = 1;                                               // Enable Timer1
Interrupt
       INTF = 0;
       INTE = 0;                                             //
disable further RB0
// interrupts till stop bit occurs
       startBitFlag = 1;                     // we are in middle of
receiving data
                                               // so enable Timer1
interrupt
   }
// OTHER INTERRUPTS
       
   if(RCIF)
   {
//        receiveBuffer = RCREG;
//        receivebufferfull = 1;
   }
}

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...