![]() |
![]()
PIC Links
PIC Reviews
PIC16C64/65/74 Bug Alert!There is a very serious bug with the parallel slave port (PSP) feature of the PIC. It seems that use of the RETURN instruction clears the IBF (input buffer full) flag, so that writes to the PSP may be missed. The work-around is to use the RETLW (return literal) instruction rather than RETURN. I did this by adding a#asm " retlw 0"line just before the end of each of my functions. Unfortunately, this makes it a little difficult to return variable values from functions. I ended up passing the return values thru temporary globals, which is a kludge, but it does work. Also, this wastes a byte each time it's used, since the compiler insists on adding a RETURN at the end of each function. Supposedly, this problem has been fixed in rev 'A' silicon, but I have not confirmed this ... Once the IBF problem was overcome, the PSP worked fine. The slave port provides a very convenient way to connect the PIC to a host processor (in my case, a 68HC11F1). The PIC can be connected directly to the microprocessor bus, and be read from and written to like a normal peripheral device. In fact, the strategy I used was to emulate a device like a UART, where there is a bank of registers which the HC11 can read and write. To do this I just used a block of RAM, and set the PSP up to interrupt the PIC whenever the HC11 accessed the port. The HC11 writes a register address to the PSP, then either reads from or writes to that register with the next byte transfer. It's pretty slick ...
This page is Copyright © 1997 by Randy Rasa. Last updated 06-21-97. |