Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual

Page 71

Advertising
background image

6Ć31

Port B Application Notes
1. Port B requires port allocation and error handling to be handled

by the application tasks.

2. OPEN" the port to set the required port characteristics, then

CLOSE" the port.

3. OPEN" the port for NON_EXCLUSIVE access in each task that

needs access to the port. Use the same device number to open

the port in all tasks.

4. Use INPUT #, PRINT #, GET #, and PUT # statements with the

device number used in the OPEN statement to access port B.

5. StopĆAllĆClear commands and power cycle close all ports. Port

characteristics are set to the OS default; the user must set the

port to the required characteristics.

6. Stopping a task does not change the port setup and baud rate.
7. Stopping a task that has EXCLUSIVE access to the port closes

the port on the Processor.

8. Stopping a task that has NON_EXCLUSIVE access only disables

access to the port for the task that was stopped. The other tasks

referencing the port can still transmit or receive data.

9. The operating system does not deĆallocate the port (make the

port available for EXCLUSIVE access) until all tasks referencing

the port have closed the port.

10. Port errors logged to task information (for example, Framing,

Overrun, etc.) will close the port that logged the error.

11. If the port is closed via CLOSE or error, then port statements

PRINT, INPUT, PUT and GET will fail. They will log a Port Not

Open (properly)" error message and abort the operation. No

data will be sent for PRINT and PUT. INPUT and GET will not

suspend the task but will proceed to the next statement on the

current line or next line number. INPUT:EMPTY= and

GET:EMPTY= will not branch to the specified EMPTY line

number, but will operate like the INPUT and GET statements

described above.

Programming Example
The following example uses two tasks on the processor to transmit

and receive data from port B. Software interlocking must be added

to each task attempting to allocate the port to ensure that the tasks

can determine whether the port setup and baud rate have been

initialized prior to opening the port for NON_EXCLUSIVE access.

KYBD.BAS sets the characteristics for port B, closes the port,

reĆopens the port for NON_EXCLUSIVE access, and then sets the

software interlocking flag KYBD_RDY@ TRUE so that DISPLAY.BAS

can open the port for NON_EXCLUSIVE access.
If USERNAME$ is blank, KYBD.BAS prompts the user to enter his

name. DISPLAY.BAS displays the Hello World" message and the

user name if USERNAME$ is not blank. Because the port must be

opened by each task that needs access to the port, the logical

device number used in the OPEN statement must be used with the

INPUT, PRINT, GET or PUT statements.

Advertising
This manual is related to the following products: