Reconfigurable intelligent surface (RIS) is popular in recent years as a promising technology for future wireless networks. However, the bottleneck still exists due to the accurate channel state information is quite difficult to obtain. This paper investigates the estimation of a cascaded channel and the design of an optimal reflection coefficient matrix during data transmission in an RIS-aided coded system when the channel is rapidly time-variant. Moreover, the Kalman filter is proposed to optimize the channel estimation which utilizes the time correlation of the channel. Meanwhile, the decoded information can be fully exploited to assist the channel estimation, which is highly spectral-efficient. Besides, the paper introduces a particle swarm optimization algorithm to find the optimal reflection coefficient matrix based on the maximum achievable rate during data transmission. Numerical results present the proposed methods can utilize a few pilot signals to obtain excellent performance.