Mike - K8LH
Well-Known Member
Hi Don, VK3YV,
Just change a few lines of source code in the "v2" program to implement channel rollover from 99 to 01 (turning clockwise) or from 01 to 99 (turning anti-clockwise);
The other features you want are relatively easy too. I would recommend using a regular normally-open push button switch for the simplex/duplex/reverse "mode" function. Press the push button once to go from "simplex" to "duplex" ("tens" digit decimal point lighted), press it again to go from "duplex" to "reverse" ("ones" digit decimal point lighted), press it again to go from "reverse" to "simplex" (both decimal points off). Program would ignore the push button when outside the channel 1 through 8 range. This is where one of those rotary encoders with a built-in push button switch on the shaft might be kind of neat (all functions on a single control knob).
The simplex/duplex/reverse logic is relatively simple (example below) but let me study the best way to implement the hardware and software changes for awhile.
Regards...
Just change a few lines of source code in the "v2" program to implement channel rollover from 99 to 01 (turning clockwise) or from 01 to 99 (turning anti-clockwise);
Code:
while(1)
{ if(upswitch) // if "up" switch pulse
{ upswitch = 0; // clear the switch flag and
if(channel < 99) // if less than upper limit 99
channel++; // increment "channel"
else // otherwise
channel = 1; // rollover from 99 to 01
}
if(dnswitch) // if "dn" switch pulse
{ dnswitch = 0; // clear the switch flag and
if(channel > 1) // if greater than lower limit 01
channel--; // decrement "channel"
else // otherwise
channel = 99; // rollover from 01 to 99
}
The simplex/duplex/reverse logic is relatively simple (example below) but let me study the best way to implement the hardware and software changes for awhile.
Regards...
Code:
while(1)
{ if(upswitch) // if "up" switch pulse
{ upswitch = 0; // clear the switch flag and
if(channel < 99) // if less than upper limit 99
channel++; // increment "channel"
else // otherwise
channel = 1; // rollover from 99 to 01
}
if(dnswitch) // if "dn" switch pulse
{ dnswitch = 0; // clear the switch flag and
if(channel > 1) // if greater than lower limit 01
channel--; // decrement "channel"
else // otherwise
channel = 99; // rollover from 01 to 99
}
tens = channel / 10; // display "tens", 0..9
ones = channel % 10; // display "ones", 0..9
if(modesw) // if mode push button press
{ modesw = 0; // clear the switch flag and
mode++; // increment "mode" var'
if(mode == 3) // if upper limit 2
mode = 0; // rollover to 0
}
if(channel > 8) // if outside channel 1..8 range
mode = 0; // force "mode" to 'simplex'
if(mode == 0) // if "simplex" mode
eprom = tens << 4; // eprom = 0x01..0x99
if(mode == 1) // if "duplex" mode
eprom = 0x50; // eprom = 0x51..0x58
if(mode == 2) // if "reverse" mode
eprom = 0x60; // eprom = 0x61..0x68
eprom += ones; //
if(polarity) // if polarity jumper off (hi)
portc = eprom; // normal eprom address data
else // if polarity jumper on (lo)
portc = ~eprom; // invert eprom address data
}
}
Last edited: