News:

;) This forum is the property of Proton software developers

Main Menu

Can I alias a Proc?

Started by TimB, Apr 03, 2026, 04:07 PM

Previous topic - Next topic

TimB

I moved from a pic18f27Q10 to a PIC18F47Q10 and though it would be simple. There was a hidden gotcha

PPS assignment for PWM3 moved from the PORTC on the 27Q10 to PORTD on the 47Q10. I only found this out after I made boards. :(

However PortD.0 is right next to PORTC.3 so I shorted them at the chip and have resigned the PWM pins etc to reroute stuff. But now in the Code I have calls t0 the PWMDuty procs that list the the PWM directly eg:-

' Procedures:
' HPWM1_Duty(pDuty)
' HPWM2_Duty(pDuty)
' HPWM3_Duty(pDuty)
' HPWM4_Duty(pDuty)

So I could go through all the code and change the calls. But it would be nice to have an ALIAS call eg

ALias OptoPWMTop() as HPWM1_Duty()

Then I can keep track of everything

I doubt it can be done but no harm asking....


Tim
 

top204

#1
Use the preprocessor:

$define OptoPWMTop(pDuty) HPWM1_Duty(pDuty)

So whenever the OptoPWMTop name is used, it will call the HPWM1_Duty procedure.

Remember to place the meta-macro at the beginning of the code listing, otherwise, it will not be recognised. With the preprocessor, a meta-macro must be created before it is used, much the same as the original assembler code macros.

Regards
Les