FF 5.0 on a mega2560. Compiling, uploading, programming and execution
all OK.
LCD working ok, interrupts as per irqAtmega2560.txt ok. Following code
compiles OK. Upon receipt of a character on RX2 the computer hangs / WDT
continually reboots. Never enters rds2 when the interrupt kicks - seems
to go off to somewhere else??? Have tried other interrupts with
identical code and all seem to work. With the interrupt disabled can
receive chars on RX2 ok and all flags work as expected when data received!!
serial
marker serial
\ serial ports 2 and 3 - mega2560
$00d4 constant ubrr2l
$00d2 constant ucsr2c
$00d1 constant ucsr2b
#52 constant rx2compl
variable counter
: rds2 ( -- ) \ read & display serial 2 under interrupt
$00d6 c@ .
1 counter +! \ increment counter
;i
: init2 ( -- ) \ initialise serial port 2
['] rds2 rx2compl int! \ store the interrupt vector
25 ubrr2l c! \ set baud rate to 38400
6 ucsr2c c! \ 8 data, 1 stop bit
\24 ucsr2b c! \ tx & rx enable - add 128 for RX intrup
152 ucsr2b c! \ tx & rx enable - add 128 for RX intrup
;
: prq $d0 c@ . $d1 c@ . $d6 c@ . ;
init2
--
Graham Boyd
Managing Director
Geosolutions Pty. Ltd.
16 Centre Way
Belair, 5052
South Australia
Ph. 61 (0)407 563944
61 (0)8 82786752
www.geosol.com.au
|