Serial input using interrupts

I got my atom pro 28 and bot-board a week or so ago, and I’ve got everything working now as far as programming the device and input/output using pins and the serial port.

What I would like to do now is to have a program executing on the atom, and when a command is sent via the serial port, I’d like the program to pause execution, handle the input, and then resume execution. It would seem that this would naturally be handled using interrupts, but prior attempts haven’t got me very far. Anyone know a way of doing something like this?

If the ATOM PRO is enough similar to the Basic ATOM, it should have at least one external interrupt available for use. On the Basic ATOM, this is P0. Check your manual for the PRO and see if it has at least one external interrupt available. You should be able to wire a line to this and allow the external serial device interrupt the PRO for processing.

8-Dale

I thought of this as well, but did not see a way to address the extint in the ATOM-Pro IDE (it does not recognize extint). It seems like alot of things are missing from the Atom Pro documentation. For example, I cannot address ax0 as a line in the IDE, but I just saw that they are p16-p19 on the forum. Is there something that I’m missing or doing wrong?

I did see the extint in the MBasic manual, but how does that fit into the ATOM-Pro IDE?

I do not know for sure if this is the case, so you will have to double check this. My understanding is that the newer IDE for the Basic ATOM is more or less an ATOM specific version of MBASIC. If this is true for the Basic ATOM, then I would bet it is also true for the ATOM PRO. It makes sense for Basic Micro to standardize the language used by all of their microcontrollers since it make support a lot easier for them.

8-Dale

I also came to the same conclusion about Atom being a subset of MBasic. So, how for instance would you enable the extint in basic atom?

In your case I’d recommend using the hardware serial port on the AtomPro(p14 and P15 for in and out) since the hserial system runs in the background(using the hardware serial interrupts). All you have to do it enable hserial(enablehserial), set the baud rate and other options using the sethserial command, and then use hserin with a 0 timeout in your main loop to see if any data has been received(if there is no data a 0 timeout will imediately jump to the timeout label). However if you have to use the built in serial pins(S_IN and S_OUT, the ones used to program the chip) there aren’t any interrupts available on those. You can also use on of the external interrupts(there are irq ints and wakeup ints). Interrupts are advanced. You need the Renesas H8-3694 hardware manual if you really want ot get into them. You setup a label to jump to on a particular interrupt by using the ONINTERRUPT command. This ONLY tells the chip where to jump if a particular interrupt is triggered. You still have to setup the proper registers with the proper values and enabled the interrupt before you will ever get your program to jump to the interrupt specified in the ONINTERRUPT command.

Yes, we are slowly standardizing MBasic across all our products. MBasic for AtomPro still has a number of differences from MBasic for Atom or MBasic for PICmicros. The latest AtomPro manual covers just about everything though there may still be a few things not detailed. Thats why we have an 800 number for tech support. We’ll help(but we won’t write your programs for you :slight_smile: ).

This should give me ample material to play with. I was a little unclear on how the hserial system works, but now I think I can get started there.

One thing though, is it feasible to wire the, say, the RTS (ready to send) from the serial port to a pin on the bot-board and enable the external interrupt to watch for when I assert RTS? If so, how would I go about setting up the external interrupt under Atom Pro IDE?

BTW, thanks guys for all your help … I’m getting there … slowly, but surely.

:smiley: