Google's LaMDA seems like a better AI from its conversation posted on youtube.
I asked ChatGPT to write a PID program in JALv2 (asking for JAL also works).
' PID program in JALv2
' Variables for PID control
dim setpoint as word
dim process_value as word
dim error as word
dim previous_error as word
dim integral as word
dim derivative as word
dim control_output as word
' Constants for PID control
const Kp as word = 50
const Ki as word = 10
const Kd as word = 5
' Setpoint, process value, and initial conditions
setpoint = 1000
process_value = 0
previous_error = 0
integral = 0
' Main loop for PID control
do
' Calculate error
error = setpoint - process_value
' Update integral
integral = integral + error
' Calculate derivative
derivative = error - previous_error
' Calculate control output
control_output = Kp * error + Ki * integral + Kd * derivative
' Apply control output to process
' Code to control the process goes here
' Update previous error
previous_error = error
' Wait for next iteration
wait 1
loop