Searching \ for 'Software interrupt' 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/ints.htm?key=interrupt
Search entire site for: 'Software interrupt'.

Truncated match.
PICList Thread
'Software interrupt'
1999\03\10@021725 by Martin Mayr

picon face
Hi there,

I'd like to transmit data from a buffer via UART. Every
Transmit-Interrupt, the PIC should send a character (in the
interrupt-routine). But how can I cause a software-interrupt, which
jumps in my ISR to transmit the first character?
I hope, someone can help me!

Thanks Martin
Get Your Private, Free Email at http://www.hotmail.com

1999\03\10@074505 by paulb

flavicon
face
Martin Mayr wrote:

> I'd like to transmit data from a buffer via UART. Every Transmit-
> Interrupt, the PIC should send a character (in the interrupt-routine).
> But how can I cause a software-interrupt, which jumps in my ISR to
> transmit the first character?  I hope, someone can help me!

 Call it as a subroutine!  In the PIC, this is terribly elegant; you
see the only difference between return and reti is that the latter sets
GIE.  Which is in fact, the exact thing you want it to do for the first
character sent, and on the *last* character in the buffer, you must
disable the TX interrupt enable.

 Good interrupt routines start by clearing the interrupt enable, then
load the register, then setting the interrupt enable (only if the buffer
still contains data), then exit with a reti.  If you load the buffer
with one or more characters when it is empty and call this as a
soubroutine, it does everything you need to do.

 (Even better ones, certainly those used for buffered UARTS where you
have them, loop back within the interrupt disable ("critical") zone and
reload the UART until full.  OK, that doesn't apply to PICs!)
--
 Cheers,
       Paul B.

1999\03\10@082741 by Andy Kunz

flavicon
face
>I'd like to transmit data from a buffer via UART. Every
>Transmit-Interrupt, the PIC should send a character (in the
>interrupt-routine). But how can I cause a software-interrupt, which
>jumps in my ISR to transmit the first character?
>I hope, someone can help me!

Just set TXIE _after_ writing the character to your buffer.  TXIF is set
already because the transmit register is empty.  When you set TXIE, it
causes the ISR to be invoked.  Note - you must also set PEIE for _any_
peripheral interrupt to be generated.

Andy

  \-----------------/
   \     /---\     /
    \    |   |    /          Andy Kunz
     \   /---\   /           Montana Design
/---------+   +---------\     http://www.montanadesign.com
| /  |----|___|----|  \ |
\/___|      *      |___\/     Go fast, turn right,
                              and keep the wet side down!


'Software interrupt'
1999\10\19@080409 by Morgan Olsson
picon face
How is software interrupt best generated on a PIC?

Most reliable seem to make a pheripheral generate an interrupt i.e by loading a timer so it will wrap immediately/very soon, or manipulate the RB0/INT pin so that generates an interrupt.

But I need the timers for other tasks, and manipulating RB0/INT violates the interrupt on change functions.

An idea might be to directly set a pending flag (and of course the enable bit) for an else unused interrupt source.  
The manuals tell some of them are read/write :)

My worry about that is that the BSF command is a read-modify-write opeartion, and what will happen if an interrupt flag get set by hardware between the read and write of the BSF.  Probably that interrupt flag will be overwrittten with the previous state!

Are there more reliable solutions?
Some experience?

Regards
/Morgan

Morgans Reglerteknik, HŠllekŒs, 277 35 KIVIK, SWEDEN
  tel +46(0)414-446620, fax -70331,   spam_OUTmrtTakeThisOuTspaminame.com

1999\10\19@110305 by Thomas McGahee

flavicon
face
Morgan,
Check the data sheets. If I recall correctly, the
current operation is completed prior to the
interrupt routine being invoked.

But, if you are worried about such things, just
disable the global interrupt enable, use BSF to
set the individual interrupt bit you want,
enable the proper interrupt enable bit, and then
re-enable the global interrupt enable bit.

Fr. Tom McGahee

{Original Message removed}

1999\10\20@082300 by Dr. Imre Bartfai

flavicon
face
Hi,

why not:
       ...
               ClrW
               MovWF        PCLATH
               CALL        4
       ...
as a Q&D solution. Then, of no particular IT flag set/enabled, then it is
yours.

Regards,
Imre

On Tue, 19 Oct 1999, Morgan Olsson wrote:

{Quote hidden}

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