Is this a bug?
This code produces an error: Parameter must be a single port pin.
---
Dim LED1 As LATB.5
while true
toggle(LED1)
wend
-----
If I do, Dim LED1 As PORTB.5 it works.
Toggle question
Moderators: David Barker, Jerry Messina
I think I am right in saying that, even if you dim your LED alias as Port.Pin, when writing to a port it will use the LAT, not the PORT register. It's not a bug, just use the Port.Pin definition always and let the compiler worry about using LAT... It's very clever really and saves you the worry.
Regards,
Steven
Regards,
Steven
always worthwhile to look at the generated asm
So yeah, it will use LATB. Yet another kinda fussy writing stuff
Code: Select all
I1_F1_000003 ; L#MK Toggle(LED1)
BTG LATB,5
BCF TRISB,5,0
BRA WHILE_0