As one of the three main scenarios in the fifth generation (5G) cellular networks, ultra-reliable and low-latency communication (URLLC) can be served as an enabler for real-time wireless control systems. In such a system, the communication resource consumption in URLLC and the control subsystem performance are mutually dependent. To optimize the overall system performance, it is critical to integrate URLLC and control subsystems together by formulating a co-design problem. In this paper, based on uplink transmission, we study the resource allocation problem for URLLC in real-time wireless control systems. The problem is conducted by optimizing bandwidth and transmission power allocation in URLLC and control convergence rate subject to the constraints on communication and control. To formulate and solve the problem, we first convert the control convergence rate requirement into a communication reliability constraint. Then, the co-design problem can be replaced by a regular wireless resource allocation problem. By proving the converted problem is concave, an iteration algorithm is proposed to find the optimal communication resource allocation. Based on that, the optimal control convergence rate can be obtained to optimize overall system performance. Simulation results show remarkable performance gain in terms of spectral efficiency and control cost. Compared with the scheme of satisfying fixed quality-of-service in traditional URLLC design, our method can adjust optimal spectrum allocation to maximize the communication spectral efficiency and maintain the actual control requirement.