News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Semi mystery with POW

Started by John Drew, Jul 23, 2021, 05:33 AM

Previous topic - Next topic

John Drew

Les, this is not an anomoly but a minor error issue.
Although I read that the POW is not supported in 16F I had used it in an 18F device. I then changed to a 16F1827 because I had some.
The manual is clear that POW is not supported in 16F series but being an enhanced chip I thought I'd press compile and see what happens.
The compiler accepted POW and inserted a call to the POW routine. The compile progressed to the Assembler stage where the assembler errored where the call to the POW routine was made. An examination of the ASM confirmed this.
Maybe an error message could come up in Positron when an illegal function is encountered because Assembler errors are cryptic to say the least.
Just a thought. The manual was clear, the cause was me, I appreciate you can't make everything idiot proof!

Here's the relevant
ASM generated:
    MOVF PBS_VAR0,W
    MOVWF PP_AARG
    MOVF PBS_VAR0H,W
    MOVWF PP_AARGH
    MOVF PBS_VAR0HH,W
    MOVWF PP_AARGHH
    MOVF PBS_VAR0HHH,W
    MOVWF PP_AARGHHH
    CALL __FPPOW_32__
    MOVF PP_AARG,W
    MOVLB 0X01

And the call is to __FPOW__32__

Best wishes
John

top204

Thanks John... I'll check it out.

It should have created an error for non-compatability.

You would be better creating a procedure for the Pow function.

John Drew

Yes, I did a workaround. Procedures make it all easy.
John