I am writing a program that uses 20 different case options to modify outportb values. The subroutine converts Hex to decimal, and used often. I don't want to add the subroutine in each case selection. Here is what I was thinking of, but I am not quite sure how to do it. Can I have a separate program after the end of the main program? Or should I use an #include?
Code:
main()
{
case '1':
// call H2D
H2D;
break;
case '2':
H2D;
break;
etc.
} // end main
// Hex to Decimal conversion
H2D()
{
program lines .......
} // end H2D