| Rowan Sylvester-bradley 05/27/10 15:31 Read: 814 times |
#176243 - Trouble with interrupt driven comms on 80C320 serial port 1 |
I'm having trouble with a serial application using the Dallas 80C320. I'm using serial port 1 in mode 1 (8-bit UART) using timer 1 to generate the baud rate. I have an 11.0592 MHz crystal, and am operating at 57,600 baud. The port works fine when I use it without interrupts. I can send and receive characters at 57,600 baud, and everything seems perfect. But when I enable interrupts, nothing happens. I've put an output to a LED in my interrupt handler, and it never gets fired, so I'm pretty sure the interrupt handler is never being reached. What am I doing wrong?
Here's my initialisation code: start:
mov SP,#?stack-1
mov IE,#0 ; Disable all interrupts.
mov P1,#0 ; Turn off tr_enab and tr1_enab.
; This is for serial port 0
mov t2con,#030h ; Use Timer 2 in auto reload mode for both receive and transmit baud clocks.
mov RCAP2L,#T2RL96L
mov RCAP2H,#T2RL96H
mov TL2,#T2RL96L
mov TH2,#T2RL96H
mov SCON,#050h ; Serial port 0 mode 1 (8-bit UART), Receive Enable.
mov a,#2 ; Stretch value. External RAM access via MOVX uses 4 machine cycles.
mov CKCON,a ; T1M (CKCON.4) is 0 so timer 1 runs at crystal/12.
setb TR2 ; Turn on timer 2.
; This is for serial port 1
mov tmod,#020h ; Timer 1 mode 2: 8-bit auto-reload mode.
mov th1,#255d
mov tl1,#255d
mov scon1,#050h ; Serial port 1 settings: mode 1 (async 10-bit), receive enable.
setb smod ; Set smod_1 to double the baud rate.
clr RI1 ; If it`s edge triggered, we may never get an interrupt if TI or
clr TI1 ; RI are already set when interrupts are enabled.
setb ES1 ; Enable interrupts.
setb EA ; Global interrupt enable.
setb tr1 ; Turn on timer 1. Port is now live.
I've included all of it including the stuff for port 0 just in case there's some interaction I've not spotted. This exact code, without the setb ES1 and setb EA, works fine for non-interrrupt IO. When I add the two setb's though I don't seem to get any interrupts. I have the following interrupt vector: ORG 003bh ljmp serint1 In serint1 I have: serint1:
clr ES1
push ar2
push psw
push acc
push b
push DPL
push DPH
clr RI1
etc.
Then I have my output to a LED which never happens. What am I doing wrong? Many thanks - Rowan |
| Topic | Author | Date |
| Trouble with interrupt driven comms on 80C320 serial port 1 | Rowan Sylvester-Bradley | 05/27/10 15:31 |
| CLR ES1? | Daniel Contarino | 05/27/10 15:51 |
| Good idea but not the solution | Rowan Sylvester-Bradley | 05/27/10 17:25 |
| As Erik posted, may be the etc. part | Daniel Contarino | 05/27/10 17:30 |
| I cant' tell if there is a problem in ... | Erik Malund | 05/27/10 16:01 |
| Which ... are you worrying about? | Rowan Sylvester-Bradley | 05/27/10 17:32 |
| How about commenting "etc" | Mahesh Joshi | 05/28/10 05:05 |
| please post as is, not all the ... | Erik Malund | 05/28/10 06:39 |
| Again without the conditionals | Rowan Sylvester-Bradley | 05/28/10 18:53 |
| this is NOT an ISR | Erik Malund | 05/28/10 19:22 |
| Why will jnb RI,$ screw up? | Rowan Sylvester-Bradley | 05/29/10 06:12 |
| stick a state machine in the ISR | Erik Malund | 05/29/10 06:35 |
| To interrupt or not... | Rowan Sylvester-Bradley | 05/29/10 06:58 |
| an example | Erik Malund | 05/29/10 07:08 |
| Avoid infinite loops like the plague | Per Westermark | 05/29/10 07:18 |
| Back to the subject - why won't it interrupt? | Rowan Sylvester-Bradley | 05/29/10 12:05 |
| Serial Port Interrupts | Michael Karas | 05/29/10 12:23 |
| Yes, I think I've done this correctly | Rowan Sylvester-Bradley | 05/29/10 12:32 |
| Vector Address... | Michael Karas | 05/29/10 12:42 |
| I think I've done this correctly... | Rowan Sylvester-Bradley | 05/30/10 02:37 |
| you had me there | Erik Malund | 05/30/10 05:41 |
| Serial port, not port | Rowan Sylvester-Bradley | 05/30/10 06:42 |
| maybe not | Erik Malund | 05/30/10 05:50 |
| ES1 is non-standard | Rowan Sylvester-Bradley | 05/30/10 07:07 |
| probably the most common misumderstanding | Erik Malund | 05/30/10 07:18 |
| Thanks for clarification... | Rowan Sylvester-Bradley | 05/30/10 07:41 |
| It works without interrupts... | Rowan Sylvester-Bradley | 05/30/10 07:18 |
| then ... | Erik Malund | 05/30/10 07:38 |
| Even Better ... | Michael Karas | 05/30/10 13:31 |
| maybe it does | Erik Malund | 05/29/10 13:30 |
| Two things argue against this... | Rowan Sylvester-Bradley | 05/30/10 02:47 |
| Dunno, but that's a very useful instruction | Jez Smith | 05/28/10 01:57 |
| Dunno.. | Jehan Balabagan | 07/17/10 05:36 |
| I have problem with serial port 1 on ds89c450 (www.maxim-ic | Alok Kumar Mishra | 07/17/10 11:25 |
| MUCH better description needed | Erik Malund | 07/17/10 12:58 |
| not it is not language | Alok Kumar Mishra | 07/19/10 14:40 |
| Which register bank are you using? | David Good | 07/20/10 11:25 |
yes it works now | Alok Kumar Mishra | 07/27/10 16:58 |



