Thinking about this further, and assuming you are only using the pin values to send to the other end then
TRANSMITTER
RECEIVERCode:PORTSTATE var Byte LASTSTATE var Byte Main: PORTSTATE= PORTA & $0F ' mask Port A to retrieve lower 4 pins If PORTSTATE <> LASTSTATE then ' something has changed LASTSTATE = PORTSTATE Hserout [PORTSTATE] Endif Pause 10 Goto Main
That would save loads of program space provided you did not need individual pin states for any other purpose.Code:Main: Hserin 20,Main, [PortState] PortState = PortState ^ $0F ' EOR to invert pin states (omit this line if you want normal state) PORTA = Portstate ' Set the pins Goto Main
Dont forget the set the TRISA registers to configure pins as Inputs and outputs.
NB: There might be slight errors above as I rarely get it right first time!!!!




Bookmarks