This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
runtime_library:using_serial_out:start [2018/06/12 08:20] – ursgraf | runtime_library:using_serial_out:start [2022/12/20 11:17] (current) – ursgraf | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Using Serial Out (System.out) ====== | ====== Using Serial Out (System.out) ====== | ||
- | ===== On the hardware | + | See [[firstexample: |
==== Freescale MPC555 ==== | ==== Freescale MPC555 ==== | ||
- | + | The Freescale MPC555 offers two independent serial interfaces with RS232 Protocol, SCI1 and SCI2. When using our [[http:// | |
- | The Freescale MPC555 offers two independent serial interfaces with RS232 Protocol, SCI1 and SCI2. When using our [[http:// | + | |
==== Freescale MPC5200 ==== | ==== Freescale MPC5200 ==== | ||
The Freescale MPC5200 has six built in Programmable Serial Controllers (PSC), which can all work as UART's running the RS232 protocol. Check your hardware manual to see which of the PSC can be used on your board. | The Freescale MPC5200 has six built in Programmable Serial Controllers (PSC), which can all work as UART's running the RS232 protocol. Check your hardware manual to see which of the PSC can be used on your board. | ||
- | ===== On the software side ===== | + | ==== Zynq 7000 ==== |
- | - In your application on the target you have to initialize the serial communication interface with the desired settings and assign the standard pipes (in, out, err) to this port. Example for the MPC555: <code java> | + | The Zynq 7000 has two built-in UART' |
- | import java.io.PrintStream; | + | |
- | import ch.ntb.inf.deep.runtime.mpc555.driver.SCI1; | + | |
- | + | ||
- | public class HelloWorld { | + | |
- | static { | + | |
- | // 1) Initialize SCI1 (9600 8N1) | + | |
- | SCI1.start(9600, | + | |
- | + | ||
- | // 2) Use SCI1 for stdout | + | |
- | System.out = new PrintStream(SCI1.out); | + | |
- | System.err = new PrintStream(SCI1.out); | + | |
- | + | ||
- | // 3) Say hello to the world | + | |
- | System.out.println(" | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | The maximum allowed baudrate for the SCI1 is 38400 when using our [[http://wiki.ntb.ch/infoportal/embedded_systems/ | + | |
- | \\ | + | |
- | When working with the the mpc5200:< | + | |
- | import java.io.PrintStream; | + | |
- | import ch.ntb.inf.deep.runtime.mpc5200.driver.UART3; | + | |
- | public class HelloWorld { | ||
- | static { | ||
- | // Initialize UART (9600 8N1) | ||
- | UART3.start(9600, | ||
- | |||
- | // Use the UART3 for stdout | ||
- | System.out = new PrintStream(UART3.out); | ||
- | |||
- | // Print a string to the stdout | ||
- | System.out.println(" | ||
- | } | ||
- | } | ||
- | </ | ||
- | - On the host you have to determine which port number your operating system has assigned to the port | ||
- | - Open any terminal program, such as //putty//, // | ||