hi everyone,
i burned my 18f4431 after reversing the 5v power supply (warning!!!>if using power on the icsp cable on the ql200 dev board, black cable is +5v and red cable is gnd!! thanks to the hongkong designers for defying convention!!!!
now im stuck using the 2431 until my mouser order arrives on thursday. this means that all parameters are to be adjusted through hserin to eeprom. i managed to get this working:
Code:
DATA @0, WORD $0140 ;P EEPROM
DATA @2, WORD $0020 ;I EEPROM
DATA @4, WORD $0025 ;D EEPROM
DATA @6, WORD $0000 ;INTEGRATOR CLAMP value in eeprom
DATA @8, WORD $01FF ;OUTPUT CLAMP value in eeprom
DATA @10, 8 ;I TERM value in eeprom
DATA @12, 5 ;MINIMUM DUTY value in eeprom
READ 0, pid_Kp.LOWBYTE
READ 1, PID_KP.HIGHBYTE
READ 2, pid_Ki.LOWBYTE
READ 3, PID_KI.HIGHBYTE
READ 4, pid_Kd.LOWBYTE
READ 5, PID_KD.HIGHBYTE
READ 6, pid_I_Clamp.LOWBYTE
READ 7, PID_I_CLAMP.HIGHBYTE
READ 8, pid_Out_Clamp.LOWBYTE
READ 9, PID_OUT_CLAMP.HIGHBYTE
READ 10, pid_Ti
READ 12, MIN_DUTY
i can display all these variables using a hserout, with no sweat. the problem starts when i try to adjust the values using hserin, from a terminal program on my pc (realterm) i tried using a serial dt-interrupt routine and it shows that pc and pic are communicating, but i cannot figure out how to grab the word variables from the receive buffer and load them onto eeprom. how are you guys doing it? im just playing around with this, until i get my 4431's of which ill be using adcin to change all variables.
here's what im trying:
Code:
on serial receive interrupt, read RCREG, TO RX_TEMP1
if rx_temp1 = "P" then read RCREG to rx_temp2, then read rcreg to rx_temp3
write value of rx_temp2 and rx_temp3 onto "p" in eeprom
thats the idea in pseudocode. i know im doing it all wrong, and please be gentle with a beginner. thanks for reading.
Bookmarks