Example. You have Eight Receiver Inputs, each can be on or off... so define a BYTE for the Receiver states... give it a meaningful name...
Receive var Byte
Now you've got eight bits in that byte called Receive... so define those...
RxChannelA var Receive.0
RxChannelB var Receive.1
RxChannelC var Receive.2
RxChannelD var Receive.3
RxChannelE var Receive.4
RxChannelF var Receive.5
RxChannelG var Receive.6
RxChannelH var Receive.7
The nice thing is that so far, the above nine statements have cost you NOTHING, NIL, ZIPPO in program space... now use those like so...
If PushButtonA=0 then RxChannelA=RxChannelA^1
For example, the above will toggle the state of the RxChannelA BIT each time the PushButtonA is pressed.
Use READ and WRITE and DATA (see manual) to save your BYTE into your pics EEPROM accordingly.
btw... You are aware that somebody's done what you're doing already?
http://www.ncsradio.com/m_switch.html
Now, once you've looked at the competition, you'll probably want the ability to assign each receiver channel input to more than one output, in that case BIT operations would be inappropriate and you'll probably want to assign a BYTE to each channel rather than a BIT.




Bookmarks