UART Interrupt

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

UART Interrupt

1,866 次查看
Jacke
Contributor I
Hi, I have a MPC8360EA microcontroller board with CodeWarrior and I want to implement interrupt driven communication over UART. The board is supposed to do some work until a PC that it's connected to via UART says it wants some data, the board should then stop what it's doing immediately, send out the data to the PC, and then continue working where it left off. Anyone have a simple example how to do this with the functions already implemented by Freescale like InitializeIntDrivenUART, WriteUARTN and so on? Thanks in advance.
标签 (1)
0 项奖励
回复
3 回复数

887 次查看
Jacke
Contributor I
Anyone have any example on how to implement interrupt driven UART input at all?
0 项奖励
回复

887 次查看
admin
Specialist II

Why Freescale doesn't have an implementation of an interrupt driven UART?

0 项奖励
回复

887 次查看
Schwac
Contributor II

I would use the Async UART bean of Processor Expert. I highly reccomend processor expert as you can develop things orders of magnitude faster than looking through the chips header files for various flags and masks.

 

There are "on recieved" interrupts that you can enable that will direct execution to these interrupt routines when a char is accepted in the RX buffer. Then all you have to do is check until some signal is sent by the PC that you can use as an end of transmission character, or wait until you receieve a set quantity of bytes, or just wait a set amount of time. Then send the data needed back to the PC. If you need a relatively simple protocol to help organize your data take a look at Modbus RTU. It's very easy to implement, and will save you time if you have to reorganize data/send more data in the future.

 

Regards,

 

Cory

0 项奖励
回复