
Originally Posted by
HenrikOlsson
Hi Malcolm,
Let me see if I've got the overall scheme correct.
** The PIC does its thing, running the PID and everything. Each time thru its main loop it checks the RCIFlag.
** The PC, when it needs attention sends a single character "Q" to the PIC and waits.
** The PIC sees the RCIFlag and gets the character (there's no problem here since a single character will sit in the buffer untill you get around to read it)
** The PIC compares the received character to "Q" and sends something back to say "OK, hit me" - it then goes to the loop we've been discussing.
/Henrik.
Pretty much it. As far as I understand Charles has programmed his code to send Q when the program is first launched, this was so that we could use Q as a trigger to jump to a subroutine and have the PIC send the data string.... then the user over types the value in the target temperature box and then when the Update button is clicked it sends Snnn to the PIC, followed by Q to refresh the PC application.
I've tried migrating the test code over to the main code that you were involved in and have discovered one issue. On launching the application the LCD stops running, but I can set the temperature set point via the application on the PC, which upon pressing the Update button the value on the LCD changes to match. However whilst the application is still open the LCD is still not updated. If I then close the application it still locks up and I have to restart the PIC.
At the moment I've reduced the
Code:
FOR TempWD = 0 TO 1000
to
Code:
FOR TempWD = 0 TO 10
so at 115200 baud rate that should equate to 115 bytes as second (? yes)
If RCIF=1 it gosubs to the TERM_RX
Code:
Term_RX:
HSERIN [nTest]
SELECT CASE nTest
CASE "S"
TempWD = 0
HSERIN 1000,RX_Bombed,[DEC3 TempWD]
normtemp[0] = TempWD
SetPoints(0)=normtemp[0]
goto Term_TX
return
RX_Bombed:
TimeoutCount = TimeOutCount + 1
end select
Goto Term_Rx
Term_TX is simply
Code:
Term_TX:
Hserout [DEC3 Temperatures(0)]
Hserout [DEC3 Temperatures(1)]
Hserout [DEC3 Temperatures(2)]
Hserout [DEC3 Temperatures(3)]
HSEROUT [dec3 normtemp[0]]
HSEROUT [dec3 normtemp[1]]
....
...
...... etc etc
gosub flushBuffer
goto main
If I close the down the application and even disconnect the cable from the EasyPIC board the PIC is still frozen....
Any idea ?
Bookmarks