Yes, I am using your shadow method, but it only works with adding pauses this way:
PORTC.0 = 1
PAUSE 10
PORTC.1 = 1
PAUSE 10
PORTC.2 = 1
PAUSE 10
PORTC.3 = 1
If I remove the pauses, then the thing does not work...
Thank you very much again.
Yes, I am using your shadow method, but it only works with adding pauses this way:
PORTC.0 = 1
PAUSE 10
PORTC.1 = 1
PAUSE 10
PORTC.2 = 1
PAUSE 10
PORTC.3 = 1
If I remove the pauses, then the thing does not work...
Thank you very much again.
What if you did it like this?
Code:ShadowC VAR byte ShadowC = PORTC ShadowC.0 = 1 PORTC = ShadowC ShadowC.1 = 1 PORTC = ShadowC ShadowC.2 = 1 PORTC = ShadowC ShadowC.3 = 1 PORTC = ShadowC
Why pay for overpriced toys when you can have
professional grade tools for FREE!!!
I want to thank you very much.
The problem is resolved, now I am setting the pin output states super fast!
The final working code was the one posted by rmteo, but thank you all really!
ShadowC VAR byte
ShadowC = PORTC
ShadowC.0 = 1
PORTC = ShadowC
ShadowC.1 = 1
PORTC = ShadowC
ShadowC.2 = 1
PORTC = ShadowC
ShadowC.3 = 1
PORTC = ShadowC
You can do it even faster by doing it the way Charles originally showed you, (did you REALLY try that and it didn't work?) in other words:/Henrik.Code:ShadowC VAR BYTE ShadowC = PortC ShadowC.0=1 ShadowC.1=1 ShadowC.2=1 ShadowC.3=1 PortC = ShadowC
Why pay for overpriced toys when you can have
professional grade tools for FREE!!!
Sorry for the typo - and the inability to edit a post.
Code:ShadowC VAR BYTE ShadowC = PortC ShadowC = $f PortC = ShadowC
Why pay for overpriced toys when you can have
professional grade tools for FREE!!!
Hi,
Not really because then the top four bits will be 0 which they might not have been when PortC was read. And IF the top four bits doesn't matter then I see no reason for not simply writing to PortC directly, ie PortC = $F which would make THIS particular example even faster....Even faster would be this way - but obviously the OP did not try it the way Charles described.
However, I suspect that setting the low four bits to 1 are just an example. Using bitwise AND/OR could also work but I'm not sure it's faster than simply flipping the four bits in ShadowC and then writing it to the port.
/Henrik.
Bookmarks