Paolo
DPEDS
Posts: 3
HI,
I'm working with the BS2px controlling temperature retard in a room. In order to do this control, I'm using the DAC0831 to convert the analog data from the LM35DZ sensor which measures celsius degrees. The circuit works as far as measuring, storage and reading back with the debug terminal. The problem begins when I try to display the data in Stamp Plot Lite. I followed every single steps in "Industrial Control" appendix A but any data is shown on Stamp Plot Lite. Nothing is displayed on the right side of the Stamp Plot Lite nor the plotting line. The only thing that appears is the time and the seconds the process has been working. Maybe there may be a problem in my program (first part):
' {$STAMP BS2px}
' {$PBASIC 2.5}
' {$PORT COM1}
'PID Control Program
'*********PID Control Configuration****************
SP CON 270 (27ºC as setpoint)
Rango CON 20
B CON 50
Kp CON 0
Ki CON 0
Ti CON 24
Kd CON 0
MinA CON 25
MaxA CON 120
MaxT CON 600
'*********************************************
'*****Graphic Configuration
PAUSE 500
DEBUG "!TITL Control PID ",CR
DEBUG "!RSET",CR
DEBUG "!PNTS 1000",CR
DEBUG "!TMAX ",DEC MaxT,CR
DEBUG "!AMAX ",DEC MaxA,CR
DEBUG "!AMIN ",DEC MinA,CR
DEBUG "!SPAN 20,50",CR
DEBUG "!AMUL .1",CR
DEBUG "!TSMP ON",CR
DEBUG "!SAVM ON",CR
DEBUG "!CLMM",CR
DEBUG "!SHFT ON",CR
DEBUG "!PLOT ON",CR
DEBUG "!USRS SP=",DEC SP," Kp=",DEC Kp," Ki=",DEC Ki," Ti=",DEC Ti," Kd=",DEC Kd,CR
DEBUG "!RSET",CR
'**************Variables and Constants
CS CON 3
CLK CON 4
Dout CON 5
Calentador CON 8
Datain VAR Byte
Temp VAR Word
TempRango CON 3000
Offset CON 200
Signo VAR Word
Excitacion VAR Word
Err VAR Word
P VAR Word
I VAR Word
D VAR Word
ContadorPWM VAR Byte
UltimoErr VAR Word
UltimoErr = 0
ContadorInt VAR Byte
TiempoPWM CON 20
Ei VAR Word
Ei = 0
The main problem is when I open Stamp Plot Lite nothing is displayed except the time and seconds the program has been working. I know something is wrong but I don't know what.
The port is fine, the baud rate is fine
I really hope someone can help me.
Thanks very much.
I'm working with the BS2px controlling temperature retard in a room. In order to do this control, I'm using the DAC0831 to convert the analog data from the LM35DZ sensor which measures celsius degrees. The circuit works as far as measuring, storage and reading back with the debug terminal. The problem begins when I try to display the data in Stamp Plot Lite. I followed every single steps in "Industrial Control" appendix A but any data is shown on Stamp Plot Lite. Nothing is displayed on the right side of the Stamp Plot Lite nor the plotting line. The only thing that appears is the time and the seconds the process has been working. Maybe there may be a problem in my program (first part):
' {$STAMP BS2px}
' {$PBASIC 2.5}
' {$PORT COM1}
'PID Control Program
'*********PID Control Configuration****************
SP CON 270 (27ºC as setpoint)
Rango CON 20
B CON 50
Kp CON 0
Ki CON 0
Ti CON 24
Kd CON 0
MinA CON 25
MaxA CON 120
MaxT CON 600
'*********************************************
'*****Graphic Configuration
PAUSE 500
DEBUG "!TITL Control PID ",CR
DEBUG "!RSET",CR
DEBUG "!PNTS 1000",CR
DEBUG "!TMAX ",DEC MaxT,CR
DEBUG "!AMAX ",DEC MaxA,CR
DEBUG "!AMIN ",DEC MinA,CR
DEBUG "!SPAN 20,50",CR
DEBUG "!AMUL .1",CR
DEBUG "!TSMP ON",CR
DEBUG "!SAVM ON",CR
DEBUG "!CLMM",CR
DEBUG "!SHFT ON",CR
DEBUG "!PLOT ON",CR
DEBUG "!USRS SP=",DEC SP," Kp=",DEC Kp," Ki=",DEC Ki," Ti=",DEC Ti," Kd=",DEC Kd,CR
DEBUG "!RSET",CR
'**************Variables and Constants
CS CON 3
CLK CON 4
Dout CON 5
Calentador CON 8
Datain VAR Byte
Temp VAR Word
TempRango CON 3000
Offset CON 200
Signo VAR Word
Excitacion VAR Word
Err VAR Word
P VAR Word
I VAR Word
D VAR Word
ContadorPWM VAR Byte
UltimoErr VAR Word
UltimoErr = 0
ContadorInt VAR Byte
TiempoPWM CON 20
Ei VAR Word
Ei = 0
The main problem is when I open Stamp Plot Lite nothing is displayed except the time and seconds the program has been working. I know something is wrong but I don't know what.
The port is fine, the baud rate is fine
I really hope someone can help me.
Thanks very much.
Comments
If you open com1 in hyperterminal what do you see?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
' {$STAMP BS2px}
' {$PBASIC 2.5}
' {$PORT COM1}
'PID Control Program
'*********PID Control Configuration****************
SP CON 270
Rango CON 20
B CON 50
Kp CON 0
Ki CON 0
Ti CON 24
Kd CON 0
MinA CON 25
MaxA CON 120
MaxT CON 600
'*********************************************
'*****Graphic Configuration
PAUSE 500
DEBUG "!TITL Control PID ",CR
DEBUG "!RSET",CR
DEBUG "!PNTS 1000",CR
DEBUG "!TMAX ",DEC MaxT,CR
DEBUG "!AMAX ",DEC MaxA,CR
DEBUG "!AMIN ",DEC MinA,CR
DEBUG "!SPAN 20,50",CR
DEBUG "!AMUL .1",CR
DEBUG "!TSMP ON",CR
DEBUG "!SAVM ON",CR
DEBUG "!CLMM",CR
DEBUG "!SHFT ON",CR
DEBUG "!PLOT ON",CR
DEBUG "!USRS SP=",DEC SP," Kp=",DEC Kp," Ki=",DEC Ki," Ti=",DEC Ti," Kd=",DEC Kd,CR
DEBUG "!RSET",CR
'**************Variables and Constants
CS CON 3
CLK CON 4
Dout CON 5
Calentador CON 8
Datain VAR Byte
Temp VAR Word
TempRango CON 3000
Offset CON 200
Signo VAR Word
Excitacion VAR Word
Err VAR Word
P VAR Word
I VAR Word
D VAR Word
ContadorPWM VAR Byte
UltimoErr VAR Word
UltimoErr = 0
ContadorInt VAR Byte
TiempoPWM CON 20
Ei VAR Word
Ei = 0
'******************Main
Principal:
GOSUB Obtenerdato
GOSUB Calc_Temp
GOSUB Calc_Excitacion
GOSUB Grafica_Datos
GOSUB Excitacion_Calentador
GOTO Principal
Obtenerdato:
LOW CS
LOW CLK
SHIFTIN Dout, CLK, MSBPOST,[noparse][[/noparse]Datain\9]
HIGH CS
RETURN
Calc_Temp:
Temp = TempRango/255 * Datain/10 + Offset
RETURN
Calc_Excitacion:
GOSUB ErrorCalc
GOSUB PropCalc
GOSUB IntCalc
GOSUB DerivCalc
Excitacion = (B + P + I + D)
Signo = Excitacion
GOSUB PoneSigno
Excitacion = ABS Excitacion MAX 100
IF Signo = 1 THEN ExcitListo
Excitacion = 0
ExcitListo:
RETURN
'*********Heater
Excitacion_Calentador:
FOR ContadorPWM = 1 TO TiempoPWM
PWM Calentador, excitacion * 255/100,220
NEXT
RETURN
'*********Data is Displayed
Grafica_Datos:
DEBUG DEC Temp,CR
'**Outcoming Message
DEBUG "Deseada:", DEC SP," Temp:", DEC Temp
DEBUG " %Err:",SDEC Err," %B=", DEC B, " %P=", SDEC P
DEBUG " %I=",SDEC I," %D=", SDEC D
DEBUG " %Excitacion:",SDEC Excitacion, CR
'**Mensaje De Salida Separado Por Comas Para Importar Una Hoja De C
Thanks
I'm not sure but I think you need to limit your debug statements to things stamp plot understands or you confuse it. try removing everything except the temp value and see if you get that. Also make sure it is using com1 for it's data input.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Post Edited (Franklin) : 6/11/2008 5:49:24 PM GMT