Hi David,
Do you have a link to the PLC in question and/or its documentation?
If you know that the PLC does indeed respond with the 'K' then about the only thing I can think of is that the PLC responds so fast that the PIC doesn't have enough time to "setup" the SERIN command - by the time its ready to receive the 'K' may already be partly sent. I see you're running at 20MHz so I admit I'd be a bit surprised if it doesn't but it's a thought.
You could try to
I feel there might be some confusion. SEROUT2/SERIN2 are bit-banged serial routines, they don't use the USART in the PIC. You're using PortC.6 and PortC.7 (which are the USART pins) and you're setting registers associated with the USART as if the USART was being used for the serial communication - when using SEROUT2 etc it's not. If you're intending to use the USART then the commands to look for are HSEROUT/HSERIN
Also, what's this?Shouldn't the colon be after the label (STPCMD:) ? Same thing withCode:pause 3000 :STPCMDWNLDCMD (EDIT: Stupid forum, that should read colon DWNLDCMD, not a smiley...)
I'd expect that to not compile without errors but apparently it does...
/Henrik.
Bookmarks